summaryrefslogtreecommitdiff
path: root/kc/core/cpu/descriptor.h
diff options
context:
space:
mode:
Diffstat (limited to 'kc/core/cpu/descriptor.h')
-rw-r--r--kc/core/cpu/descriptor.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/kc/core/cpu/descriptor.h b/kc/core/cpu/descriptor.h
new file mode 100644
index 0000000..802c09c
--- /dev/null
+++ b/kc/core/cpu/descriptor.h
@@ -0,0 +1,55 @@
+#pragma once
+
+struct dtr64
+{
+ uint16_t limit;
+ uint64_t base;
+} __attribute__((packed));
+
+struct segment_descriptor
+{
+ uint16_t limit0;
+ uint16_t base0;
+ uint8_t base16;
+ uint8_t access;
+ uint8_t flags_limit16;
+ uint8_t base24;
+} __attribute__((packed));
+
+enum segment_descriptor_type
+{
+ CODE64_SUPER_SEG,
+ CODE64_USER_SEG,
+ DATA_SEG,
+ TASK64_SEG,
+};
+
+struct gate_descriptor
+{
+ uint16_t offset0;
+ uint16_t selector;
+ uint8_t ist;
+ uint8_t access;
+ uint16_t offset16;
+ uint64_t offset32;
+} __attribute__((packed));
+
+enum gate_descriptor_type
+{
+ EMPTY_GATE,
+ INT64_GATE,
+ TRAP64_GATE,
+};
+
+struct task64_segment
+{
+ uint32_t reserved0;
+ uint64_t rsp0;
+ uint64_t rsp1;
+ uint64_t rsp2;
+ uint64_t reserved1;
+ uint64_t ist[7];
+ uint16_t reserved2;
+ uint16_t iomap_base;
+};
+