Over 1 Meg OS Loading

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.
jrfritz

Over 1 Meg OS Loading

Post by jrfritz »

[attachment deleted by admin]
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Over 1 Meg OS Loading

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:14 pm, edited 1 time in total.
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:Over 1 Meg OS Loading

Post by Pype.Clicker »

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)
pskyboy

Re:Over 1 Meg OS Loading

Post by pskyboy »

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

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
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:Over 1 Meg OS Loading

Post by Pype.Clicker »

stay aware that movsd requires ecx to be a *dword* count of the size, so better have
mov ecx, kernel_size/4 ...
Perica
Member
Member
Posts: 454
Joined: Sat Nov 25, 2006 12:50 am

Re:Over 1 Meg OS Loading

Post by Perica »

..
Last edited by Perica on Sun Dec 03, 2006 8:14 pm, edited 1 time in total.
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

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?
pskyboy

Re:Over 1 Meg OS Loading

Post by pskyboy »

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
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

Yea but my GDT's data and codesel only have 0xFFFF...is that enough? How do I change that?
pskyboy

Re:Over 1 Meg OS Loading

Post by pskyboy »

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
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

Some help with enabling 32-bit segments?
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Over 1 Meg OS Loading

Post by df »

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!
-- Stu --
pskyboy

Re:Over 1 Meg OS Loading

Post by pskyboy »

[attachment deleted by admin]
jrfritz

Re:Over 1 Meg OS Loading

Post by jrfritz »

Compatible with a Pentium?
pskyboy

Re:Over 1 Meg OS Loading

Post by pskyboy »

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
Post Reply