diff options
author | aqua <aqua@iserlohn-fortress.net> | 2022-04-01 11:38:00 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2022-08-12 10:13:59 +0300 |
commit | a6c1174b3fb598cd59c1668cfc4d4746ab688079 (patch) | |
tree | 85e2c3e37ef0c9602c56873332b98311e655e6e5 /arch/i686/lgdt.c | |
parent | Initial commit (diff) | |
download | kernel-a6c1174b3fb598cd59c1668cfc4d4746ab688079.tar.xz |
lidt
Diffstat (limited to 'arch/i686/lgdt.c')
-rw-r--r-- | arch/i686/lgdt.c | 8 |
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 |