diff options
Diffstat (limited to 'kernel/GDT/gdt.cpp')
| -rw-r--r-- | kernel/GDT/gdt.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kernel/GDT/gdt.cpp b/kernel/GDT/gdt.cpp index 3b84e71..8c6d9d9 100644 --- a/kernel/GDT/gdt.cpp +++ b/kernel/GDT/gdt.cpp @@ -2,7 +2,7 @@ #include "../Helpers/types.hpp" #include "../Helpers/memory.hpp" - +//Constructor Gdt::Gdt(){ //Init conventional segment @@ -25,10 +25,12 @@ Gdt::Gdt(){ } +//Destructor Gdt::~Gdt(){ } +//Adapt parameter to the gdt descriptor structure void Gdt::initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStruct *Descriptor){ Descriptor->limit1 = limit & 0xFFFF; Descriptor->base1 = base & 0xFFFF; @@ -39,11 +41,14 @@ void Gdt::initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStr Descriptor->base3 = (base & 0xFF000000) >> 24; } +//Copy the gdt into mémory and load it void Gdt::loadGdt(){ - int *gdtAdress=(int *)&m_Pointer; //Copy Gdt into memory and init registers memcpy((u32)m_Descriptors, (u32)m_Pointer.segment, (u32)m_Pointer.size); + //Put m_Pointer in a var to pass it to assembly code + int *gdtAdress=(int *)&m_Pointer; + __asm__("lgdtl (%0);" : :"r"(gdtAdress) |
