Real Mode and Protected Mode Kernel

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
Mastermind

Real Mode and Protected Mode Kernel

Post by Mastermind »

I am not sure why pmode is better than real mode, but I made my kernel use pmode anyway... I am thinking about loading the kernel in real mode and then switch to and from protected mode. Does anyone know how to change to pmode from rmode and to change to rmode from pmode (i.e. some c function or some asm code)?
slacker

Re:Real Mode and Protected Mode Kernel

Post by slacker »

is 4gb of memory available in real mode..? i dont think so
Mastermind

Re:Real Mode and Protected Mode Kernel

Post by Mastermind »

slacker wrote: is 4gb of memory available in real mode..? i dont think so
I get your point... But I have some rmode code that I do not wish to throw away!
FlashBurn

Re:Real Mode and Protected Mode Kernel

Post by FlashBurn »

Yeah, but I think you could rewrite it, so that it also works in pmode. What piece of code is this?
Ozguxxx

Re:Real Mode and Protected Mode Kernel

Post by Ozguxxx »

Hi, I think in real mode side there is nothing further needed than DOS, also I think it is very very meaningless to utilize a pentium chip(or at least 386 for most people here) by some very primitive os like DOS, right? The preferences that 80386+ give are rooted from protected mode software architecture so you must use protected mode to take full advantage of cpu unless you are running a 8086...
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:Real Mode and Protected Mode Kernel

Post by Pype.Clicker »

not mentionning the fact that switching from real to protected mode is *very* time-consuming, especially if your pmode has paging ...

It is also very unsecure to do so, as rmode parts will be able to alter some state information that pmode parts use.

If your 16 bits code is *that* important, why not executing it as a 16-bits protected segment ? or in a VM86 environment ?...
slacker

Re:Real Mode and Protected Mode Kernel

Post by slacker »

i dont know why people use paging except for the fact that a page is a specified size. id rather use segmentation and write a memory manager that allocates certain sizes.
Tim

Re:Real Mode and Protected Mode Kernel

Post by Tim »

In short, paging gives you far more flexibility than segmentation. And you can still allocate objects smaller than a page, if you split pages into smaller chunks.
Mastermind

Re:Real Mode and Protected Mode Kernel

Post by Mastermind »

I get your point. But some more questions:

Is it very hard to access the mem mapped by pmode in rmode?
Can I use rmode mem in pmode?

If it is very time-consuming, then I think ill stay in pm
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:Real Mode and Protected Mode Kernel

Post by Pype.Clicker »

real mode can *only* use the first 1MB+64K-16 bytes of your physical memory.

If you want more, you need VM86 (which behaves like RM, but can use paging under control of a PMODE supervisor), pmode or FLAT unreal mode (which can access 4GB of data, but only 64K of code at once, and always below 1MB)...
Post Reply