How to place kernel in high memory area

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
conner
Posts: 3
Joined: Mon Aug 28, 2006 4:16 am
Location: Denmark, Aalborg

How to place kernel in high memory area

Post 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!
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post 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.
The source of my problems is in the source.
conner
Posts: 3
Joined: Mon Aug 28, 2006 4:16 am
Location: Denmark, Aalborg

Post 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
User avatar
matthias
Member
Member
Posts: 158
Joined: Fri Oct 22, 2004 11:00 pm
Location: Vlaardingen, Holland
Contact:

Post 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.
The source of my problems is in the source.
Post Reply