GDT Tutorial: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
fixed unbalanced parenthesis, will no longer throw errors
m fix typos, missing verb
Line 12: Line 12:
: a register of your CPU that refers to a segment for a special use (e.g. <tt>SS</tt>, <tt>CS</tt>, <tt>DS</tt> ...)
: a register of your CPU that refers to a segment for a special use (e.g. <tt>SS</tt>, <tt>CS</tt>, <tt>DS</tt> ...)
; Selector
; Selector
: a reference to a descriptor you can load into a segment register; the selector is an offset of a descriptor table entry. These entries are 8 bytes long. Therefore, bits 3 and up only declare the descriptor table entry offset, while bit 2 specifies if this selector is a GDT or LDT selector (LDT - bit set, GDT - bit cleared), and bits 0 - 1 declare the ring level that needs to corespond to the descriptor table entry's DPL field. If it doesn't, a General Protection Fault occurs; if it does corespond then the CPL level of the selector used changed accordingly.
: a reference to a descriptor you can load into a segment register; the selector is an offset of a descriptor table entry. These entries are 8 bytes long. Therefore, bits 3 and up only declare the descriptor table entry offset, while bit 2 specifies if this selector is a GDT or LDT selector (LDT - bit set, GDT - bit cleared), and bits 0 - 1 declare the ring level that needs to correspond to the descriptor table entry's DPL field. If it doesn't, a General Protection Fault occurs; if it does correspond then the CPL level of the selector used is changed accordingly.
; Descriptor
; Descriptor
: a memory structure (part of a table) that tells the CPU the attributes of a given segment
: a memory structure (part of a table) that tells the CPU the attributes of a given segment