Edit GDT class

This commit is contained in:
manzerbredes 2015-07-20 16:58:34 +04:00
parent 9b856ae4d7
commit 3b171151bd
3 changed files with 60 additions and 9 deletions

View file

@ -2,10 +2,26 @@
#include "../Types/types.hpp"
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *descriptor){
Gdt::Gdt(){
//Init desc 1 (0 conventional)
//Init desc 2 (code segment)
//Init desc 3 (data segment)
//Init desc 4 (stack segment)
}
void initGdt(){
Gdt::~Gdt(){
}
void Gdt::initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *Descriptor){
//Load parameter into "Descriptor"
}
void Gdt::loadGdt(){
//Copy Gdt into memory
}

View file

@ -21,13 +21,36 @@ struct gdtDescriptorStruct{
u8 base3;
} __attribute__ ((packed));
//Typedef :
typedef struct gdtPointerStruct gdtPointerStruct;
typedef struct gdtDescriptorStruct gdtDescriptorStruct;
//Functions :
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *descriptor);
void initGdt();
//Gdt class
class Gdt{
private:
//Data members
gdtDescriptorStruct m_Descriptor[4];
gdtPointerStruct m_Pointer;
//Methods
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *Descriptor);
public:
//Constructor
Gdt();
//Destructor
~Gdt();
//Methods
void loadGdt();
};
#endif

View file

@ -1,14 +1,26 @@
#----- Kernel -----
kernel.bin:entry.o main.o GDT/gdt.o
ld -m elf_i386 --entry=_start -Ttext=0x100000 -o $@ $^
#-----------------
#----- Entry & Main-----
entry.o:entry.asm
nasm -f elf $^
main.o:main.cpp
g++ -Wall -m32 -c $^ -o $@
GDT/gdt.o:
cd GDT && make
#-----------------------
#----- GDT -----
GDT/gdt.o:
cd ./GDT && make
#---------------
#----- Other -----
clean:
cd ./GDT/ && make clean
rm ./*.o