Segmentation: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
→‎See Also: Add link, delete dead link, add title to link.
Added note that segmentation is obsolete, also fixed Gb to GiB (I would have nothing against GB, but Gb is gigaBIT!).
Line 70: Line 70:


==Protected Mode==
==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. For more information, consult [[x86-64]].

:''Read more about [[Global Descriptor Table]]''
:''Read more about [[Global Descriptor Table]]''


In [[Protected mode]] you use a logical address in the form A:B to address memory. As in [[Real Mode]], A is the segment part and B is the offset within that segment. The registers in protected mode are limited to 32 bits. 32 bits can represent any integer between 0 and 4Gb.
In [[Protected mode]] you use a logical address in the form A:B to address memory. As in [[Real Mode]], A is the segment part and B is the offset within that segment. The registers in protected mode are limited to 32 bits. 32 bits can represent any integer between 0 and 4 GiB.


Because B can be any value between 0 and 4Gb our segments now have a maximum size of 4Gb (Same reasoning as in real-mode).
Because B can be any value between 0 and 4GiB our segments now have a maximum size of 4 GiB (Same reasoning as in real-mode).


Now for the difference.
Now for the difference.