Page 1 of 1
loading kernel to location other than 1MB?
Posted: Fri Dec 26, 2008 4:25 pm
by mrnoob
Hi,
ive just completed a fat16 bootloader, but im trying to consider how to proceed. As the first few lines of the kernel are still in real mode (the fat16 bootloader lives entirely in the MBR and so has no space to switch to protected) i cannot place the kernel at 1MB, the standard location. Is there any problem with me loading it at somewhere earlier, e.g. the 1KB boundary, apart from having to jump around the EBDA and other annoyances? Or is there a workaround for this?
Thanks in advance
Re: loading kernel to location other than 1MB?
Posted: Fri Dec 26, 2008 5:14 pm
by Combuster
There is no real issue with having a kernel below 1MB, other than having a limited amount of space for your kernel to fit in (some 500k), and your bootloader being in the middle (just below the 32k mark)
What most people do is use unreal mode, or a two-stage bootloader to make loading at 1M a lot easier. And some are able to fit it all in 512 bytes.
Re: loading kernel to location other than 1MB?
Posted: Fri Dec 26, 2008 5:28 pm
by mrnoob
surely if i jmp instead of call to the kernel i can overwrite the bootloader in memory? seen as i wont be returning there.
[edit] never mind, i just realised that if the kernel overran the bootloader the jmp to the kernel would be overwritten and the kernel would begin execution halfway through.
Re: loading kernel to location other than 1MB?
Posted: Fri Dec 26, 2008 5:36 pm
by LoseThos
My boot loader relocates itself to the 90000h area. It loads a 2nd stage loader, though, which doubles as half the kernel. The 2nd stage module loads in the range 40000h-70000h. When it runs, I loads the remainder above 1 Meg.
Re: loading kernel to location other than 1MB?
Posted: Fri Dec 26, 2008 5:51 pm
by mrnoob
hmm im starting to get an idea of what ill do. as ive chosen a heavily abstracted microkernel as my design, i might load it to 0x10000/64kb and simply have the kernel parse the filesystem and load a bunch of drivers and such in over the 1MB boundary, then set them to work. Basically a mix of second stage bootloader and kernel.
Thanks for the advice
Re: loading kernel to location other than 1MB?
Posted: Sat Dec 27, 2008 5:53 am
by Combuster
LoseThos wrote:My boot loader relocates itself to the 90000h area.
Which may very well be inside the EBDA