jankos/gdt.h
shockrah c94252c3f2 Huge GDT update:
GDT control is how I would like it to be but there are some issues, namely:
1. far jumping to flush the code segment crashes the whole os(not good)
2. Segment selectors seem fine apart from the code segment thing
3. some administrative issues regarding the structure of the project which is slowly making things painful
2019-10-14 00:23:37 -07:00

30 lines
590 B
C

#include "types.h"
#define NO_GDT_ENTRIES 3
struct GDT_Entry {
u16 low_limit;
u16 low_base;
u8 middle_base;
u8 access;
u8 granular;
u8 high_base;
}__attribute__((packed));
// Contains the pointer to the first gdt entry as well as the size(of the whole table(?))
struct GDT_PTR {
u16 size;
u32 address;
}__attribute__((packed));
struct GDT_Entry gdt_entries[NO_GDT_ENTRIES];
struct GDT_PTR gdt_ptr;
// this func is actually taken care of in gdt_seg.s
extern void load_gdt();
void gdt_configure_entry(u32 entry, u32 base, u32 limit, u8 access, u8 gran);
void gdt_configure();