summaryrefslogtreecommitdiff
path: root/kernel/GDT/gdt.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/GDT/gdt.hpp')
-rw-r--r--kernel/GDT/gdt.hpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/kernel/GDT/gdt.hpp b/kernel/GDT/gdt.hpp
new file mode 100644
index 0000000..4b16886
--- /dev/null
+++ b/kernel/GDT/gdt.hpp
@@ -0,0 +1,33 @@
+#ifndef __GDT__
+#define __GDT__
+
+#include "../Types/types.hpp"
+
+//Define GDT pointer
+struct gdtPointerStruct{
+ u16 size;
+ u32 segment;
+} __attribute__ ((packed));
+
+//Define GDT descriptor
+struct gdtDescriptorStruct{
+ u16 limit1;
+ u16 base1;
+ u8 base2;
+ u8 type : 4;
+ u8 param1 : 4;
+ u8 limit2 : 4;
+ u8 param2 : 4;
+ 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();
+
+#endif