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" #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)
} }
Gdt::~Gdt(){
void initGdt(){
} }
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; u8 base3;
} __attribute__ ((packed)); } __attribute__ ((packed));
//Typedef : //Typedef :
typedef struct gdtPointerStruct gdtPointerStruct; typedef struct gdtPointerStruct gdtPointerStruct;
typedef struct gdtDescriptorStruct gdtDescriptorStruct; typedef struct gdtDescriptorStruct gdtDescriptorStruct;
//Functions :
void initGdtDesc(u32 base, u32 limit, u8 type, u8 param, gdtDescriptorStruct *descriptor); //Gdt class
void initGdt(); 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 #endif

View file

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