diff options
author | Marvin Borner | 2020-05-07 00:16:52 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-07 00:16:52 +0200 |
commit | 31767b532e69c5a63df0106fa08e137e3106a449 (patch) | |
tree | ea7a91347e030c0b120361b7d9975547a5af19d1 /src/kernel/gdt/gdt.c | |
parent | 8083536f321ad8a12ad4668c2bf41a65c3e3b2f6 (diff) |
Some fixes here and there...
Also implemented serial console in userspace
Diffstat (limited to 'src/kernel/gdt/gdt.c')
-rw-r--r-- | src/kernel/gdt/gdt.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/kernel/gdt/gdt.c b/src/kernel/gdt/gdt.c index 616fb25..c6b329a 100644 --- a/src/kernel/gdt/gdt.c +++ b/src/kernel/gdt/gdt.c @@ -5,16 +5,16 @@ #include <memory/alloc.h> struct gdt_entry { - unsigned short limit_low; - unsigned short base_low; - unsigned char base_middle; - unsigned char access; - unsigned char granularity; - unsigned char base_high; + u16 limit_low; + u16 base_low; + u8 base_middle; + u8 access; + u8 granularity; + u8 base_high; } __attribute__((packed)); struct gdt_ptr { - unsigned short limit; + u16 limit; void *base; } __attribute__((packed)); @@ -58,13 +58,13 @@ extern void gdt_flush(); void gdt_set_gate(s32 num, u32 base, u32 limit, u8 access, u8 gran) { // Set descriptor base address - gdt[num].base_low = (unsigned short)(base & 0xFFFF); - gdt[num].base_middle = (unsigned char)((base >> 16) & 0xFF); - gdt[num].base_high = (unsigned char)((base >> 24) & 0xFF); + gdt[num].base_low = (u16)(base & 0xFFFF); + gdt[num].base_middle = (u8)((base >> 16) & 0xFF); + gdt[num].base_high = (u8)((base >> 24) & 0xFF); // Set descriptor limits - gdt[num].limit_low = (unsigned short)(limit & 0xFFFF); - gdt[num].granularity = (unsigned char)((limit >> 16) & 0x0F); + gdt[num].limit_low = (u16)(limit & 0xFFFF); + gdt[num].granularity = (u8)((limit >> 16) & 0x0F); // Set granularity and access flags gdt[num].granularity |= (gran & 0xF0); |