Page 1 of 1

How to place kernel in high memory area

Posted: Mon Aug 28, 2006 4:27 am
by conner
Hi

I'm working on a bootloader and want it to load kernel at physical address 0x01000000 (16mb), because DMA will use the first 16mb later. How is this done? I was thinking something like:

(maybe put all this in a 2nd stage bootloader)
1. Enable A20
2. Switch to unreal mode
3. Locate kernel on disk
4. Set es:bx to a buffer <1mb mem area and use int13,2 (read sectors)
5. Move kernel from <1mb area to 0x01000000 (16mb)
6. Setup p-mode
7. Execute kernel

Think this will work, but I find it ugly that the kernel first have to be read to area below 1mb and then moved. How is a kernel 'normally' loaded into higher memory area?

Thanks!

Posted: Mon Aug 28, 2006 4:51 am
by matthias
You'll also have to increment the base address if your kernel, also with paging you could copy your kernel your kernel in another location and assign the virutal 1mb to physical 16 MB, so you won't have to change your base address, you now have full acces to the first 16 MB.

Posted: Mon Aug 28, 2006 5:26 am
by conner
thought about that, but paging only works in p-mode and not sure how to read data from disk in p-mode as i cant rely on int13

Posted: Mon Aug 28, 2006 5:57 am
by matthias
You do not need to, first load your kernel @ 1mb in rmode, jump to pmode and setup paging and copy your kernel contents to 16 MB, then you map the 16 MB physical to 1 MB virtual.