1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
|