Page 1 of 1

Real Mode and Protected Mode Kernel

Posted: Sat Apr 05, 2003 12:48 pm
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)?

Re:Real Mode and Protected Mode Kernel

Posted: Sat Apr 05, 2003 1:06 pm
by slacker
is 4gb of memory available in real mode..? i dont think so

Re:Real Mode and Protected Mode Kernel

Posted: Sat Apr 05, 2003 1:15 pm
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!

Re:Real Mode and Protected Mode Kernel

Posted: Sat Apr 05, 2003 4:52 pm
by FlashBurn
Yeah, but I think you could rewrite it, so that it also works in pmode. What piece of code is this?

Re:Real Mode and Protected Mode Kernel

Posted: Sat Apr 05, 2003 5:29 pm
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...

Re:Real Mode and Protected Mode Kernel

Posted: Sun Apr 06, 2003 5:08 am
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 ?...

Re:Real Mode and Protected Mode Kernel

Posted: Sun Apr 06, 2003 2:55 pm
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.

Re:Real Mode and Protected Mode Kernel

Posted: Sun Apr 06, 2003 5:08 pm
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.

Re:Real Mode and Protected Mode Kernel

Posted: Sun Apr 06, 2003 7:26 pm
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

Re:Real Mode and Protected Mode Kernel

Posted: Mon Apr 07, 2003 4:46 am
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)...