Passing multiboot_info_t into kernel and using it
Posted: Fri May 02, 2025 8:31 am
I am moving on from the x86 higher-half barebones,,and I'm trying to pass the multiboot magic and header into the kernel:
I get the expected magic number, but as soon as I dereference addr->flags I get a crash, and it is this that I am trying to understand.
The value of physaddr is 65536 (0x10000), and since I'm working with a higher-half kernel, I convert physaddr to a virtual address as follows:
My guess is that the crash is due to this memory location not being properly mapped in the page tables, but before I try to start fixing that (I am a novice) I wanted to check with you good people to make sure it is not something more obvious than that.
Is it a paging problem? How could I confirm that? Is there something else I should check?
Code: Select all
pushl %ebx # Push the pointer to the multiboot info struct
pushl %eax # Push the magic to be checked by the kernel
call kernel_main
Code: Select all
void kernel_main(uint32_t magic, uint32_t physaddr)
The value of physaddr is 65536 (0x10000), and since I'm working with a higher-half kernel, I convert physaddr to a virtual address as follows:
Code: Select all
multiboot_info_t *addr = (multiboot_info_t*)(physaddr + 0xC0000000);
Is it a paging problem? How could I confirm that? Is there something else I should check?