History log of /haiku-fatelf/src/system/boot/platform/bios_ia32/long.cpp
Revision Date Author Comments
# 9f629ef3 17-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Rename KERNEL_LOAD_BASE_64BIT to KERNEL_LOAD_BASE_64_BIT for consistency.


# 59ae45c1 21-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed commpage for x86_64.

Since the commpage is at a kernel address, changed 64-bit paging code
to match x86's behaviour of allowing user-accessible mappings to be
created in the kernel portion of the address space. This is also
required by some drivers.


# 76a1175d 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.


# 93cba1da 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed a bug resulting from a mistake in the boot 64-bit paging setup.

This was an interesting bug to find. Was getting spurious triple faults
in the slab allocator. The problem was that the boot paging setup code
was mapping all page tables it created into the virtual address space,
but in the kernel no areas were being created to cover them, so during
arch_vm_init_end() the pages for them ended up being freed and then
overwritten later on. Fixed by unmapping page tables after populating
them in long_mmu_init().


# 15feb603 06-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

A few improvements suggested by Ingo.


# 0da10c8b 05-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Some fixes to the long mode switch code.

* Wasn't storing the fixed virtual address of the PML4 in kernel_args.
* After switching to long mode, reload GDTR with the virtual address of
the GDT. This was working fine until now because the physical address
was identity mapped, but broke as soon as I removed the identity
mapping.


# a8f85e6e 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Removed accidently left in debug message.


# e70dd7e0 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Map all physical memory in the long mode paging setup.

Since x86_64 has such a large virtual address space all available physical
memory can be mapped in to it. The physical page mapper implementation for
x86_64 will use this mapping. Also changed the mapping code to map kernel
pages with the global flag.


# 0897e314 02-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Merged x86_64 headers into x86 headers.

Not many changes seeing as there's not much x86_64 stuff done yet. Small
differences are handled with ifdefs, large differences (descriptors.h,
struct iframe) have separate headers under arch/x86/32 and arch/x86/64.


# 0705884a 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Style fixes.


# c9f6d227 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

x86_64: Implemented exception handling.


# 3403f23e 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Moved the common parts of arch_cpu.h between x86 and x86_64 to arch/common_x86/cpu.h.


# 3f017e90 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Also need to fix the kernel_args_range addresses.


# 991e5bee 26-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Pass correct kernel_args address to the kernel.


# e5fc2bfc 26-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented long mode setup/switch code, the bootloader can now start the 64-bit kernel!

The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page
tables that include all kernel mappings from the 32-bit address space, but at
the correct 64-bit address, then go through kernel_args and changes all virtual
addresses to 64-bit addresses, and finally switch to long mode and jump to the
kernel.


# 9f629ef38e6655e1509dca6db587a2035243ccdb 17-Aug-2012 Alex Smith <alex@alex-smith.me.uk>

Rename KERNEL_LOAD_BASE_64BIT to KERNEL_LOAD_BASE_64_BIT for consistency.


# 59ae45c1ab32476f1fa428dae22989f8387a1f9e 21-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed commpage for x86_64.

Since the commpage is at a kernel address, changed 64-bit paging code
to match x86's behaviour of allowing user-accessible mappings to be
created in the kernel portion of the address space. This is also
required by some drivers.


# 76a1175dbe1a314563ca18c0b7fb82695a9730cd 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.


# 93cba1da96275eb617fcdc581ec4522e0b107adf 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Fixed a bug resulting from a mistake in the boot 64-bit paging setup.

This was an interesting bug to find. Was getting spurious triple faults
in the slab allocator. The problem was that the boot paging setup code
was mapping all page tables it created into the virtual address space,
but in the kernel no areas were being created to cover them, so during
arch_vm_init_end() the pages for them ended up being freed and then
overwritten later on. Fixed by unmapping page tables after populating
them in long_mmu_init().


# 15feb60325be086823e80a3468f7aab2bfbc9f7d 06-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

A few improvements suggested by Ingo.


# 0da10c8b51f9ec443a53873b37d07fab30a5734e 05-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Some fixes to the long mode switch code.

* Wasn't storing the fixed virtual address of the PML4 in kernel_args.
* After switching to long mode, reload GDTR with the virtual address of
the GDT. This was working fine until now because the physical address
was identity mapped, but broke as soon as I removed the identity
mapping.


# a8f85e6e48ec38ad16d9e1289f031e696220367e 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Removed accidently left in debug message.


# e70dd7e0af671e37378d68c241a081ebeaf8f659 04-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Map all physical memory in the long mode paging setup.

Since x86_64 has such a large virtual address space all available physical
memory can be mapped in to it. The physical page mapper implementation for
x86_64 will use this mapping. Also changed the mapping code to map kernel
pages with the global flag.


# 0897e314b79d09b04349d3cfe6093a3fd6220da1 02-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Merged x86_64 headers into x86 headers.

Not many changes seeing as there's not much x86_64 stuff done yet. Small
differences are handled with ifdefs, large differences (descriptors.h,
struct iframe) have separate headers under arch/x86/32 and arch/x86/64.


# 0705884ac415022fb9c734da089fe3dd5a06873a 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Style fixes.


# c9f6d2271fc105de01b1359d66c5304c75bd396d 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

x86_64: Implemented exception handling.


# 3403f23e81b7bd6e50c459d01ae7238c1f3f5984 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Moved the common parts of arch_cpu.h between x86 and x86_64 to arch/common_x86/cpu.h.


# 3f017e90611b6b53186f72bd9f6aa837d15e588a 27-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Also need to fix the kernel_args_range addresses.


# 991e5bee90ffd98a39f012f6ce4e0740eb620073 26-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Pass correct kernel_args address to the kernel.


# e5fc2bfcab8c15a3ff7d33c358f9aa82ed73c823 26-Jun-2012 Alex Smith <alex@alex-smith.me.uk>

Implemented long mode setup/switch code, the bootloader can now start the 64-bit kernel!

The setup procedure is fairly simple: create a 64-bit GDT and 64-bit page
tables that include all kernel mappings from the 32-bit address space, but at
the correct 64-bit address, then go through kernel_args and changes all virtual
addresses to 64-bit addresses, and finally switch to long mode and jump to the
kernel.