aboutsummaryrefslogtreecommitdiff
path: root/i686/lgdt.c
diff options
context:
space:
mode:
Diffstat (limited to 'i686/lgdt.c')
-rw-r--r--i686/lgdt.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/i686/lgdt.c b/i686/lgdt.c
index 10781db..d1b24c3 100644
--- a/i686/lgdt.c
+++ b/i686/lgdt.c
@@ -10,26 +10,16 @@ static struct SegmentDescriptor_t segments[8] __attribute__((aligned(32)));
void
gdt_install()
{
- SegmentDescriptor(&segments[0], 0, 0, 0); // null segment
- SegmentDescriptor(&segments[2], 0, 0xffffffff, 0x9a); // ktext
- SegmentDescriptor(&segments[3], 0, 0xffffffff, 0x92); // kdata
+ SegmentDescriptor(&segments[0], 0, 0, 0); /* null segment */
+ SegmentDescriptor(&segments[2], 0, 0xffffffff, 0x9a); /* ktext segment */
+ SegmentDescriptor(&segments[3], 0, 0xffffffff, 0x92); /* kdata segment */
const struct Pointer ptr = {.limit = sizeof(segments) - 1, .base = (unsigned)&segments};
- asm volatile("lgdt (%0)" : : "a"(&ptr));
+ __asm__("lgdt (%0)" : : "a"(&ptr));
- // load the kernel data segment
- asm volatile(R"(mov %0, %%ds
- mov %0, %%es
- mov %0, %%fs
- mov %0, %%gs
- mov %0, %%ss
-)"
- :
- : "ax"(kdataDescriptor));
+ /* load the kernel data segment */
+ __asm__("mov %0, %%ds; mov %0, %%es; mov %0, %%fs; mov %0, %%gs; mov %0, %%ss" : : "ax"(kdataDescriptor));
- // load the kernel code segment
- asm volatile(R"(ljmp %0, $1f
- 1:)"
- :
- : "i"(ktextDescriptor));
+ /* load the kernel code segment */
+ __asm__("ljmp %0, $1f\n1:" : : "i"(ktextDescriptor));
}