grub can't find multiboot header in a higher-half kernel
Posted: Sun May 16, 2021 8:40 am
Hello, I have tried to implement a higher-half kernel. For that i used the tutorial in the Wiki. I am not so sure about the cause, but in the hexeditor, it shows that the multiboot header is at address 0x451c and i am assuming that grub cannot find it, because it is not at the front. ( the header is intact ).
Now how do I modify the linker script to put it earlier into my program? Problem is, I even tested the code for the tutorial without my own. even there grub
could not find my header - with one exception: if I delete the tty.c part of the kernel.c file. The disassembly doesn't help either - objdump shows the multiboot header at the front where it should be, at one megabyte. The linker throws no errors. I have "fixed" it one time by putting the header and bootstrap code into the .text section
Now how do I modify the linker script to put it earlier into my program? Problem is, I even tested the code for the tutorial without my own. even there grub
could not find my header - with one exception: if I delete the tty.c part of the kernel.c file. The disassembly doesn't help either - objdump shows the multiboot header at the front where it should be, at one megabyte. The linker throws no errors. I have "fixed" it one time by putting the header and bootstrap code into the .text section
Code: Select all
[.text ALIGN (4K) : AT (ADDR (.text) - 0xC0000000)
{
*(.multiboot.data) /* the header*/
*(.multiboot.text)
*(.text)
}/code]
but that just page faulted, which is probably for the better. objdump shows the multiboot header in this case in the linker-specified location, the higher half, but it still worked, because like a miracle, it is now at 0x1000. how do i specify the location of the multiboot header in the linker script?
sorry for my bad english, i'm not a native speaker.