Segment Selector: Difference between revisions

From OSDev Wiki
Jump to navigation Jump to search
Line 15: Line 15:
|'''RPL'''
|'''RPL'''
|}
|}
* '''Index:''' Bits 3-15 of the Index of the '''GDT''' or '''LDT''' entry referenced by the selector. ''Since '''[[Segment Descriptors]]''''' ''are 8 bytes in length, the address calculated from the Index is always 8-byte aligned, and the lowest 3 bits of the Index are ignored by the hardware.''
* '''Index:''' Bits 3-15 of the Index of the '''GDT''' or '''LDT''' entry referenced by the selector. ''Since '''[[(追記) Global Descriptor Table#Segment_Descriptor| (追記ここまで)Segment Descriptors]]''''' ''are 8 bytes in length, the address calculated from the Index is always 8-byte aligned, and the lowest 3 bits of the Index are ignored by the hardware.''
* '''TI:''' Specifies which descriptor table to use. If clear ('''0''') then the '''GDT''' is used, if set ('''1''') then the current '''LDT''' is used.
* '''TI:''' Specifies which descriptor table to use. If clear ('''0''') then the '''GDT''' is used, if set ('''1''') then the current '''LDT''' is used.
* '''RPL:''' The requested '''[[Security#Rings|Privilege Level]]''' of the selector, determines if the selector is valid during permission checks and may set execution or memory access privilege.
* '''RPL:''' The requested '''[[Security#Rings|Privilege Level]]''' of the selector, determines if the selector is valid during permission checks and may set execution or memory access privilege.

Latest revision as of 04:25, 22 November 2025

A Segment Selector is a 16-bit binary data structure specific to the IA-32 and x86-64 architectures. It is used in Protected Mode and Long Mode . Its value identifies a segment in either the Global Descriptor Table or a Local Descriptor Table . It contains three fields and is used in a variety of situations to interact with Segmentation .

For more information, see Section 3.4.2: Segment Selectors and Figure 3-6: Segment Selector of the Intel Software Developer Manual, Volume 3-A.

Segment Selector

Segment Selector
15    3 2 1   0
Index TI RPL
  • Index: Bits 3-15 of the Index of the GDT or LDT entry referenced by the selector. Since Segment Descriptors are 8 bytes in length, the address calculated from the Index is always 8-byte aligned, and the lowest 3 bits of the Index are ignored by the hardware.
  • TI: Specifies which descriptor table to use. If clear (0) then the GDT is used, if set (1) then the current LDT is used.
  • RPL: The requested Privilege Level of the selector, determines if the selector is valid during permission checks and may set execution or memory access privilege.

Uses

Segment Selectors are used in a few locations, including:

Retrieved from "https://wiki.osdev.org/index.php?title=Segment_Selector&oldid=29767"