StuBS
GDT::SegmentDescriptor Union Reference

Describes the structure of segment descriptors. More...

#include <gdt.h>

Collaboration diagram for GDT::SegmentDescriptor:

Public Member Functions

constexpr SegmentDescriptor (uint64_t val=0)
 !< Merged value; useful for debugging
 
constexpr SegmentDescriptor (uintptr_t base, uint32_t limit, bool code, int ring, Size size)
 Constructor for a code/data GDT entry.
 

Public Attributes

struct { 
 
   uint64_t   : 40 
 Ignored (set via limit_low and base_low )
 
   bool   code_accessed: 1 
 If set, the code segment was used since the last reset of this value.
 
   bool   readable: 1 
 If set, the code is readable (otherwise only executable)
 
   bool   conforming: 1 
 If set, the execution of code from this segment is only allowed when running at a privilege of numerically less than or equal to privilege_level (i.e. the executor has the same or higher privileges). However, the executor's privileges remain unchanged. For nonconforming code segments (i.e., conforming is set to 0), execution is allowed only if the privileges are equal. Execution will cause a GPF in case of privilege violation.
 
   bool   code: 1 
 Has to be set to true
 
   uint64_t   : 9 
 Ignored (set via privilege_level ... available)
 
   Size   operation_size: 2 
 Default address width (custom field bit)
 
   uint64_t   : 0 
 Remainder ignored (set via base_high)
 
};  
 Fields specific for Code Segment (for debugging purposes)
 
struct { 
 
   uint64_t   : 40 
 Ignored (set via limit_low and base_low)
 
   bool   data_accessed: 1 
 If set, the data segment was used since the last reset of this value.
 
   bool   writeable: 1 
 If set, data is writable (otherwise read only)
 
   bool   expand_down: 1 
 Growing direction for dynamically growing segments.
 
   bool   notData: 1 
 Has to be cleared (false)
 
   uint64_t   : 9 
 Ignored (set via privilege_level ... available)
 
   uint64_t   reserved: 1 
 Reserved, always set to 0!
 
   bool   big: 1 
 Size of the stack pointer (false = 16 bit, true = 32 bit) More...
 
   uint64_t   : 0 
 Remainder ignored.
 
};  
 Fields specific for Data Segment (for debugging purposes)
 
struct { 
 
   uint64_t   : 40 
 Ignored (set voa limit_low and base_low)
 
   enum Gate   gate: 3 
 TSS or LDT entry.
 
   bool   not16bit: 1 
 false for 16-bit, true for 32-bit/64-bit
 
   uint64_t   : 0 
 Remainder ignored.
 
};  
 Fields specific to the Task State Segment.
 

Detailed Description

Describes the structure of segment descriptors.

A data structure that contains size, position, access rights, and purpose of any segment. Segment descriptors are used in both the GDT, as well as in LDTs.

See also
ISDMv3, 3.4.5; Segment Descriptors
AAPMv2, 4.7 Legacy Segment Descriptors

Constructor & Destructor Documentation

◆ SegmentDescriptor() [1/2]

constexpr GDT::SegmentDescriptor::SegmentDescriptor ( uint64_t  val = 0)
inlineconstexpr

!< Merged value; useful for debugging

Constructor for a specific value

◆ SegmentDescriptor() [2/2]

constexpr GDT::SegmentDescriptor::SegmentDescriptor ( uintptr_t  base,
uint32_t  limit,
bool  code,
int  ring,
Size  size 
)
inlineconstexpr

Constructor for a code/data GDT entry.

Parameters
baseBase Address of segment
limitSize of segment
codeCode or data segment
ringPrivilege level
sizeAddress width

Member Data Documentation

◆ [struct]

struct { ... } GDT::SegmentDescriptor

Fields specific for Code Segment (for debugging purposes)

See also
ISDMv3, 3.4.5.1; Code- and Data-Segment Descriptor Types

◆ [struct]

struct { ... } GDT::SegmentDescriptor

Fields specific for Data Segment (for debugging purposes)

See also
ISDMv3, 3.4.5.1; Code- and Data-Segment Descriptor Types

◆ [struct]

struct { ... } GDT::SegmentDescriptor

Fields specific to the Task State Segment.

See also
ISDMv3, 7.2.2; TSS Descriptor

◆ __pad0__

uint64_t GDT::SegmentDescriptor::__pad0__

Ignored (set via limit_low and base_low )

Ignored (set voa limit_low and base_low)

Ignored (set via limit_low and base_low)

◆ __pad1__

uint64_t GDT::SegmentDescriptor::__pad1__

Ignored (set via privilege_level ... available)

Remainder ignored.

◆ __pad2__

uint64_t GDT::SegmentDescriptor::__pad2__

Remainder ignored (set via base_high)

Remainder ignored.

◆ big

bool GDT::SegmentDescriptor::big

Size of the stack pointer (false = 16 bit, true = 32 bit)

Warning
Has a different meaning in case expand_down is set to 1.

The documentation for this union was generated from the following file: