Page 1 of 1
Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 7:53 am
by jtokarchuk
Hello there. I have what hopes to be a somewhat simple question.
In real mode, the Kernel is limited to 64k, correct? That beig said, if I write a memory manager, am I able to use multiple segments for one program? Say 256k, or am I limited to 64k in a program as well.
I am not wanting to be spoonfed, I have done a lot of googling and haven't come up with much. point in the right direction is all I ask.
Thanks.
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 8:02 am
by rdos
No single segment can be larger than 64k in real-mode, but it doesn't mean that kernels or programs are confined to 64k. There are various memory models that deals with this problem: compact (single code, many data), medium (single data, many code) and large (many code, many data).
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 8:03 am
by jtokarchuk
Thank you for the reply. I have somewhere to look now!
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 8:54 am
by Combuster
No single segment can be larger than 64k in real-mode
Lies!
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 9:16 am
by rdos
Combuster wrote:No single segment can be larger than 64k in real-mode
Lies!
That's unreal mode.
But you are right. If you switch to protected mode and back to real mode, you could enable larger segments (with 32-bit addressing!). However, without that, it is not possible.
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 9:18 am
by jtokarchuk
I was considering this. In my research, I see that the "code" segment is limited to 64k, can someone expand on this? Does this mean that the kernel is limited to 64k unless you use your own memory model?
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 9:28 am
by Combuster
Define "your own"
You can do all program calls by default as near calls, or you can do them by default as far calls. Using the first method exclusively gives you a 64k code max. The second form gives you a code size limited to 1MB, but is slower. The same goes for data references which can be 16-bit with a fixed segment register value, or 32-bit seg:off pointers.
If the compiler supports memory models, you can tell it which choices to make on these matters. There's nothing new here.
Re: Real Mode Memory Addressing
Posted: Sun Oct 23, 2011 9:30 am
by jtokarchuk
Excellent. Thanks for the quick responses, it is appreciated.