Segment descriptor
In memory addressing for computer architectures, segment descriptors are a part of the segmentation unit, used for translating a logical address to a linear address. Segment descriptors describe the memory segment referred to in the logical address.[1]
Structure
[edit]The segment descriptor contains the following fields:[2]
- A segment base address[a] or page table address
- The segment limit which specifies the segment size
- Access rights information containing the protection mechanism information
- Control bits
Intel
[edit]The segment descriptor is 8 bytes long in 80286 and later.
The 80286 segment descriptor
[edit]The 80286 segment descriptor has the following form:[3]
| bit Off | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | Off | 
| +7 | Must be zero | +6 | |||||||||||||||
| +5 | P | DPL | S = 1 | Type | A | Base23-16 | +4 | ||||||||||
| +3 | Base15-0 | +2 | |||||||||||||||
| +1 | Limit15-0 | 0 | |||||||||||||||
The x86 and x86-64 segment descriptor
[edit]The x86 and x86-64 segment descriptor has the following form:[4]
What the fields stand for:
- Base Address
- Starting memory address of the segment. Its length is 32 bits and it is created from the lower part bits 16 to 31, and the upper part bits 0 to 7, followed by bits 24 to 31.
- Segment Limit
- Its length is 20 bits and is created from the lower part bits 0 to 15 and the upper part bits 16 to 19. It defines the address of the last accessible data. The length is one more than the value stored here. How exactly this should be interpreted depends on the Granularity bit of the segment descriptor.
- G=Granularity
- If clear, the limit is in units of bytes, with a maximum of 220 bytes. If set, the limit is in units of 4096-byte pages, for a maximum of 232 bytes.
- D/B
- D = Default operand size : If clear, this is a 16-bit code segment; if set, this is a 32-bit segment.
- B = Big: If set, the maximum offset size for a data segment is increased to 32-bit 0xffffffff. Otherwise it's the 16-bit max 0x0000ffff. Essentially the same meaning as "D".
- L=Long
- If set, this is a 64-bit segment (and D must be zero), and code in this segment uses the 64-bit instruction encoding. "L" cannot be set at the same time as "D" aka "B". (Bit 21 in the image)
- AVL=Available
- For software use, not used by hardware (Bit 20 in the image with the label A)
- P=Present
- If clear, a "segment not present" exception is generated on any reference to this segment
- DPL=Descriptor privilege level
- Privilege level (ring) required to access this descriptor
- S=System Segment
- If clear, this is system segment, used to handle interrupts or store LDT segment descriptors. If 1, this is Code/Data segment.
- Type
- If set, this is a code segment descriptor. If clear, this is a data/stack segment descriptor, which has "D" replaced by "B", "C" replaced by "E"and "R" replaced by "W". This is in fact a special case of the 2-bit type field, where the preceding bit 12 cleared as "0" refers to more internal system descriptors, for LDT, LSS, and gates.
- C=Conforming
- Code in this segment may be called from less-privileged levels.
- E=Expand-Down
- If clear, the segment expands from base address up to base+limit. If set, it expands from maximum offset down to limit, a behavior usually used for stacks.
- R=Readable
- If clear, the segment may be executed but not read from.
- W=Writable
- If clear, the data segment may be read but not written to.
- A=Accessed
- This bit is set to 1 by hardware when the segment is accessed, and cleared by software.
IBM S/370 and successors
[edit]| ![[icon]](https://upload.wikimedia.org/wikipedia/commons/thumb/1/1c/Wiki_letter_w_cropped.svg/20px-Wiki_letter_w_cropped.svg.png) | This section needs expansion. You can help by adding to it.  (September 2025) | 
The S/370, S/370-XA, ESA/370 and ESA/390 segment table entries (STEs) are one word long. All processors running in S/370 mode used the same format, but not all supported the common-segment facility and
With z/Architecture the STE is a doubleword.
The S/370 segment-table entry
[edit]The segment-table entry for the S/370 has the following form[5]
| 0 | 3 | 4 | 7 | 8 | 28 | 29 | 30 | 31 | |||||||||||||||||||||||
| TBL | 0000 | Page-Table Origin | P | C | I | ||||||||||||||||||||||||||
- Page-Table Origin
- Left 21 bits of Page Table Origin (PTO), has 3 zero bits appended
- TBL
- Table length in units that are 1⁄16 of the maximum[b] allowed size, offset by one unit.
- P
- Segment-Protection Bit
- C
- Common-Segment Bit
- I
- Segment-Invalid Bit
The S/370-XA through S/390 segment-table entry
[edit]The segment-table entry for the S/370-XA, ESA/370 and ESA/390 has the following form[6]
| 0 | 1 | 25 | 26 | 27 | 28 | 31 | |||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | Page-Table Origin | I | C | TBL | |||||||||||||||||||||||||||
- Page-Table Origin
- Left 25 bits of PTO, has 6 zero bits appended
- I
- Invalid
- C
- Common-Segment Bit
- TBL
- Table length in 64-byte units, offset by one unit
The z/Architecture segment-table entry
[edit]In the original z/Architecture, a segment is always subject to paging and the Segment-Table Entry always points to a page table. However, on a model equipped with the Enhanced-DAT Facility 1, the Enhanced-DAT-enablement control (bit 40) o
The segment-table entry for the z/Architecture has the following forms[7]
| 0 | 31 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Page-Table Origin | |||||||||||||||||||||||||||||||
| 32 | 53 | 54 | 55 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | |||||||||||||||||||||
| Page-Table Origin (continued) | F C | P | I | C S | TT | ||||||||||||||||||||||||||
- Page-Table Origin
- Left 53 bits of PTO, has 11 zero bits appended
- FC=0
- Format Control - paged segment
- P
- DAT-protection (fetch protect)
- I
- Segment-Invalid Bit
- CS
- Common-Segment Bit
- TT=00
- Table Type Segment
| 0 | 31 | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Segment-Frame Absolute Address | |||||||||||||||||||||||||||||||
| 32 | 43 | 44 | 46 | 47 | 48 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | |||||||||||||
| Segment-Frame Absolute Address (continued) | A V | ACC | F | F C | P | I E P | I | C S | TT | ||||||||||||||||||||||
- ACCF-Validity Control (AV)
- Use ACC to check key
- ACC
- Access control key
- F
- Fetch protection when AV=1
- FC=1
- Format Control - points to absolute address
- P
- DAT-protection (fetch protect)
- Instruction-Execution-Protection (IEP) Control
- Instruction execution prohibited
- I
- Segment-Invalid Bit
- CS
- Common-Segment Bit
- TT=00
- Table Type Segment
See also
[edit]Notes
[edit]References
[edit]- ^ Bovet, D.P., & Cesati, M. (2000). Understanding the Linux Kernel (First Edition). O'Reilly & Associates, Inc.
- ^ Tabak, Daniel (1995). Advanced Microprocessors. Mcgraw Hill Publishers. p. 149. ISBN 9780070628434.
- ^ "Figure 6-3. Code or Data Segment Descriptor (S=1)" (PDF). 80286 AND 80287 PROGRAMMER'S REFERENCE MANUAL (PDF). 1987. p. 6-5. 210498-005. Retrieved September 15, 2025.
- ^ AMD64 Architecture Programmer's Manual Volume 2: System Programming (PDF) (Technical report). 2013. p. 80. Archived from the original (PDF) on 2018-02-18.
- ^ "Segment-Table Entries" (PDF). IBM System/370 - Principles of Operation (PDF) (Eleventh ed.). IBM. September 1987. p. 3-25. GA22-7000-10. Retrieved September 25, 2025.
- ^ "Segment-Table Entries" (PDF). IBM Enterprise Systems Architecture/390 Principles of Operation (PDF) (Ninth ed.). IBM. June 2003. p. 3-30. SA22-7201-08. Retrieved September 19, 2025.
- ^ z/Architecture Principles of Operation (PDF) (Fifteenth ed.). IBM. April 2025. SA22-7832-14. Retrieved July 3, 2025.
- Tabak, Daniel (1991). Advanced Microprocessors. McGraw Hill and Co. ISBN 9780070628076.
- Hall, Douglas. Microprocessors and Interfacing. McGraw Hill Publications.
Further reading
[edit]- Robert R. Collins (August 1998). "The Segment Descriptor Cache". Dr Dobb's Journal.
 
	
