From 9113c143c377876cc750e007e99f76c844bc95e8 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Mon, 6 Mar 2017 02:14:29 +0100 Subject: gdt: move assembler code to arch The assembler code to set the global descriptor table is architecture-specific and therefore moved to arch.{c,h}. --- core/gdt.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'core') diff --git a/core/gdt.c b/core/gdt.c index 819262e..708e2c5 100644 --- a/core/gdt.c +++ b/core/gdt.c @@ -12,7 +12,9 @@ * more details. */ +#include #include +#include #include struct gdt_sgmt { @@ -33,11 +35,6 @@ enum gdt_sgmts { struct gdt_sgmt gdt[GDT_SGMT_COUNT]; -struct gdtp { - uint16_t limit; - void *pointer; -} __attribute__((packed)); - struct gdtp gdtp = { .limit = GDT_SGMT_COUNT * sizeof(*gdt) - 1, .pointer = gdt, @@ -69,9 +66,11 @@ static void gdt_sgmt_set(uint32_t base, uint32_t limit, uint8_t access, void gdt_init(void) { + ker_dbg("Initializing GDT ..."); + gdt_sgmt_set(0, 0, 0, &gdt[GDT_SGMT_NULL]); gdt_sgmt_set(0, 64 * 1024 * 1024, 0x9A, &gdt[GDT_SGMT_CODE]); gdt_sgmt_set(0, 64 * 1024 * 1024, 0x92, &gdt[GDT_SGMT_NULL]); - asm volatile("lgdt %0" : : "m" (gdtp)); + gdtset(gdtp); } -- cgit v1.2.1