to circumvent the problems I had with GRUB2 loading my AMD64 kernel, I decided to write a small loader binary in 32 bits that resides in the lower half, does the long mode readying stuff, loads the kernel ELF64 binary that is attached as a multiboot1 module and jump to its entry point.
Although the last point on the list might sound simplest, its actually the one I have most of the problems with. To jump to the 64 bit higher half entry point address (somewhere near 0xFFFFFF000000000), I planned to far jump to a 64 bit realm in the loader itself, that performs the jump to the actual entry point. My problem is to embed this 64 bit realm into my elf32 kernel. I tried the following approach, but it did not work out (machine resetting):
Code: Select all
; mov rax, [0x1002]
; Entry point address QWORD is stored at 0x1002
db 0x48
db 0x8b
db 0x04
db 0x25
db 0x02
db 0x10
db 0x00
; Spacer
db 0x0
; jmp rax
db 0xff
db 0xe0