9#ifndef KERNEL_ARCH_X86_64_GDT_H
10#define KERNEL_ARCH_X86_64_GDT_H
18#define CODE_DATA_SEGMENT true
19#define LIMIT_BYTES false
20#define LIMIT_4KIB_PAGES true
21#define SEGMENT_32_BIT true
22#define SEGMENT_16_BIT false
25struct __attribute__((packed)) gdt_entry {
37struct __attribute__((packed)) tss {
39 uint64_t rsp0, rsp1, rsp2;
48_Static_assert(
sizeof(
struct tss) == 104,
"TSS must be 104 bytes");
51struct __attribute__((packed)) gdtr {
88uint8_t
get_flag_byte(
bool granularity,
bool size,
bool long_mode);
uint8_t get_access_byte(bool rw, bool exec, bool type, uint8_t dpl)
Generates the access byte for the GDT.
uint8_t get_flag_byte(bool granularity, bool size, bool long_mode)
Generates the flag byte for the GDT.
void gdt_set_entry(int index, uint8_t access, uint8_t flags)
Sets an entry of the gdt with the correct access and flags.
void init_gdt(void)
Initializes the gdt and loads it.
Utilities for memory and string operations.
Logging utilities for the kernel.