Implement initGdtDesc in Gdt class

This commit is contained in:
manzerbredes 2015-07-20 19:12:26 +04:00
parent 55a449dc65
commit 54463cc252
2 changed files with 11 additions and 6 deletions

View file

@ -16,8 +16,14 @@ Gdt::~Gdt(){
} }
void Gdt::initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *Descriptor){ void Gdt::initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStruct *Descriptor){
//Load parameter into "Descriptor" Descriptor->limit1 = limit & 0xFFFF;
Descriptor->base1 = base & 0xFFFF;
Descriptor->base2 = (base & 0xFF0000) >> 16;
Descriptor->access = access;
Descriptor->limit2 = (limit & 0xF0000 ) >> 16;
Descriptor->flags = flags & 0xFF;
Descriptor->base3 = (base & 0xFF000000) >> 24;
} }
void Gdt::loadGdt(){ void Gdt::loadGdt(){

View file

@ -14,10 +14,9 @@ struct gdtDescriptorStruct{
u16 limit1; u16 limit1;
u16 base1; u16 base1;
u8 base2; u8 base2;
u8 type : 4; u8 access : 4;
u8 param1 : 4;
u8 limit2 : 4; u8 limit2 : 4;
u8 param2 : 4; u8 flags : 4;
u8 base3; u8 base3;
} __attribute__ ((packed)); } __attribute__ ((packed));
@ -36,7 +35,7 @@ class Gdt{
gdtPointerStruct m_Pointer; gdtPointerStruct m_Pointer;
//Methods //Methods
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *Descriptor); void initGdtDesc(u32 base, u32 limit, u8 access, u8 flags, gdtDescriptorStruct *Descriptor);
public: public: