diff --git a/kernel/inc/platform/gdt.h b/kernel/inc/platform/gdt.h index 72a5104..40fc475 100644 --- a/kernel/inc/platform/gdt.h +++ b/kernel/inc/platform/gdt.h @@ -20,38 +20,8 @@ typedef enum { GDT_SELECTOR_NULL = 0x00, - GDT_SELECTOR_KERNEL_CODE = 0x08, - GDT_SELECTOR_KERNEL_DATA = 0x10, - GDT_SELECTOR_USER_NULL = 0x18, - GDT_SELECTOR_USER_CODE = 0x20, - GDT_SELECTOR_USER_DATA = 0x28 + GDT_SELECTOR_KERNEL_CODE = 0x28, + GDT_SELECTOR_KERNEL_DATA = 0x30, } gdt_selector_E; -typedef struct { - uint16_t size; - uint64_t offset; -}__attribute__((packed)) gdt_descriptor_T; - -typedef struct { - uint16_t limit0; - uint16_t base0; - uint8_t base1; - uint8_t access; - uint8_t limit1_flags; - uint8_t base2; -}__attribute__((packed)) gdt_entry_T; - -typedef struct { - gdt_entry_T null; // 0x00 - gdt_entry_T kernel_code; // 0x08 - gdt_entry_T kernel_data; // 0x10 - gdt_entry_T user_null; // 0x18 - gdt_entry_T user_code; // 0x20 - gdt_entry_T user_data; // 0x28 -}__attribute__((packed)) __attribute__((aligned(0x1000))) gdt_T; - -extern gdt_T g_default_gdt; - -void gdt_init(); - #endif //NOX_GDT_H diff --git a/kernel/src/platform/gdt.c b/kernel/src/platform/gdt.c deleted file mode 100644 index cac09eb..0000000 --- a/kernel/src/platform/gdt.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (C) Antifallobst - * - * NoxOS is free software: - * you can redistribute it and/or modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, - * or (at your option) any later version. - * - * NoxOS is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with this program. - * If not, see . - */ - -#include "platform/gdt.h" -#include "utils/logger.h" - -extern void gdt_load(gdt_descriptor_T* gdt_descriptor); - -__attribute__((aligned(0x1000))) -gdt_T g_default_gdt = { - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x9A, 0xA0, 0x00}, - {0x00, 0x00, 0x00, 0x92, 0xA0, 0x00}, - {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, - {0x00, 0x00, 0x00, 0x9A, 0xA0, 0x00}, - {0x00, 0x00, 0x00, 0x92, 0xA0, 0x00} -}; - -void gdt_init() { - gdt_descriptor_T descriptor; - - descriptor.size = sizeof(gdt_T) - 1; - descriptor.offset = (uint64_t)&g_default_gdt; - - gdt_load(&descriptor); - log(LOG_INFO, "GDT loaded"); -} \ No newline at end of file