Over 1 Meg OS Loading
Re:Over 1 Meg OS Loading
..
Last edited by Perica on Sun Dec 03, 2006 8:14 pm, edited 1 time in total.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Over 1 Meg OS Loading
if unreal mode doesn't seem to be reliable to you, you can also opt for a call to BIOS memory move function (it must be in INT15h, or something alike), which moves 64K blocks from any to any memory position (switching to protected mode, moving stuffes, moving back to real mode)
Re:Over 1 Meg OS Loading
Yeah, i just load my kernel in to a block of memory in real mode i then jump to P Mode and move it to where i want it using the movsd instruction. This moves DWORDS. All you have to do is put the amount to move in ECX, Put the destination address in EDI, put the source address in ESI and then MOVSD till it has moved it all.
here is the code
here is the code
Code: Select all
;We're in protected mode so lets move the kernel down to 0
mov ECX,Kernel_Size
mov EDI,0x0
mov ESI,0x40000
REP MOVSD
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Over 1 Meg OS Loading
stay aware that movsd requires ecx to be a *dword* count of the size, so better have
mov ecx, kernel_size/4 ...
mov ecx, kernel_size/4 ...
Re:Over 1 Meg OS Loading
..
Last edited by Perica on Sun Dec 03, 2006 8:14 pm, edited 1 time in total.
Re:Over 1 Meg OS Loading
Ok pskyboy...
I could load it into 0x40000 if I had more than 1 meg of room...how do I do this? Switch to PM and switch to RM with the GDT still intact or something? Also...could someone please post a GDT that lets the 4gig of mem?
I could load it into 0x40000 if I had more than 1 meg of room...how do I do this? Switch to PM and switch to RM with the GDT still intact or something? Also...could someone please post a GDT that lets the 4gig of mem?
Re:Over 1 Meg OS Loading
Im not quite sure what your trying to say. But basically you load your OS to 0x4000:0000 in real mode you then set you GDT tables up and jump to PMODE and then copy the kernel from 0x4000 to wherever you want it then jump to there.
Peter
Peter
Re:Over 1 Meg OS Loading
Yea but my GDT's data and codesel only have 0xFFFF...is that enough? How do I change that?
Re:Over 1 Meg OS Loading
Yeah that will be 4Gb as long as you have the bit set that enables 32bit segments ill have to check which bit that is.
Peter
Peter
Re:Over 1 Meg OS Loading
i used to have a boot sector that loaded a kernel off a FAT12, and read 1 sector, swhitched to pmode, moved 512bytes, switched to realmode, read 1 sector, etc and looped until it was all in 1mb mark.
then just switched to pmode and jumped to 1mb!
then just switched to pmode and jumped to 1mb!
-- Stu --
Re:Over 1 Meg OS Loading
Yeah its only a IA32 bootloader at the moment im waiting for a x86-64 assembler before i make it into a 64bit bootloader.
Peter
Peter