Descriptor (processor)

from Wikipedia, the free encyclopedia

As a descriptor refers to Intel - x86 - processors from 80286 (introduced in 1982) a structure that a segment or a function in the main memory describes.

A descriptor has a size of 8 bytes and contains the size, position, access rights and use of a segment. In addition to the memory segments just described, there are also system segments that mark an operating system function, for example.

Descriptors only occur in protected mode , in real mode the segments have a constant size of 64 KiB , so they are not required.

All descriptors are divided into three tables.

  • The GDT ( Global Descriptor Table ) can hold a maximum of 8192 descriptors and is available for all processes .
  • The LDT (Local Descriptor Table) is a table that is only available for one process. When a task is changed, its content is also often changed.
  • The third table is the IDT (Interrupt Descriptor Table). It comprises 256 descriptors, for which each descriptor marks the start address of the respective interrupt .

Segment descriptors in 16- / 32-bit protected mode

SegmentDescriptor.svg
abbreviation designation meaning
Base address Base address of the segment. The field is divided into two for historical reasons.
G Granularity Specifies whether the segment limit is specified in bytes (G = 0) or in 4 KB pages (G = 1)
D / B Default operand size For code segments:
D = 1: operands have 32 bits by default; D = 0: Operands have 16 bits by default.
(The default values ​​can be changed to the other value for the subsequent machine command using an "Operand Size Prefix")
AVL available is freely available to the operating system
Segment limit Size of the segment in bytes or in 4 KiB pages
P present P = 1: segment is available in memory; P = 0: segment does not currently exist (e.g. currently swapped out). Access to segments that are not present trigger an exception (which can be caught by the operating system and used to reload the missing segment)
DPL Descriptor Privilege Level ...
S. System / user S and Type together indicate the type of segment that is described by this descriptor (see below)
Type

Descriptor types

System descriptors

S. Type Type of descriptor
0 (system) 0000 reserved
0001 Available 16-bit Task Status Segment (TSS)
0010 Local descriptor table
0011 Used 16-bit Task Status Segment (TSS)
0100 16-bit call gate
0101 Task Gate
0110 16-bit interrupt gate
0111 16-bit trap gate
1000 reserved
1001 available 32-bit TSS
1010 reserved
1011 used 32-bit TSS
1100 32-bit call gate
1101 reserved
1110 32-bit interrupt gate
1111 32-bit trap gate

A "call gate" segment descriptor describes a well-defined entry point e.g. B. for operating system functions. In protected mode, call gates are the only way for codes with a lower privilege level to call up codes with a higher privilege level.

In a task status segment, the contents of all local registers and other status information are automatically saved in the event of a task change (with hardware multitasking).

User descriptors

If the S-bit is set, the top bit of the Type field indicates whether it is a code or data segment. The meaning of the other 3 bits is different for code and data segments.

S. Type Type of descriptor
1 (user) 0 EWA Data segment
E - Expand Down
W - Writable
A - Accessed
1 CRA Code segment
C - Conforming
R - Readable
A - Accessed

Meaning of the bits:

E.
Expand down - The segment base address marks the upper end of the segment, the limit the distance from the lower limit to the given base address. This is useful for stack segments, since on the x86 platform the processor stack is filled from top to bottom.
W.
Writable - this segment can also be written to.
A.
Accessed - Automatically set to 1 by the processor when the segment has been accessed. It can be reset to 0 by the operating system.
R.
Readable - code segment can also be read out (as data). Writing in code segments is generally not possible.

Source / web link