diff options
Diffstat (limited to 'kernel/tss.sats')
-rw-r--r-- | kernel/tss.sats | 48 |
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 + |