Page 1 of 1

loading kernel at 1MB

Posted: Fri Jan 06, 2006 8:32 pm
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

Re:loading kernel at 1MB

Posted: Sat Jan 07, 2006 7:26 am
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 ;)

Re:loading kernel at 1MB

Posted: Sat Jan 07, 2006 8:19 pm
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.

Re:loading kernel at 1MB

Posted: Mon Jan 09, 2006 3:56 am
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...