Skip to content
Related Articles
Open in App
Not now

Related Articles

Segment Descriptor

Improve Article
Save Article
  • Difficulty Level : Expert
  • Last Updated : 12 Jul, 2022
Improve Article
Save Article

Segment Descriptor: In the Protected mode of x86, Memory Management Unit (MMU) uses the segment selector to access a descriptor, segment descriptors are a part of the segmentation unit, which provides the processor with the data it needs to translate a logical address into a linear address.

A segment descriptor is a special structure that describes the segment. Exactly one segment descriptor must be defined for each segment of the memory. Descriptors are eight types of quantities that contain attributes about a given region of linear address space. These attributes include the 32-bit base linear address of the segment, the 20-bit length, and granularity of the segment, the protection level, read, write or execute privileges, the default size of the operands (16-bit or 32-bit), and the type of segment.

General Format of Segment Descriptor

General Format of Segment Descriptor

General Format of Descriptor:

  • BASE: It contains the 32-bit base address for a segment. Thus define the location of the segment within the 4 gigabyte
    ((232 -1)-bit ) linear address space.
  • LIMIT: It defines the size of the segment. The x86 concatenates the two fragments of the limit field to form a 20-bit value. The x86 interprets this 20-bit value in two ways, depending on the setting of the granularity bit(G).
  • Granularity Bit: It specifies the unit with which the limit field is interpreted. If the G bit is 0, the limit is interpreted in a unit of one byte, else limit is interpreted in a unit of 4 Kb.
  • O(Reserved by Intel): This neither can be defined nor can be used by the user. This bit must be zero for compatibility with future processors.
  • U/AVL (User Bit): This bit is completely undefined, and x86 ignores it. This is an available field/bit for the user or operating system.
  • P (Present Bit): The present P bit is 1 if the segment is loaded in the physical memory, if P = 0 then any attempt to access this segment causes a not-present exception.
  • DPL (Descriptor Privilege Level): It is a 2-bit field the level of privilege associated with the memory space that the descriptor defines – DPL0 is the most privileged whereas DPL3 is the least privileged.
  • S (System Bit): The segment S bit in the segment descriptor determines if a given segment is a system segment or a code or a data segment. If the S bit is 1 then the segment is either a code or data segment, if it is 0 then the segment is a system segment.
  • Type: The specifies the specific descriptor among various kinds of descriptors. 
  • A (Accessed Bit): The x86 automatically sets this bit when a selector for the descriptor is loaded into a segment register. This means that x86 sets accessed bit whenever a memory reference is made by accessing the segment.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!