GSoC: x86_64 Port

Blog post by nmentley on Wed, 2010-04-28 03:51

Currently Haiku is stuck in the 32bit world. This is fine for the initial BeOS R5 compatible release, but this is extremely limiting for future releases. It's a reasonable goal for Haiku to have a mature 64bit x86 port by the time the R2 release comes out. However ports don't become mature overnight. If full time work is put into porting haiku to the x86_64 platform this summer it'll be feasible to finish the port in a reasonable time to have it throughly tested and ready for the R2 release.

My project for the GSoC is to start the Haiku x86_64 port by completely porting the kernel and modifying the bootloader to load a x86_64 haiku kernel.


Contact Information

  • Name: Nathan Mentley
  • Trac: nmentley
  • IRC: nmentley_
  • Bio: I'm a 20 year old computer science student at Eastern Michigan University in the United States. I was exposed to BeOS R5 Personal Edition roughly 8 years ago and have been an avid BeOS fan ever since. I also happen to be extremely interested in Kernel Development and I've wrote a simple hobby operating system from scratch. I'm eager to get my feet wet with a much more mature code base like Haiku's.

Project information

Haiku x86_64 Port

The goal of this project is to completely port the Haiku kernel to the x86_64 platform by the end of the summer.


Project Milestones

  • Adding a x86_64 haiku target for GCC to produce haiku x86_64 binaries
    • Add a haiku x86_64 ELF binary output in ld
    • Edit the gcc config files to support compiling x86_64 Haiku objects
    • Update the header files in headers/posix/arch/ to support x86_64
  • Update the current bootloader to load haiku 64bit ELF kernels
    • initialize the system into long mode in the second stage bootloader
    • add an x86_64 platform in the bootloader code based on bios_ia32
    • add support for loading ELF64 binaries in the bootloader
  • Port the kernel to a 64bit platform
    • add /src/system/kernel/arch/x86_64 code based on preexisting x86 code
    • clean up any code assuming 32bit longs/pointers or any other 32bit/64bit incompatibilities

Project Plan

The first step of this project would be adding a x86_64 Haiku target to GCC 4. I've already started progress on this and I'm hoping to have this completed before the start of the GSoC.

When the GSoC starts I'll start by initially working on the haiku bootloader first. My current plan is to initialize the system into long mode towards the end of the bootloader process. I'll do this by creating a new platform based on bios_ia32. I'm also planning on modifying the ELF32 loader code in elf.cpp to also support loading ELF64 binaries. I'm hoping to have the bootloader loading a simple hello world style 64bit kernel early on in the project within the first four weeks. When I have reached that mile stone I will have a completed x86_64 compatible bootloader for Haiku.

After I complete the bootloader stage of the project I'm planning on working on porting the Kernel. Most of the high language code shouldn't need to be rewritten too much, but I'll have to fix any portions of code where 32bit was assumed. I'm pretty sure the majority of the work in porting the kernel wlll be adding the needed x86_64 code in the kernel/arch/x86_64 folder, but I'm hoping that I'll be able to use the code in the kernel/arch/x86 folder as a base for the work.

If I do happen to finish all this before the end of the summer I'll start working on porting over modules and userland libraries, but at this time I haven't spent too much time looking at that code yet.


Why this project?

As I said before I've developed a simple x86 operating system from scratch. It has sparked my interest in low level programming and kernel development. In addition to my developmental interested I'm also pretty interested in the project. I was a BeOS R5 user for many years and I've been following the Haiku Project ever since it was OpenBeOS. I'm extremely eager to help recreate a more modern version of R5. That's why I'm interested in working on a 64bit version of Haiku. I feel that eventually by the time Haiku becomes usable for more than just developers we'll need a 64bit complaint version to really take full advantage of most of the userbase's systems. The idea behind the original BeOS was to create a multimedia system. I feel like if we want this operating system to be a multimedia system we'd need to really take full advantage of the desktop computers users will have.


Even though my project doesn't completely port Haiku to x86_64 by the end of the summer I'm planning on continuing development after the GSoC to eventually complete the port.