-
Notifications
You must be signed in to change notification settings - Fork 1
/
mist32.h
147 lines (127 loc) · 1.94 KB
/
mist32.h
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
// Routines to let C code use special x86 instructions.
static inline void*
sriosr(void)
{
void *r;
asm("sriosr %0" : "=r"(r));
return r;
}
static inline uint
srieir(void)
{
uint intena;
asm volatile("srieir %0" : "=r"(intena));
return intena;
}
static inline void
srieiw_enable(void)
{
asm volatile("srieiw 1");
}
static inline void
srieiw_disable(void)
{
asm volatile("srieiw 0");
}
static inline void*
srpdtr(void)
{
void *r;
asm volatile("srpdtr %0" : "=r"(r));
return r;
}
static inline void
srpdtw(uint val)
{
asm volatile("srkpdtw %0" : : "r"(val));
asm volatile("srpdtw %0" : : "r"(val));
}
static inline void
srppdtw(uint val)
{
asm volatile("srppdtw %0" : : "r"(val));
}
static inline void
srppcw(uint val)
{
asm volatile("srppcw %0" : "=r"(val));
}
static inline void
sridtw(uint idt)
{
asm volatile("sridtw %0" : : "r"(idt));
}
static inline void
idts(void)
{
asm volatile("idts");
}
static inline uint
srfi0r(void)
{
uint r;
asm("srfi0r %0" : "=r"(r));
return r;
}
static inline uint
srfi1r(void)
{
uint r;
asm("srfi1r %0" : "=r"(r));
return r;
}
static inline uint
tas(volatile uint *addr)
{
uint test;
asm volatile("tas %0, %1" :
"=r"(test) : "r"(addr) : "memory");
return test;
}
//PAGEBREAK: 36
// Layout of the trap frame built on the stack by the
// hardware and by trapasm.S, and passed to trap().
struct trapframe {
// saved by hardware on interrupt
uint ptidr;
// uint ppdtr;
uint ppsr;
uint ppcr;
uint pflagr;
uint uspr;
uint rret;
uint rbase;
// uint r29;
uint r28;
uint r27;
uint r26;
uint r25;
uint r24;
uint r23;
uint r22;
uint r21;
uint r20;
uint r19;
uint r18;
uint r17;
uint r16;
uint r15;
uint r14;
uint r13;
uint r12;
uint r11;
uint r10;
uint r9;
uint r8;
// caller-saved registers
uint rtmp;
uint r6;
uint r5;
uint r4;
uint r3;
uint r2;
uint r1;
uint r0;
uint trapno;
// uint err;
};