In memory addressing for
Intel
Intel Corporation is an American multinational corporation and technology company headquartered in Santa Clara, California. It is the world's largest semiconductor chip manufacturer by revenue, and is one of the developers of the x86 seri ...
x86
x86 (also known as 80x86 or the 8086 family) is a family of complex instruction set computer (CISC) instruction set architectures initially developed by Intel based on the Intel 8086 microprocessor and its 8088 variant. The 8086 was introd ...
computer architectures, segment descriptors are a part of the segmentation unit, used for translating a
logical address
In computing, a logical address is the address at which an item ( memory cell, storage element, network host) appears to reside from the perspective of an executing application program.
A logical address may be different from the physical addr ...
to a linear address. Segment descriptors describe the
memory segment
Memory segmentation is an operating system memory management technique of division of a computer's primary memory into segments or sections. In a computer system using segmentation, a reference to a memory location includes a value that identifie ...
referred to in the logical address.
The segment descriptor (8 bytes long in 80286 and later) contains the following fields:
# A segment base address
# The segment limit which specifies the segment size
# Access rights byte containing the protection mechanism information
# Control bits
Structure
The x86 and x86-64 segment descriptor has the following form:
:
Where the fields stand for:
; Base Address : Starting memory address of the segment. Its length is 32 Bit and it is created of the lower Part Bit 16 to 31, and the upper Part Bit 0 to 7, followed by Bit 24 to 31.
; Segment Limit : Its length is 20 bit and is created of the lower Part Bit 0 to 15 and the upper Part Bit 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 2
20 bytes. If set, the limit is in units of 4096-byte pages, for a maximum of 2
32 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
; 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.
See also
*
Burroughs large systems descriptors
Descriptors are an architectural feature of Burroughs large systems, including the current (as of 2006) Unisys Clearpath/MCP systems. Apart from being stack- and tag-based, a notable architectural feature of these systems is that it is descriptor- ...
*
Memory segment
Memory segmentation is an operating system memory management technique of division of a computer's primary memory into segments or sections. In a computer system using segmentation, a reference to a memory location includes a value that identifie ...
*
Memory address
In computing, a memory address is a reference to a specific memory location used at various levels by software and hardware. Memory addresses are fixed-length sequences of digits conventionally displayed and manipulated as unsigned integers. Su ...
References
*
*
Further reading
*
External links
Intel 80386 Reference Programmer's Manual - Segment Translation
X86 architecture
Operating system kernels
Memory management
{{compu-hardware-stub