Page 1 of 1
loading kernel to 0x100000 and learning how much is ram?
Posted: Mon Oct 29, 2007 9:07 am
by ycyos
how can i load my kernel to 0x100000 when my bootloader in real mode with 13h int?
and how can i learn how much ram does the computer have in protected mode
thank you for your answers
Posted: Mon Oct 29, 2007 10:19 am
by AJ
Hi,
The way to load your kernel above 1MB is to load it in to a buffer below 1MB, and then copy it over. If your kernel is less than 64k in size, you can achieve this by enabling A20 and then just doing a normal copy over. If not, you will need to either:
1. Write a protected mod floppy driver and do it all from there.
2. Keep switching between real and protected mode.
3. Use Unreal mode.
4. Use a v86 task (probably overkill if you are at an early OS stage).
5. Use GRUB (my personal recommendation).
As for how much RAM the computer has, see the wiki article:
http://www.osdev.org/wiki/How_Do_I_Dete ... unt_Of_RAM . Using option 5 above will also give you a nice memory map to use. Although this information is
obtained in real mode, it will return the total amount of RAM you have to play with (real mode / pmode or long mode).
HTH
Adam
Posted: Mon Oct 29, 2007 1:18 pm
by Alboin
I've used
this. It actually contains more info than the wiki on the memory map int.
I was going to add it yesterday, but I didn't had time.
Posted: Fri Nov 02, 2007 12:21 pm
by frank
In my bootloader I load my kernel in 64kb chunks to a buffer in low memory and then switch to protected mode to copy the data above 1mb. I then return to real mode and repeat the process until it is completely loaded. It wasn't that hard to do, you just have to make sure that you get rid of all of the artifacts of protected mode before calling any BIOS interrupts. i.e. clean up all segment registers.
EDIT: As for the memory size I use INT 15h. Just look at the link Alboin posted for more information.