StuBS
Loading...
Searching...
No Matches
GDT::Pointer Struct Reference

Structure that describes a GDT Pointer (aka GDT Descriptor) More...

#include <gdt.h>

Public Member Functions

template<typename T , size_t LEN>
constexpr Pointer (const T(&desc)[LEN])
 Constructor (automatic length)
 
constexpr Pointer (void *desc, size_t len)
 Constructor.
 
void set (void *desc, size_t len)
 Set an address.
 

Public Attributes

uint16_t limit
 GDT size in bytes (minus 1 byte)
 
void * base
 GDT base address.
 

Detailed Description

Structure that describes a GDT Pointer (aka GDT Descriptor)

It contains both the length (in bytes) of the GDT (minus 1 byte) and the pointer to the GDT. The pointer to the GDT can be loaded using the instruction lgdt.

Note
As Intel uses little endian for representing multi-byte values, the GDT::Pointer structure can be used for 16, 32, and 64 bit descriptor tables:
*         | 16 bit | 16 bit  | 16 bit  | 16 bit  | 16 bit  |
*         +--------+---------------------------------------+
* Pointer | limit  | base (up to 64 bit)                   |
*         +--------+---------+---------+---------+---------+
*         | used for 16 bit  | ignored...                  |
*         |      used for 32 bit       | ignored...        |
*         |                used for 64 bit                 |
*        
See also
ISDMv3, Figure 2-6; Memory Management Registers

Constructor & Destructor Documentation

◆ Pointer() [1/2]

template<typename T , size_t LEN>
constexpr GDT::Pointer::Pointer ( const T(&) desc[LEN])
inlineexplicitconstexpr

Constructor (automatic length)

Parameters
descArray of GDT segment descriptors – must be defined in the same module!

◆ Pointer() [2/2]

constexpr GDT::Pointer::Pointer ( void * desc,
size_t len )
inlineconstexpr

Constructor.

Parameters
descAddress of the GDT segment descriptors
lenNumber of entries

Member Function Documentation

◆ set()

void GDT::Pointer::set ( void * desc,
size_t len )
inline

Set an address.

Note
On change, lgdt must be executed again
Parameters
descAddress of the GDT segment descriptors
lenNumber of entries

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