Hi,
qookie wrote:
Hello. I'm developing an OS. I get a very weird issue. When I cast void* passed as argument to kernel_main I get a very weird crash. EBX, ESI and EIP are set to a very similar value. Every time EIP is set to the same value(0x31303131) which results in a crash because of code executing outside of ROM or RAM.
Source code.PS. I'm using GRUB 2
The problem is here (in "boot.s"):
Code:
_start:
mov $stack_top, %esp
push %ebp
push %eax
call kernel_main
The address of the multiboot info is passed (by the boot loader) in EB
X, not in EB
P.
Note that you can avoid casting by defining main like this:
Code:
void kernel_main(uint32_t magic, multiboot_info_t* header) {
..but that would just make the code a little cleaner.
Cheers,
Brendan