972
edits
[unchecked revision] | [unchecked revision] |
m (Fix lint errors) |
|||
(6 intermediate revisions by 4 users not shown) | |||
Line 37:
|}
DS, ES, FS, GS, SS are used to form addresses when you want to read/write to memory. They don't always have to be explicitly encoded, because some processor operations assume that certain segment registers will be used.
E.g.
Line 70:
==Protected Mode==
:''Segmentation is considered obsolete memory protection technique in protected mode by both CPU manufacturers and most of programmers. It is no longer supported in long mode. The information here is required to get protected mode working; also 64 bit GDT is needed to enter long mode and segments are still used to jump from long mode to compatibility mode and the other way around. If you want to be serious about OS development, we strongly recommend using flat memory model and [[Paging|paging]] as memory management technique. For more information, consult [[x86-64]].''
:''Read more about [[Global Descriptor Table]]''
Line 91:
* The segment presence (Is it present or not)
* The descriptor type (0 = system; 1 = code/data)
* The segment type (Code/Data/Read/Write/Accessed/Conforming/Non-Conforming/Expand-Up/[[Expand_Down|Expand-Down]])
For the purposes of this explanation I'm only interested in 3 things. The base address, the limit and the descriptor type.
Line 118:
==Notes Regarding C==
*Most C compilers assume a flat-memory model.
*In this model all the segments cover the full address space (
*This leaves you with 2 descriptors per privilege level (usually Ring 0 and Ring 3
*In general if you want to use the segmentation mechanism, by having the different segment registers represent segments with different base addresses, you won't be able to use a modern C compiler, and may very well be restricted to just Assembly.
*So, if you're going to use C, do what the rest of the C world does, which is set up a flat-memory model, use paging, and ignore the fact that segmentation even exists.
Line 138:
==See Also==
=== Articles ===
[[Segment Limits#Segmentation|Segment Limits]]
=== Threads ===
Line 145 ⟶ 146:
*[http://duartes.org/gustavo/blog/post/memory-translation-and-segmentation Aug 2008: Memory Translation and Segmentation] by Gustavo Duarte
[[Category:X86]]
[[Category:Memory management]]
[[Category:Memory Segmentation]]
|