Babystep6: Difference between revisions
[unchecked revision] | [unchecked revision] |
Content deleted Content added
No edit summary |
m use talk page |
||
(7 intermediate revisions by 5 users not shown) | |||
Line 1:
__NOTOC__
==Descriptors==▼
{{Infobox Tutorial
| name=Babystep6
| prev=[[Babystep5]]
| next=[[Babystep7]]
}}
=== Entering protected mode ===
Entering [[Protected mode]] is actually done by switching a single bit in a special control register (cr0). (All the other stuff, like [[A20Line]], tasks, [[IDT]], call gates, etc. is additional stuff.)
Line 5 ⟶ 13:
However, before switching to pmode, you have to use the LGDT instruction to load another special register (gdtr) with the location of a table of data structures called descriptors that tell the process how to access memory.
▲==Descriptors==
Overview of bytes in the descriptor:
Line 34 ⟶ 41:
|-
| <tt>6</tt>
| <tt>0x00</tt> = (bits) 0 - 0 - 0 - 0 - 0000 = G - D/B -
|-
| <tt>7</tt>
Line 40 ⟶ 47:
|}
===Bits in Type (byte #5)===
▲;"P"
:Present (1 bit) = 1 means segment is in memory (accessing a non-present segment will raise an exception)
;
:Descriptor Privilege Level (2 bits) = 0 is most privileged and 3 is least.
;
:System (1 bit) = must be 0 in descriptors for Task State Segments (TSS), Interrupt Gate, Trap Gate, Task Gate, Call Gates. Otherwise, for code/data/stack segment descriptors, it will be 1.
;
:Type (4 bits) = interpretation of these depends on whether S (above) is set or not. For S=0, the interpretation will be covered in specific instances of gates etc.
Line 58 ⟶ 64:
;Type bit 2
:The next highest bit depends on the highest bit. If code segment, this next bit indicates whether the segment is 'Conforming' or not. This allows programs somewhere else that are LESS privileged to access this segment, then this segment conforms to the
;Type bit 1
Line 66 ⟶ 72:
:The lowest bit means that the segment has been accessed already (1) or not.
===Bits in
;G
;D/B
;R
;AVL
;Size
==See Also==
*[[Global Descriptor Table]]
*[[Segmentation]]
[[Category:Babystep]]
|