diff --git a/kernel/GDT/gdt.cpp b/kernel/GDT/gdt.cpp index 5aa8065..c3a5d43 100644 --- a/kernel/GDT/gdt.cpp +++ b/kernel/GDT/gdt.cpp @@ -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 +} + + diff --git a/kernel/GDT/gdt.hpp b/kernel/GDT/gdt.hpp index 4b16886..607cc72 100644 --- a/kernel/GDT/gdt.hpp +++ b/kernel/GDT/gdt.hpp @@ -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 diff --git a/kernel/Makefile b/kernel/Makefile index c366b55..cb1a351 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -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