diff options
Diffstat (limited to 'src/kernel/include/gdt.h')
-rw-r--r-- | src/kernel/include/gdt.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/kernel/include/gdt.h b/src/kernel/include/gdt.h new file mode 100644 index 0000000..a62d0db --- /dev/null +++ b/src/kernel/include/gdt.h @@ -0,0 +1,17 @@ +#pragma once + +#include <stddef.h> +#include <stdint.h> + +/* The GDT is one of the x86's descriptor tables. It is used for memory segmentation. + Here, we don't use segmentation to separate processes from one another (this is done with paging). + We only use segmentation to make the difference between kernel mode (ring 3) and user mode (ring 0) */ + +void gdt_init(); + +#define K_CODE_SEGMENT 0x08 +#define K_DATA_SEGMENT 0x10 +#define U_CODE_SEGMENT 0x18 +#define U_DATA_SEGMENT 0x20 + +/* vim: set ts=4 sw=4 tw=0 noet :*/ |