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

#include <gdt.h>

+ Collaboration diagram for X86GdtManager:

Classes

struct  segment_descriptor
 

Public Member Functions

void initialise (size_t processorCount) INITIALISATION_ONLY
 
void setTlsBase (uintptr_t base)
 

Static Public Member Functions

static X86GdtManagerinstance ()
 
static void initialiseProcessor () INITIALISATION_ONLY
 

Private Member Functions

 X86GdtManager () INITIALISATION_ONLY
 
 X86GdtManager (const X86GdtManager &)
 
X86GdtManageroperator= (const X86GdtManager &)
 
 ~X86GdtManager ()
 
void setSegmentDescriptor (size_t index, uint32_t base, uint32_t limit, uint8_t flags, uint8_t flags2)
 
void setTssDescriptor (size_t index, uint32_t base) INITIALISATION_ONLY
 
void initialiseTss (struct X86TaskStateSegment *pTss) INITIALISATION_ONLY
 
void initialiseDoubleFaultTss (X86TaskStateSegment *pTss) INITIALISATION_ONLY
 

Private Attributes

struct X86GdtManager::segment_descriptor PACKED
 
segment_descriptorm_Gdt
 
size_t m_DescriptorCount
 

Static Private Attributes

static X86GdtManager m_Instance
 

Detailed Description

The GDT manager on x86 processors

Definition at line 30 of file x86/gdt.h.

Constructor & Destructor Documentation

X86GdtManager::X86GdtManager ( )
private

The constructor

Definition at line 112 of file x86/gdt.cc.

Referenced by instance().

+ Here is the caller graph for this function:

X86GdtManager::X86GdtManager ( const X86GdtManager )
private

Copy constructor

Note
NOT implemented
X86GdtManager::~X86GdtManager ( )
private

The destructor

Definition at line 115 of file x86/gdt.cc.

Referenced by instance().

+ Here is the caller graph for this function:

Member Function Documentation

void X86GdtManager::initialise ( size_t  processorCount)

Initialise the GDT

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

Definition at line 30 of file x86/gdt.cc.

References Dec, Hex, Processor::information(), initialiseDoubleFaultTss(), initialiseTss(), m_DescriptorCount, m_Gdt, Processor::m_ProcessorInformation, NOTICE, setSegmentDescriptor(), and setTssDescriptor().

Referenced by instance().

+ Here is the caller graph for this function:

void X86GdtManager::initialiseDoubleFaultTss ( X86TaskStateSegment pTss)
private
Note
This doesn't seem to work??? I've used the current CR3 for now, but it's probably best to create a new PD for the DF handler.

Definition at line 158 of file x86/gdt.cc.

References VirtualAddressSpace::clone(), VirtualAddressSpace::getKernelAddressSpace(), NOTICE, and Processor::switchAddressSpace().

Referenced by initialise(), and instance().

+ Here is the caller graph for this function:

void X86GdtManager::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 x86/gdt.cc.

References Processor::information(), m_DescriptorCount, m_Gdt, and m_Instance.

Referenced by instance().

+ Here is the caller graph for this function:

void X86GdtManager::initialiseTss ( struct X86TaskStateSegment pTss)
private

Write default values into a task-state-segment descriptor.

Parameters
[in]pTssThe TSS descriptor.

Definition at line 145 of file x86/gdt.cc.

Referenced by initialise(), and instance().

+ Here is the caller graph for this function:

static X86GdtManager& X86GdtManager::instance ( )
inlinestatic
X86GdtManager& X86GdtManager::operator= ( const X86GdtManager )
private

Assignment operator

Note
NOT implemented

Referenced by instance().

+ Here is the caller graph for this function:

void X86GdtManager::setSegmentDescriptor ( size_t  index,
uint32_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 131 of file x86/gdt.cc.

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

Referenced by initialise(), instance(), setTlsBase(), and setTssDescriptor().

+ Here is the caller graph for this function:

void X86GdtManager::setTlsBase ( uintptr_t  base)

Sets up the TLS base for the current CPU to point to the given base.

Definition at line 119 of file x86/gdt.cc.

References Processor::information(), and setSegmentDescriptor().

Referenced by instance().

+ Here is the caller graph for this function:

void X86GdtManager::setTssDescriptor ( size_t  index,
uint32_t  base 
)
private

Set up a task-state-segment descriptor

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

Definition at line 141 of file x86/gdt.cc.

References setSegmentDescriptor().

Referenced by initialise(), and instance().

+ Here is the caller graph for this function:

Member Data Documentation

size_t X86GdtManager::m_DescriptorCount
private

The number of descriptors in the Gdt

Definition at line 104 of file x86/gdt.h.

Referenced by initialise(), and initialiseProcessor().

segment_descriptor* X86GdtManager::m_Gdt
private

The Gdt

Definition at line 102 of file x86/gdt.h.

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

X86GdtManager X86GdtManager::m_Instance
staticprivate

The instance of the gdt manager

Definition at line 107 of file x86/gdt.h.

Referenced by initialiseProcessor(), and instance().


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