aboutsummaryrefslogtreecommitdiff
path: root/arch/i686/lgdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i686/lgdt.c')
-rw-r--r--arch/i686/lgdt.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/arch/i686/lgdt.c b/arch/i686/lgdt.c
index 2d35e8d..2be5d30 100644
--- a/arch/i686/lgdt.c
+++ b/arch/i686/lgdt.c
@@ -1,5 +1,10 @@
#include <gdt.h>
+struct __attribute__((packed)) Pointer {
+ uint16_t limit;
+ uint32_t base;
+};
+
static struct SegmentDescriptor_t segments[8] __attribute__((aligned(32)));
void
@@ -9,8 +14,7 @@ gdt_install()
SegmentDescriptor(&segments[2], 0, 0xffffffff, 0x9a); // ktext
SegmentDescriptor(&segments[3], 0, 0xffffffff, 0x92); // kdata
- struct Pointer ptr = {.limit = sizeof(segments) - 1, .base = (unsigned)&segments};
-
+ const struct Pointer ptr = {.limit = sizeof(segments) - 1, .base = (unsigned)&segments};
asm volatile("lgdt (%0)" : : "a"(&ptr));
// load the kernel data segment