aboutsummaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/gdt.h23
-rw-r--r--kernel/include/io.h4
2 files changed, 27 insertions, 0 deletions
diff --git a/kernel/include/gdt.h b/kernel/include/gdt.h
new file mode 100644
index 0000000..e93c92a
--- /dev/null
+++ b/kernel/include/gdt.h
@@ -0,0 +1,23 @@
+#include <stdint.h>
+
+struct gdt_entry {
+ uint16_t limit_low;
+ uint16_t base_low;
+ uint8_t base_middle;
+ uint8_t access;
+ uint8_t granularity;
+ uint8_t base_high;
+} __attribute__((packed));
+
+struct gdt_ptr {
+ uint8_t limit;
+ uint32_t base;
+} __attribute__((packed));
+
+struct gdt_entry gdt[3];
+struct gdt_ptr gp;
+
+/* assembly */
+extern void gdt_flush(struct gdt_ptr*);
+
+void gdt_init(void);
diff --git a/kernel/include/io.h b/kernel/include/io.h
new file mode 100644
index 0000000..c3c735b
--- /dev/null
+++ b/kernel/include/io.h
@@ -0,0 +1,4 @@
+#include <stdint.h>
+void outb(uint16_t port, uint8_t val);
+uint8_t inb(uint16_t port);
+uint16_t inw(uint16_t port);