Opened 10 years ago

Closed 7 years ago

#6310 closed enhancement (fixed)

Haiku x86_64 kernel port

Reported by: nmentley Owned by: xyzzy
Priority: normal Milestone: R1
Component: System/Kernel Version:
Keywords: Cc:
Blocked By: Blocking:
Platform: x86-64


Currently the haiku kernel can't be compiled for the x86_64 architecture.

Attachments (8)

x86_64.kernel_void_functions.patch (71.5 KB ) - added by nmentley 10 years ago.
adds blank functions for x86_64 kernel to allow compilation.
x86_64_system_headers.patch (53.3 KB ) - added by nmentley 10 years ago.
adds incomplete x86_64 system headers to allow kernel compilation
64bit_safe_kernel.patch (8.7 KB ) - added by mmlr 10 years ago.
buildsystem.patch (42.3 KB ) - added by mmlr 10 years ago.
system.headers.patch (85.8 KB ) - added by mmlr 10 years ago.
x86_64_kernel_sources.finished.patch (256.0 KB ) - added by mmlr 10 years ago.
x86_64_kernel_sources.unfinished.patch (76.1 KB ) - added by mmlr 10 years ago.
x86_64_support_source.patch (41.2 KB ) - added by mmlr 10 years ago.

Download all attachments as: .zip

Change History (13)

by nmentley, 10 years ago

adds blank functions for x86_64 kernel to allow compilation.

by nmentley, 10 years ago

Attachment: x86_64_system_headers.patch added

adds incomplete x86_64 system headers to allow kernel compilation

by mmlr, 10 years ago

Attachment: 64bit_safe_kernel.patch added

comment:1 by mmlr, 10 years ago

patch: 01

by mmlr, 10 years ago

Attachment: buildsystem.patch added

by mmlr, 10 years ago

Attachment: system.headers.patch added

by mmlr, 10 years ago

Attachment: x86_64_support_source.patch added

comment:2 by mmlr, 10 years ago

I've attached Nathans work as of the end of the GSoC coding period here. The following is a quote of his mail explaining the different parts. I've put all of the patches in this ticket as that seems more straight forward. Please anyone feel free to review/commit as I won't have the time for the foreseeable future.

I have the majority of the code written out... based on the x86
code for obvious reasons, but with parts taken out... like vm86 and so
on. I have most of the assembly converted to x86_64 equivalent code, but
not all of it. It proved to be a more difficult challenge that I
expected. Like I said earlier. There are sections of the kernel that
just aren't finished. SMP is nonexistent and paging isn't taking
advantage of the top level paging directory. Furthermore I can't get the
system to successfully jump into long mode if I setup the code inside
haiku_loader instead of initializing long mode after jumping to the

I've included 6 patch files. The 64bit_safe_kernel.patch just changes a
few lines of code in non arch specific source files that weren't
originally 64bit safe. For example assumptions that pointers would fit
nicely in uint32s... Also typecasting to get FixedWidthPointers working
were common as well.

The buildsystem.patch sets x86_64 to use the bios_ia32 platform. It adds
a /build/jam/BootloaderRules file filled with bootloader rules instead
of having (if _BOOT_MODE) inside of the KernelRules. It also includes
all the jamfiles for haiku_loader that would get changed by the
BootloaderRules. The patch also includes the linker scripts for x86_64.
I'm still using Target_Kernel_PIC_Linkflags to set the minimum paging
size of the kernel to 4kb. I'm manually passing PIC_LINKFLAGS in the
kernel jam file instead of using Target_Kernel_Linkflags. I'm not sure
why just using Target_Kernel_Linkflags is failing, but the
Kernel_Pic_Linkflags is just a temporary work around.

The system.headers.patch is simply just the x86_64 headers. There are a
few changes to a few x86 header files, but those were just to allow both
x86_64 and x86 to run on the same bios_ia32 platform. Similar
arch_kernel_args are needed and the GDT file structure needed to be
changes to allow toggling between setting up a 32bit or 64bit gdt. One
oddity is headers/private/kernel/boot/arch.h. Instead of just adding the
5 additional lines. svn diff deletes the whole file and rewrites it. I
can't figure out why.

The x86_64_support_source.patch contains x86_64 libroot files that are
used by haiku_loader x86_64 and kernel_x86_64. This patch also includes
a few changes to haiku_loader that were suggested by Ingo in response to
the last time I posted patches.

The x86_64_kernel_sources.finished.patch is a patch of files that I feel
are the more complete part of the kernel code. Almost all the c++ code
is included in that patch. The smp and paging code isn't in this patch.

The x86_64_kernel_sources.unfinished.patch contains files that aren't as
finished as the rest. Alot of the assembly is here. A lot of the files
in this folder only have a few parts in need of repair.

comment:3 by anevilyak, 8 years ago

Owner: changed from axeld to xyzzy
Status: newassigned

comment:4 by korli, 7 years ago

Can this enhancement be considered as closed?

comment:5 by xyzzy, 7 years ago

Resolution: fixed
Status: assignedclosed

Thought I'd closed all these. Evidently not :)

Note: See TracTickets for help on using tickets.