Yes it works, thank you. I applied that for my bootloader and it works now
But why to load the kernel at 0x7E00 ?
[SOLVED] Pass arguments (bootloader)
- iocoder
- Member
- Posts: 208
- Joined: Sun Oct 18, 2009 5:47 pm
- Libera.chat IRC: iocoder
- Location: Alexandria, Egypt | Ottawa, Canada
- Contact:
Re: [SOLVED] Pass arguments (bootloader)
Because you have linked the kernel and the bootloader together as one single program.Tinei wrote:Yes it works, thank you. I applied that for my bootloader and it works now
But why to load the kernel at 0x7E00 ?
In my point of view, you should put your kernel in a separate place so that the design can be clear. However, there is no harm in loading stage2 of the bootloader to 0x7E00, since you link stage1 and stage2 together in your makefile.
Also try to pass parameters by stack, and see why it doesn't work. It should work well. In C, don't pop the stack, but either add two integer parameters to your _start, so the signature can be something like this:
Code: Select all
_start(int low_memory, int high_memory);
BTW, if you want to load your kernel/stage2/whatever program you link with stage1 to another memory location than 0x7E00, you can divide your program into to sections (for example .text_stage0 and .text_whatevaa) and tell your linker that .text_stage0 will be at 0x7C00 and .text_whatevaa will be at wherevaaa. It's all about configuring the linker/toolchain correctly to achieve whatevaaa you like.
Good luck