Move BootGDT definition to C

This commit is contained in:
2018-02-16 12:38:25 +01:00
parent 3508b182b7
commit 04f2123499
4 changed files with 30 additions and 22 deletions

28
src/kernel/cpu/gdt.c Normal file
View File

@@ -0,0 +1,28 @@
#include <stdint.h>
#include <cpu.h>
#define GDT_CODE (3<<11)
#define GDT_DPL(lvl) ((lvl)<<13)
#define GDT_PRESENT (1<<15)
#define GDT_LONG (1<<21)
struct gdt
{
uint32_t _;
uint32_t flags;
}__attribute__((packed));
struct gdtp
{
uint16_t len;
struct gdt *gdt;
}__attribute__((packed));
struct gdt BootGDT[] = {
{0, 0},
{0, GDT_PRESENT | GDT_DPL(0) | GDT_CODE | GDT_LONG}
};
struct gdtp GDTp = {2*8-1, BootGDT};