All checks were successful
Build documentation / build-and-deploy (push) Successful in 28s
46 lines
899 B
C
46 lines
899 B
C
#ifndef _KERNEL_AMD64_GDT_H
|
|
#define _KERNEL_AMD64_GDT_H
|
|
|
|
#include <aux/compiler.h>
|
|
#include <libk/std.h>
|
|
#include <proc/proc.h>
|
|
|
|
#define GDT_KCODE 0x08
|
|
#define GDT_KDATA 0x10
|
|
#define GDT_UCODE 0x18
|
|
#define GDT_UDATA 0x20
|
|
#define GDT_TSS 0x28
|
|
|
|
/* Size of kernel stack */
|
|
#define KSTACK_SIZE (32 * 1024)
|
|
|
|
/*
|
|
* 64-bit GDT structure. For more info see:
|
|
* - https://wiki.osdev.org/Global_Descriptor_Table
|
|
* - https://wiki.osdev.org/GDT_Tutorial
|
|
*/
|
|
|
|
struct gdt_entry {
|
|
uint16_t limitlow;
|
|
uint16_t baselow;
|
|
uint8_t basemid;
|
|
uint8_t access;
|
|
uint8_t gran;
|
|
uint8_t basehigh;
|
|
} PACKED;
|
|
|
|
/* Struct that gets loaded into GDTR */
|
|
struct gdt_ptr {
|
|
uint16_t limit;
|
|
uint64_t base;
|
|
} PACKED;
|
|
|
|
/* New, extended GDT (we need to extend Limine's GDT) */
|
|
struct gdt_extended {
|
|
struct gdt_entry old[5];
|
|
struct gdt_entry tsslow;
|
|
struct gdt_entry tsshigh;
|
|
} PACKED;
|
|
|
|
#endif // _KERNEL_AMD64_GDT_H
|