Descriptor: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
No edit summary
 
(13 intermediate revisions by 8 users not shown)
Line 1: Line 1:
Descritors are describing System Segments, Memory Segments and Gates.
Descriptors are describing System Segments, Memory Segments and Gates.


== System Segments ==
== System Segment Descriptor ==
{| {{wikitable}}
{| {{wikitable}}
! Name
! Name
Line 12: Line 12:
|-
|-
! BAddr
! BAddr
| 16..39 || Base Address 0..23|| Physical address where the memory range begins.
| 16..39 || Base Address 0..23|| Linear address where the memory range begins.
|-
|-
! Typ
! Typ
Line 34: Line 34:
|-
|-
! DPL
! DPL
| 45,46 || Descriptor Privilege Level || Specifies which [[Privileg Level]] a process minimum must have to use this Descriptor.
| 45,46 || Descriptor Privilege Level || Specifies which privilege level a process minimum must have to use this Descriptor.
|-
|-
! P
! P
| 47 || Present|| Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
| 47 || Present|| defines if this Descriptor is "present" in memory. s. [[Paging]].
|-
|-
! Limit
! Limit
Line 69: Line 69:
|-
|-
! BAddr
! BAddr
| 16..39 || Base Address 0..23|| Physical address where the memory range begins.
| 16..39 || Base Address 0..23|| Linear address where the memory range begins.
|-
|-
! A
! A
Line 87: Line 87:
|-
|-
! DPL
! DPL
| 45,46 || Descriptor Privilege Level || Specifies which [[Privileg Level]] a process minimum must have to use this Descriptor.
| 45,46 || Descriptor Privilege Level || Specifies which privilege level a process minimum must have to use this Descriptor.
|-
|-
! P
! P
| 47 || Present|| Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
| 47 || Present|| defines if this Descriptor is "present" in memory. s. [[Paging]].
|-
|-
! Limit
! Limit
Line 111: Line 111:
|}
|}


== Gate Descriptor ==
== Interrupt Gate Descriptor ==
{| {{wikitable}}
{| {{wikitable}}
! Name
! Name
Line 124: Line 124:
| 16..31 || Selector || [[Selector]] that specifies the segment of the function to call.
| 16..31 || Selector || [[Selector]] that specifies the segment of the function to call.
|-
|-
! Reserved
! DWC
| 32..35 || Double Word Counter || .
| 32..35 || ||
|-
|-
! 0
! 0
| 36..39 || - || Have to be 0.
| 36..39 || - || Have to be 0.
|-
|-
! Typ
! Type
| 40..43 || Gate Type || Possible gate types :
| 40..43 || Gate Type || Possible interrupt gate types :
{| {{wikitable}}
{| {{wikitable}}
| 0b0101=0x5 || [[#I386 Task Gate|Task gate]]
| 0b0101=0x5 || [[#I386 Task Gate|Task gate]]
Line 145: Line 145:
|-
|-
! S
! S
| 44 || Storage Segment || <b>= 0</b> for interrupt gates.
| 44 || Storage Segment || <b>= 0</b> for gates.
|-
|-
! DPL
! DPL
| 45,46 || Descriptor Privilege Level || Gate call protection. Specifies which [[Privileg Level]] the calling process minimum should have.
| 45,46 || Descriptor Privilege Level || Gate call protection. Specifies which privilege level the calling process minimum should have.
|-
|-
! P
! P
| 47 || Present || can be set to <b>0</b> for [[Paging]].
| 47 || Present || Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
|-
|-
! Offset
! Offset
| 48..63 || Offset 16..31 || Higher part of the offset.
| 48..63 || Offset 16..31 || Higher part of the offset.
|}
|}

== Call Gate Descriptor ==
{| {{wikitable}}
! Name
! Bit
! Full Name
! Description
|-
! Offset
| 0..15 || Offset 0..15 || Lower part of the offset address (also known as pointer).
|-
! Selector
| 16..31 || Selector || [[Selector]] that specifies the code segment of the function to call.
|-
! ParamCnt
| 32..35 || uint32_t's to copy || Number of uint32_t stack arguments to copy on stack switch.
|-
! 0
| 36..39 || - || Have to be 0.
|-
! Type
| 40..43 || Gate Type || Possible call gate types :
{| {{wikitable}}
| 0b0100=0x4 || 16-bit [[#I386 Call Gate|Call gate]]
|-
| 0b1100=0xc || 32-bit [[#I386 Call Gate|Call gate]]
|}
|-
! S
| 44 || Storage Segment || <b>= 0</b> for gates.
|-
! DPL
| 45,46 || Descriptor Privilege Level || Gate call protection. Specifies which privilege level the calling process minimum should have.
|-
! P
| 47 || Present || Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
|-
! Offset
| 48..63 || Offset 16..31 || Higher part of the offset.
|}



[[Category:X86]]
[[Category:Memory Segmentation]]

Latest revision as of 17:32, 10 July 2023

Descriptors are describing System Segments, Memory Segments and Gates.

System Segment Descriptor

Name Bit Full Name Description
Limit 0..15 Limit 0..15 Memory range.
BAddr 16..39 Base Address 0..23 Linear address where the memory range begins.
Typ 40..43 Descriptor Type Possible types :
0000b=0x0 unused (invalid Descriptor)
0001b=0x1 80286-TSS, 16 bit
0010b=0x2 LDT
0011b=0x3 activ 80286-TSS, 16 bit
1001=0x9 80386-TSS, 32 bit
1011=0xB activ 80386-TSS, 32 bit
S 44 Storage Segment = 0 for System Segments.
DPL 45,46 Descriptor Privilege Level Specifies which privilege level a process minimum must have to use this Descriptor.
P 47 Present Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
Limit 48..51 Limit 16..19 high part of the Limit.
AVL 52 .
0 53 .
- 54 .
G 55 .
BAddr 56..63 Base Address 24..31 Higher part of the Base Address.

Memory Segment Descriptor

Name Bit Full Name Description
Limit 0..15 Limit 0..15 Memory range.
BAddr 16..39 Base Address 0..23 Linear address where the memory range begins.
A 40
WR 41
CE 42
EX 43
S 44 Storage Segment = 1 for Memory Segments.
DPL 45,46 Descriptor Privilege Level Specifies which privilege level a process minimum must have to use this Descriptor.
P 47 Present Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
Limit 48..51 Limit 16..19 high part of the Limit.
AVL 52 .
0 53 .
B 54 .
G 55 .
BAddr 56..63 Base Address 24..31 Higher part of the Base Address.

Interrupt Gate Descriptor

Name Bit Full Name Description
Offset 0..15 Offset 0..15 Lower part of the offset address (also known as pointer).
Selector 16..31 Selector Selector that specifies the segment of the function to call.
Reserved 32..35
0 36..39 - Have to be 0.
Type 40..43 Gate Type Possible interrupt gate types :
0b0101=0x5 Task gate
0b0110=0x6 16-bit interrupt gate
0b0111=0x7 16-bit trap gate
0b1110=0xE 32-bit interrupt gate
0b1111=0xF 32-bit trap gate
S 44 Storage Segment = 0 for gates.
DPL 45,46 Descriptor Privilege Level Gate call protection. Specifies which privilege level the calling process minimum should have.
P 47 Present Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
Offset 48..63 Offset 16..31 Higher part of the offset.

Call Gate Descriptor

Name Bit Full Name Description
Offset 0..15 Offset 0..15 Lower part of the offset address (also known as pointer).
Selector 16..31 Selector Selector that specifies the code segment of the function to call.
ParamCnt 32..35 uint32_t's to copy Number of uint32_t stack arguments to copy on stack switch.
0 36..39 - Have to be 0.
Type 40..43 Gate Type Possible call gate types :
0b0100=0x4 16-bit Call gate
0b1100=0xc 32-bit Call gate
S 44 Storage Segment = 0 for gates.
DPL 45,46 Descriptor Privilege Level Gate call protection. Specifies which privilege level the calling process minimum should have.
P 47 Present Set this to 1 to be able to access the segment, otherwise a #NP (Segment not Present) exception is generated on access.
Offset 48..63 Offset 16..31 Higher part of the offset.