aboutsummaryrefslogtreecommitdiff
path: root/kernel/tss.sats
diff options
context:
space:
mode:
authorXander <xander@biltopia.org>2023-07-14 12:28:07 +0200
committerXander <xander@biltopia.org>2023-07-14 12:28:07 +0200
commit059b5ba286b3fef4d01c3ced9cd829ace5dd6340 (patch)
treea90a4310462fab9588ea04d830775a0de3e9727b /kernel/tss.sats
parent947331444708d2dc622ad6d8d3eb069e29a1898f (diff)
downloadats-os-059b5ba286b3fef4d01c3ced9cd829ace5dd6340.tar.xz
ats-os-059b5ba286b3fef4d01c3ced9cd829ace5dd6340.zip
Task state segment structs
Diffstat (limited to 'kernel/tss.sats')
-rw-r--r--kernel/tss.sats48
1 files changed, 48 insertions, 0 deletions
diff --git a/kernel/tss.sats b/kernel/tss.sats
new file mode 100644
index 0000000..e5016a8
--- /dev/null
+++ b/kernel/tss.sats
@@ -0,0 +1,48 @@
+#define
+STACK_SIZE 4096
+
+// Stack pointer
+typedef sp_t = @{
+ (* low = uint32, // The higher 32 bits of stack pointer *)
+ (* high = uint32 /// The lower 32 bits of stack pointer *)
+ a = [l : addr] ptr l
+}
+
+// Interrupt Stack table
+typedef ist_t = @{
+ IS1 = sp_t, // Interrupt stack pointer 1
+ IS2 = sp_t, // Interrupt stack pointer 2
+ IS3 = sp_t, // Interrupt stack pointer 3
+ IS4 = sp_t, // Interrupt stack pointer 4
+ IS5 = sp_t, // Interrupt stack pointer 5
+ IS6 = sp_t, // Interrupt stack pointer 6
+ IS7 = sp_t // Interrupt stack pointer 7
+}
+
+// Privilege change stack table
+typedef rst_t = @{
+ RSP0 = sp_t, // Points to stack with privilege level 0
+ RSP1 = sp_t, // Points to stack with privilege level 1
+ RSP2 = sp_t // Points to stack with privilege level 2
+}
+
+// I/O Permission Bitmap
+typedef iopb_t = uint16
+
+//Task state segment
+typedef tss_t = @{
+ r1 = uint32 0, // Reserved space
+ rst = rst_t,
+ r2 = uint32 0, // Reserved space
+ r3 = uint32 0, // Reserved space
+ ist = ist_t,
+ r4 = uint32 0, // Reserved space
+ r5 = uint32 0, // Reserved space
+ r6 = uint16 0, // Reserved space
+ iopb = iopb_t
+}
+
+typedef stack = @[uint8][STACK_SIZE]
+
+fun tss_init() : void
+