The Pedigree Project 0.1
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
X64GdtManager Class Reference

#include <gdt.h>

+ Collaboration diagram for X64GdtManager:

Classes

struct  segment_descriptor
 
struct  tss_descriptor
 

Public Member Functions

void initialise (size_t processorCount) INITIALISATION_ONLY
 

Static Public Member Functions

static X64GdtManager & instance ()
 
static void initialiseProcessor () INITIALISATION_ONLY
 

Private Member Functions

 X64GdtManager () INITIALISATION_ONLY
 
 X64GdtManager (const X64GdtManager &)
 
X64GdtManager & operator= (const X64GdtManager &)
 
 ~X64GdtManager ()
 
void setSegmentDescriptor (size_t index, uint64_t base, uint32_t limit, uint8_t flags, uint8_t flags2)
 
void setTssDescriptor (size_t index, uint64_t base) INITIALISATION_ONLY
 
void initialiseTss (X64TaskStateSegment *pTss) INITIALISATION_ONLY
 
void initialiseDoubleFaultTss (X64TaskStateSegment *pTss) INITIALISATION_ONLY
 

Static Private Member Functions

static void loadSegmentRegisters ()
 

Private Attributes

struct X64GdtManager::segment_descriptor PACKED
 
segment_descriptor * m_Gdt
 
size_t m_DescriptorCount
 

Static Private Attributes

static X64GdtManager m_Instance
 

Detailed Description

The GDT manager on x64 processors

Definition at line 33 of file gdt.h.

Constructor & Destructor Documentation

◆ X64GdtManager() [1/2]

X64GdtManager::X64GdtManager ( )
private

The constructor

Definition at line 102 of file gdt.cc.

◆ X64GdtManager() [2/2]

X64GdtManager::X64GdtManager ( const X64GdtManager &  )
private

Copy constructor

Note
NOT implemented

◆ ~X64GdtManager()

X64GdtManager::~X64GdtManager ( )
private

The destructor

Definition at line 103 of file gdt.cc.

Member Function Documentation

◆ initialise()

void X64GdtManager::initialise ( size_t  processorCount)

Initialise the GDT

Parameters
[in]processorCountthe number of processors
Note
This should only be called from initialiseProcessor2()

Definition at line 41 of file gdt.cc.

References Dec, Vector< T >::end(), Hex, ProcessorBase::information(), initialiseTss(), m_DescriptorCount, m_Gdt, ProcessorBase::m_ProcessorInformation, setSegmentDescriptor(), and setTssDescriptor().

◆ initialiseDoubleFaultTss()

void X64GdtManager::initialiseDoubleFaultTss ( X64TaskStateSegment *  pTss)
private

Definition at line 137 of file gdt.cc.

◆ initialiseProcessor()

void X64GdtManager::initialiseProcessor ( )
static

Initialises this processors GDTR

Note
This should only be called from initialiseProcessor2()
Todo:
and some smp/acpi function

Definition at line 86 of file gdt.cc.

References ProcessorBase::information(), X64InterruptManager::initialiseProcessorIst(), loadSegmentRegisters(), m_DescriptorCount, m_Gdt, and m_Instance.

◆ initialiseTss()

void X64GdtManager::initialiseTss ( X64TaskStateSegment *  pTss)
private

Readies a TSS for use.

Parameters
[in]pTssthe TSS to ready.
Todo:
this should change

Definition at line 120 of file gdt.cc.

Referenced by initialise().

+ Here is the caller graph for this function:

◆ instance()

static X64GdtManager & X64GdtManager::instance ( )
inlinestatic

Get the gdt manager instance

Returns
instance of the gdt manager

Definition at line 37 of file gdt.h.

References m_Instance.

◆ loadSegmentRegisters()

static void X64GdtManager::loadSegmentRegisters ( )
staticprivate

Load the new segment registers

Note
This function is implemented in asm/gdt.s

Referenced by initialiseProcessor().

+ Here is the caller graph for this function:

◆ operator=()

X64GdtManager & X64GdtManager::operator= ( const X64GdtManager &  )
private

Assignment operator

Note
NOT implemented

◆ setSegmentDescriptor()

void X64GdtManager::setSegmentDescriptor ( size_t  index,
uint64_t  base,
uint32_t  limit,
uint8_t  flags,
uint8_t  flags2 
)
private

Set up a segment descriptor

Parameters
[in]indexthe descriptor index
[in]basethe base address
[in]limitthe size of the segment (either in bytes or in 4kb units)
[in]flagsthe flags
[in]flags2additional flags

Definition at line 105 of file gdt.cc.

References X64GdtManager::segment_descriptor::base0, X64GdtManager::segment_descriptor::base1, X64GdtManager::segment_descriptor::base2, X64GdtManager::segment_descriptor::flags, X64GdtManager::segment_descriptor::flags_limit1, X64GdtManager::segment_descriptor::limit0, and m_Gdt.

Referenced by initialise(), and setTssDescriptor().

+ Here is the caller graph for this function:

◆ setTssDescriptor()

void X64GdtManager::setTssDescriptor ( size_t  index,
uint64_t  base 
)
private

Set up a task-state-segment descriptor

Parameters
[in]indexthe descriptor index
[in]basethe base address

Definition at line 114 of file gdt.cc.

References X64GdtManager::tss_descriptor::base3, m_Gdt, X64GdtManager::tss_descriptor::res, and setSegmentDescriptor().

Referenced by initialise().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_DescriptorCount

size_t X64GdtManager::m_DescriptorCount
private

The number of descriptors in the Gdt

Definition at line 111 of file gdt.h.

Referenced by initialise(), and initialiseProcessor().

◆ m_Gdt

segment_descriptor* X64GdtManager::m_Gdt
private

The Gdt

Definition at line 109 of file gdt.h.

Referenced by initialise(), initialiseProcessor(), setSegmentDescriptor(), and setTssDescriptor().

◆ m_Instance

X64GdtManager X64GdtManager::m_Instance
staticprivate

The instance of the gdt manager

Definition at line 114 of file gdt.h.

Referenced by initialiseProcessor(), and instance().


The documentation for this class was generated from the following files: