summaryrefslogtreecommitdiffstats
path: root/arch/x86_64/hal/gdt.h
diff options
context:
space:
mode:
authorJon Santmyer <jon@jonsantmyer.com>2026-09-04 11:31:40 -0400
committerJon Santmyer <jon@jonsantmyer.com>2026-09-04 11:31:40 -0400
commit8251da342161767fe203627223ccd4a7026701c6 (patch)
treeaf2db0f11b0ea8ad35f88663a855bab39a80f679 /arch/x86_64/hal/gdt.h
downloadjove-kernel-8251da342161767fe203627223ccd4a7026701c6.tar.gz
jove-kernel-8251da342161767fe203627223ccd4a7026701c6.tar.bz2
jove-kernel-8251da342161767fe203627223ccd4a7026701c6.zip
initial commit. working on tasking
Diffstat (limited to 'arch/x86_64/hal/gdt.h')
-rw-r--r--arch/x86_64/hal/gdt.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/x86_64/hal/gdt.h b/arch/x86_64/hal/gdt.h
new file mode 100644
index 0000000..7fb7dfc
--- /dev/null
+++ b/arch/x86_64/hal/gdt.h
@@ -0,0 +1,48 @@
+#ifndef _JOVE_x86_64_HAL_GDT_H
+#define _JOVE_x86_64_HAL_GDT_H 1
+
+#include <stddef.h>
+#include <stdint.h>
+#include "jove.h"
+
+enum {
+ GDT_KERNEL_NULL = 0,
+ GDT_KERNEL_CODE,
+ GDT_KERNEL_DATA,
+ GDT_USER_NULL,
+ GDT_USER_DATA,
+ GDT_USER_CODE,
+ GDT_TSS_LO,
+ GDT_TSS_HI
+};
+
+#define GDT_OFFSET(i) (i << 3)
+
+struct gdt_entry
+{
+ uint16_t limit_0_15;
+ uint16_t base_0_15;
+ uint8_t base_16_23;
+ uint8_t type_flg;
+ uint8_t limit_flg;
+ uint8_t base_24_31;
+};
+
+struct tss
+{
+ uint32_t rsv0;
+ uint64_t rsp[3];
+ uint64_t rsv1;
+ uint64_t ist[7];
+ uint64_t rsv2;
+ uint16_t rsv3;
+ uint16_t iopb;
+} PACKED;
+
+struct gdt_descriptor
+{
+ uint16_t limit;
+ uint64_t base;
+} PACKED;
+
+#endif