summaryrefslogtreecommitdiff
path: root/src/stem/gdt.c
diff options
context:
space:
mode:
authorAlexis211 <alexis211@gmail.com>2010-02-03 15:22:30 +0100
committerAlexis211 <alexis211@gmail.com>2010-02-03 15:22:30 +0100
commit9c4310651a91e64c10a17f3190c895a49096aeb1 (patch)
treeaf87d115512249458f80f184d53db403c3f0bb0f /src/stem/gdt.c
parent7f72a900c12ba62db12df0872cb66f79a27aa9d9 (diff)
downloadTCE-9c4310651a91e64c10a17f3190c895a49096aeb1.tar.gz
TCE-9c4310651a91e64c10a17f3190c895a49096aeb1.zip
Reogranization
Diffstat (limited to 'src/stem/gdt.c')
-rw-r--r--src/stem/gdt.c36
1 files changed, 0 insertions, 36 deletions
diff --git a/src/stem/gdt.c b/src/stem/gdt.c
deleted file mode 100644
index 00a42ca..0000000
--- a/src/stem/gdt.c
+++ /dev/null
@@ -1,36 +0,0 @@
-#include "gdt.h"
-#include "lib/stdlib.h"
-#include "monitor.h"
-
-extern void gdt_flush(uint32_t); //ASM (idt_.asm)
-
-#define GDT_ENTRIES 5
-
-static struct gdt_entry gdt_entries[GDT_ENTRIES];
-static struct gdt_ptr gdt_ptr;
-
-static void gdt_setGate(int num, uint32_t base, uint32_t limit, uint8_t access, uint8_t gran) {
- gdt_entries[num].base_low = (base & 0xFFFF);
- gdt_entries[num].base_middle = (base >> 16) & 0xFF;
- gdt_entries[num].base_high = (base >> 24) & 0xFF;
-
- gdt_entries[num].limit_low = (limit & 0xFFFF);
- gdt_entries[num].granularity = (limit >> 16) & 0x0F;
- gdt_entries[num].granularity |= gran & 0xF0;
- gdt_entries[num].access = access;
-}
-
-void gdt_init() {
- gdt_ptr.limit = (sizeof(struct gdt_entry) * GDT_ENTRIES) - 1;
- gdt_ptr.base = (uint32_t)&gdt_entries;
-
- gdt_setGate(0, 0, 0, 0, 0); //Null segment
- gdt_setGate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); //Kernel code segment
- gdt_setGate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); //Kernel data segment
- gdt_setGate(3, 0, 0xFFFFFFFF, 0xFA, 0xCF); //User code segment
- gdt_setGate(4, 0, 0xFFFFFFFF, 0xF2, 0xCF); //User data segment
-
- gdt_flush((uint32_t)&gdt_ptr);
-
- monitor_write("GDT ok\n");
-}