loading kernel at 1MB

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
GLneo

loading kernel at 1MB

Post by GLneo »

i read it is posible to load my kernel to 1MB with out entering unreal mode(just A20), my current code is this:

Code: Select all

kernel_load:
       mov ax, 0x0
       mov es, ax
       mov bx, 0x1000
       mov ax, 1
       mov cx, 53
       call LoadSectors
is it posible and how is it done???, thx
User avatar
kataklinger
Member
Member
Posts: 381
Joined: Fri Nov 04, 2005 12:00 am
Location: Serbia

Re:loading kernel at 1MB

Post by kataklinger »

Then you can assess form 0x100000 to 0x10ffef and that is about 64kb of memory. It this is enough than you can use this method. You just need to enabel A20 gate, you can find code all over the Internet ;)
QuiTeVexat

Re:loading kernel at 1MB

Post by QuiTeVexat »

If 64k is enough, I'd say you shouldn't even bother loading the kernel to 1MB until you've enabled protected mode. Maybe not even then. There's enough memory in real mode for that.

Unreal mode really isn't too much of a hassle. You push ds and es, enable protected mode, enable A20, load ds and es with flat data descriptors, return to real mode, and pop es and ds.

After you've enabled unreal mode the BIOS can load sectors and you can copy them wherever you want. IMO it's much less of a hassle then not enabling unreal mode.
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:loading kernel at 1MB

Post by Pype.Clicker »

You might find basic directions in the FAQ.

Basically, it will mean turning on the A20 gate and switching to unreal mode so that you can copy blocks loaded by the BIOS (in the conventionnal area) up to the place where you want them to be.

Btw, if you're not *that* much happy with the idea of writing a bootloader, you may want to try GRUB...
Post Reply