#pragma once #define STA_X 0x8 // Executable segment #define STA_W 0x2 // Writeable (non-executable segments) #define STA_R 0x2 // Readable (executable segments) // System segment type bits #define STS_T32A 0x9 // Available 32-bit TSS #define STS_IG32 0xE // 32-bit Interrupt Gate #define STS_TG32 0xF // 32-bit Trap Gate #define DPL_USER 3 #define FL_IF 0x00000200 #define SEG_KCODE 1 #define SEG_KDATA 2 #define SEG_UCODE 3 #define SEG_UDATA 4 #define SEG_TSS 5 #define SEG_ASM(type,base,lim) \ .word (((lim) >> 12) & 0xffff), ((base) & 0xffff); \ .byte (((base) >> 16) & 0xff), (0x90 | (type)), \ (0xC0 | (((lim) >> 28) & 0xf)), (((base) >> 24) & 0xff) #define USER_BASE 0x400000 // 4 MB #define USER_STACK_BASE 0xf00000 // 15 MB #define KERN_STACK_BASE 0x90000 #ifndef __ASSEMBLER__ void load_gdt(); #endif