Is this correct?

Started by
6 comments, last by Leadorn 21 years, 9 months ago
Hi 16bit adresses - Realmode x86 4 segments - cs es ss ds 64 kb in all of them 32bit adresses - PMode x86 4 segments - cs es ss ds 4096 mb in all of them (theoretical); I dont have 4096*4 mb ram.... So we still uses segment or? There are some motherboards that can handle 8 gb of ram so it has to be segments......?
Advertisement
Hi,

First let me point out that all these questions and many more are answered in the "IA-32 Intel ® Architecture Software Developer’s Manual Volume 1 : Basic Architecture" which can be downloaded for free from developer.intel.com

There is 6 segment registers: cs, ds, ss, es, fs, gs. And yes in real-mode (and virtual mode) each is 16-bit large and therefore 64kb each. You can change these segments at run-time to access 1MB.

In protected mode (or the management mode) each segment is 32-bit and therefore 4GB large. In protected mode the IA-32 supports two memory models - the flat memory model and the segmented memory model. The flat - which is the one used by the compilers I know (do they support the segmented one?) uses the same value for all the segment registers so you only get one segment. This is convenient since you avoid segment hell - but it *is* possible to use segmented mode and get access to a total of 64GB virtual memory.
Jacob Marner, M.Sc.Console Programmer, Deadline Games
Yeaaaa, now i only have to stick some more memory modules in my pc.......... 64 gb
Check out AWE (Address Windowing Extensions).
---visit #directxdev on afternet <- not just for directx, despite the name
Whether to support both flat and segmented memory models is not so much up to the compiler. The compiler must support whatever the operating system it compiles for supports. AFAIK there are no operating systems that use the segmented model (not any major/widespread ones at least, there are probably some small hobby OS'' that do).

The flat model isn''t really any different from the segmented one. The processor handles them both in the same way, it''s just that in the flat model all segments overlap and cover the same memory space. The processor will still do segment lookups and such in exactly the same way as in a segmented model (i.e. the processor doesn''t know (nor needs to know) whether your using segmented or flat memory). I guess I''m getting a bit off-topic here...
The Pentium Pro processor’s
expanded 36-bit address bus gives a maximum physical address space of 64GBytes.
quote:Original post by Leadorn
Yeaaaa, now i only have to stick some more memory modules in my pc.......... 64 gb


One note, don''t confuse *virtual* adress space with *physical* memory. A virtual adress is the adress that the application sees. This is mapped by the processor to a physical adress that is entirely different (using paging) - or it might even map to the harddisk by the OS is the physical memory is low.

So the amount of virtual memory is (in the segmented model) limtied to 36-bit (64GB) but the physical processor limits might be much lower - and be even lower due to limitations on the motherboards. (Few PC motherboards today supports that much RAM!)

quote:
The compiler must support whatever the operating system it compiles for supports. AFAIK there are no operating systems that use the segmented model (not any major/widespread ones at least, there are probably some small hobby OS'' that do).


I didn''t know this. Thanks for the info.

Jacob Marner, M.Sc.Console Programmer, Deadline Games
Yes, but is sais that the cpu can adress up to 36 bit adresses. So if i have motherboard that supports it it will go find!! or am i wrong.

This topic is closed to new replies.

Advertisement