Blame


1 0a61c07d 2004-04-19 devnull // Mips support
2 0a61c07d 2004-04-19 devnull
3 0a61c07d 2004-04-19 devnull defn acidinit() // Called after all the init modules are loaded
4 0a61c07d 2004-04-19 devnull {
5 0a61c07d 2004-04-19 devnull bplist = {};
6 0a61c07d 2004-04-19 devnull bpfmt = 'X';
7 0a61c07d 2004-04-19 devnull
8 0a61c07d 2004-04-19 devnull srcpath = {
9 0a61c07d 2004-04-19 devnull "./",
10 0a61c07d 2004-04-19 devnull "/sys/src/libc/port/",
11 0a61c07d 2004-04-19 devnull "/sys/src/libc/9sys/",
12 0a61c07d 2004-04-19 devnull "/sys/src/libc/mips/"
13 0a61c07d 2004-04-19 devnull };
14 0a61c07d 2004-04-19 devnull
15 0a61c07d 2004-04-19 devnull srcfiles = {}; // list of loaded files
16 0a61c07d 2004-04-19 devnull srctext = {}; // the text of the files
17 0a61c07d 2004-04-19 devnull }
18 0a61c07d 2004-04-19 devnull
19 0a61c07d 2004-04-19 devnull defn stk() // trace
20 0a61c07d 2004-04-19 devnull {
21 0a61c07d 2004-04-19 devnull _stk(*PC, *SP, linkreg(0), 0);
22 0a61c07d 2004-04-19 devnull }
23 0a61c07d 2004-04-19 devnull
24 0a61c07d 2004-04-19 devnull defn lstk() // trace with locals
25 0a61c07d 2004-04-19 devnull {
26 0a61c07d 2004-04-19 devnull _stk(*PC, *SP, linkreg(0), 1);
27 0a61c07d 2004-04-19 devnull }
28 0a61c07d 2004-04-19 devnull
29 0a61c07d 2004-04-19 devnull defn gpr() // print general purpose registers
30 0a61c07d 2004-04-19 devnull {
31 0a61c07d 2004-04-19 devnull print("R1\t", *R1, " R2\t", *R2, " R3\t", *R3, "\n");
32 0a61c07d 2004-04-19 devnull print("R4\t", *R4, " R5\t", *R5, " R6\t", *R6, "\n");
33 0a61c07d 2004-04-19 devnull print("R7\t", *R7, " R8\t", *R8, " R9\t", *R9, "\n");
34 0a61c07d 2004-04-19 devnull print("R10\t", *R10, " R11\t", *R11, " R12\t", *R12, "\n");
35 0a61c07d 2004-04-19 devnull print("R13\t", *R13, " R14\t", *R14, " R15\t", *R15, "\n");
36 0a61c07d 2004-04-19 devnull print("R16\t", *R16, " R17\t", *R17, " R18\t", *R18, "\n");
37 0a61c07d 2004-04-19 devnull print("R19\t", *R19, " R20\t", *R20, " R21\t", *R21, "\n");
38 0a61c07d 2004-04-19 devnull print("R22\t", *R22, " R23\t", *R23, " R24\t", *R24, "\n");
39 0a61c07d 2004-04-19 devnull print("R25\t", *R25, " R26\t", *R26, " R27\t", *R27, "\n");
40 0a61c07d 2004-04-19 devnull print("R28\t", *R28, " R29\t", *SP, " R30\t", *R30, "\n");
41 0a61c07d 2004-04-19 devnull print("R31\t", *R31, "\n");
42 0a61c07d 2004-04-19 devnull }
43 0a61c07d 2004-04-19 devnull
44 0a61c07d 2004-04-19 devnull defn Fpr()
45 0a61c07d 2004-04-19 devnull {
46 0a61c07d 2004-04-19 devnull print("F0\t", *fmt(F0, 'G'), "\tF2\t", *fmt(F2, 'G'), "\n");
47 0a61c07d 2004-04-19 devnull print("F4\t", *fmt(F4, 'G'), "\tF6\t", *fmt(F6, 'G'), "\n");
48 0a61c07d 2004-04-19 devnull print("F8\t", *fmt(F8, 'G'), "\tF10\t", *fmt(F10, 'G'), "\n");
49 0a61c07d 2004-04-19 devnull print("F12\t", *fmt(F12, 'G'), "\tF14\t", *fmt(F14, 'G'), "\n");
50 0a61c07d 2004-04-19 devnull print("F16\t", *fmt(F16, 'G'), "\tF18\t", *fmt(F18, 'G'), "\n");
51 0a61c07d 2004-04-19 devnull print("F20\t", *fmt(F20, 'G'), "\tF22\t", *fmt(F22, 'G'), "\n");
52 0a61c07d 2004-04-19 devnull print("F24\t", *fmt(F24, 'G'), "\tF26\t", *fmt(F26, 'G'), "\n");
53 0a61c07d 2004-04-19 devnull print("F28\t", *fmt(F28, 'G'), "\tF30\t", *fmt(F30, 'G'), "\n");
54 0a61c07d 2004-04-19 devnull }
55 0a61c07d 2004-04-19 devnull
56 0a61c07d 2004-04-19 devnull defn fpr()
57 0a61c07d 2004-04-19 devnull {
58 0a61c07d 2004-04-19 devnull print("F0\t", *fmt(F0, 'g'), "\tF1\t", *fmt(F1, 'g'), "\n");
59 0a61c07d 2004-04-19 devnull print("F2\t", *fmt(F2, 'g'), "\tF3\t", *fmt(F3, 'g'), "\n");
60 0a61c07d 2004-04-19 devnull print("F4\t", *fmt(F4, 'g'), "\tF5\t", *fmt(F5, 'g'), "\n");
61 0a61c07d 2004-04-19 devnull print("F6\t", *fmt(F6, 'g'), "\tF7\t", *fmt(F7, 'g'), "\n");
62 0a61c07d 2004-04-19 devnull print("F8\t", *fmt(F8, 'g'), "\tF9\t", *fmt(F9, 'g'), "\n");
63 0a61c07d 2004-04-19 devnull print("F10\t", *fmt(F10, 'g'), "\tF11\t", *fmt(F11, 'g'), "\n");
64 0a61c07d 2004-04-19 devnull print("F12\t", *fmt(F12, 'g'), "\tF13\t", *fmt(F13, 'g'), "\n");
65 0a61c07d 2004-04-19 devnull print("F14\t", *fmt(F14, 'g'), "\tF15\t", *fmt(F15, 'g'), "\n");
66 0a61c07d 2004-04-19 devnull print("F16\t", *fmt(F16, 'g'), "\tF17\t", *fmt(F17, 'g'), "\n");
67 0a61c07d 2004-04-19 devnull print("F18\t", *fmt(F18, 'g'), "\tF19\t", *fmt(F19, 'g'), "\n");
68 0a61c07d 2004-04-19 devnull print("F20\t", *fmt(F20, 'g'), "\tF21\t", *fmt(F21, 'g'), "\n");
69 0a61c07d 2004-04-19 devnull print("F22\t", *fmt(F22, 'g'), "\tF23\t", *fmt(F23, 'g'), "\n");
70 0a61c07d 2004-04-19 devnull print("F24\t", *fmt(F24, 'g'), "\tF25\t", *fmt(F25, 'g'), "\n");
71 0a61c07d 2004-04-19 devnull print("F26\t", *fmt(F26, 'g'), "\tF27\t", *fmt(F27, 'g'), "\n");
72 0a61c07d 2004-04-19 devnull print("F28\t", *fmt(F28, 'g'), "\tF29\t", *fmt(F29, 'g'), "\n");
73 0a61c07d 2004-04-19 devnull print("F30\t", *fmt(F30, 'g'), "\tF31\t", *fmt(F31, 'g'), "\n");
74 0a61c07d 2004-04-19 devnull }
75 0a61c07d 2004-04-19 devnull
76 0a61c07d 2004-04-19 devnull defn spr() // print special processor registers
77 0a61c07d 2004-04-19 devnull {
78 0a61c07d 2004-04-19 devnull local pc, link, cause;
79 0a61c07d 2004-04-19 devnull
80 0a61c07d 2004-04-19 devnull pc = *PC;
81 0a61c07d 2004-04-19 devnull print("PC\t", pc, " ", fmt(pc, 'a'), " ");
82 0a61c07d 2004-04-19 devnull pfl(pc);
83 0a61c07d 2004-04-19 devnull
84 0a61c07d 2004-04-19 devnull link = *R31;
85 0a61c07d 2004-04-19 devnull print("SP\t", *SP, "\tLINK\t", link, " ", fmt(link, 'a'), " ");
86 0a61c07d 2004-04-19 devnull pfl(link);
87 0a61c07d 2004-04-19 devnull
88 0a61c07d 2004-04-19 devnull cause = *CAUSE;
89 0a61c07d 2004-04-19 devnull print("STATUS\t", *STATUS, "\tCAUSE\t", cause, " ", reason(cause), "\n");
90 0a61c07d 2004-04-19 devnull print("TLBVIR\t", *TLBVIRT, "\tBADVADR\t", *BADVADDR, "\n");
91 0a61c07d 2004-04-19 devnull
92 0a61c07d 2004-04-19 devnull print("HI\t", *HI, "\tLO\t", *LO, "\n");
93 0a61c07d 2004-04-19 devnull }
94 0a61c07d 2004-04-19 devnull
95 0a61c07d 2004-04-19 devnull defn regs() // print all registers
96 0a61c07d 2004-04-19 devnull {
97 0a61c07d 2004-04-19 devnull spr();
98 0a61c07d 2004-04-19 devnull gpr();
99 0a61c07d 2004-04-19 devnull }
100 0a61c07d 2004-04-19 devnull
101 0a61c07d 2004-04-19 devnull defn pstop(pid)
102 0a61c07d 2004-04-19 devnull {
103 0a61c07d 2004-04-19 devnull local l, pc;
104 0a61c07d 2004-04-19 devnull
105 0a61c07d 2004-04-19 devnull pc = *PC;
106 0a61c07d 2004-04-19 devnull
107 0a61c07d 2004-04-19 devnull print(pid,": ", reason(*CAUSE), "\t");
108 0a61c07d 2004-04-19 devnull print(fmt(pc, 'a'), "\t", fmt(pc, 'i'), "\n");
109 0a61c07d 2004-04-19 devnull
110 0a61c07d 2004-04-19 devnull if notes then {
111 0a61c07d 2004-04-19 devnull if notes[0] != "sys: breakpoint" then {
112 0a61c07d 2004-04-19 devnull print("Notes pending:\n");
113 0a61c07d 2004-04-19 devnull l = notes;
114 0a61c07d 2004-04-19 devnull while l do {
115 0a61c07d 2004-04-19 devnull print("\t", head l, "\n");
116 0a61c07d 2004-04-19 devnull l = tail l;
117 0a61c07d 2004-04-19 devnull }
118 0a61c07d 2004-04-19 devnull }
119 0a61c07d 2004-04-19 devnull }
120 0a61c07d 2004-04-19 devnull }
121 0a61c07d 2004-04-19 devnull
122 0a61c07d 2004-04-19 devnull sizeofUreg = 152;
123 0a61c07d 2004-04-19 devnull aggr Ureg
124 0a61c07d 2004-04-19 devnull {
125 0a61c07d 2004-04-19 devnull 'X' 0 status;
126 0a61c07d 2004-04-19 devnull 'X' 4 pc;
127 0a61c07d 2004-04-19 devnull {
128 0a61c07d 2004-04-19 devnull 'X' 8 sp;
129 0a61c07d 2004-04-19 devnull 'X' 8 usp;
130 0a61c07d 2004-04-19 devnull };
131 0a61c07d 2004-04-19 devnull 'X' 12 cause;
132 0a61c07d 2004-04-19 devnull 'X' 16 badvaddr;
133 0a61c07d 2004-04-19 devnull 'X' 20 tlbvirt;
134 0a61c07d 2004-04-19 devnull 'X' 24 hi;
135 0a61c07d 2004-04-19 devnull 'X' 28 lo;
136 0a61c07d 2004-04-19 devnull 'X' 32 r31;
137 0a61c07d 2004-04-19 devnull 'X' 36 r30;
138 0a61c07d 2004-04-19 devnull 'X' 40 r28;
139 0a61c07d 2004-04-19 devnull 'X' 44 r27;
140 0a61c07d 2004-04-19 devnull 'X' 48 r26;
141 0a61c07d 2004-04-19 devnull 'X' 52 r25;
142 0a61c07d 2004-04-19 devnull 'X' 56 r24;
143 0a61c07d 2004-04-19 devnull 'X' 60 r23;
144 0a61c07d 2004-04-19 devnull 'X' 64 r22;
145 0a61c07d 2004-04-19 devnull 'X' 68 r21;
146 0a61c07d 2004-04-19 devnull 'X' 72 r20;
147 0a61c07d 2004-04-19 devnull 'X' 76 r19;
148 0a61c07d 2004-04-19 devnull 'X' 80 r18;
149 0a61c07d 2004-04-19 devnull 'X' 84 r17;
150 0a61c07d 2004-04-19 devnull 'X' 88 r16;
151 0a61c07d 2004-04-19 devnull 'X' 92 r15;
152 0a61c07d 2004-04-19 devnull 'X' 96 r14;
153 0a61c07d 2004-04-19 devnull 'X' 100 r13;
154 0a61c07d 2004-04-19 devnull 'X' 104 r12;
155 0a61c07d 2004-04-19 devnull 'X' 108 r11;
156 0a61c07d 2004-04-19 devnull 'X' 112 r10;
157 0a61c07d 2004-04-19 devnull 'X' 116 r9;
158 0a61c07d 2004-04-19 devnull 'X' 120 r8;
159 0a61c07d 2004-04-19 devnull 'X' 124 r7;
160 0a61c07d 2004-04-19 devnull 'X' 128 r6;
161 0a61c07d 2004-04-19 devnull 'X' 132 r5;
162 0a61c07d 2004-04-19 devnull 'X' 136 r4;
163 0a61c07d 2004-04-19 devnull 'X' 140 r3;
164 0a61c07d 2004-04-19 devnull 'X' 144 r2;
165 0a61c07d 2004-04-19 devnull 'X' 148 r1;
166 0a61c07d 2004-04-19 devnull };
167 0a61c07d 2004-04-19 devnull
168 0a61c07d 2004-04-19 devnull defn
169 0a61c07d 2004-04-19 devnull Ureg(addr) {
170 0a61c07d 2004-04-19 devnull complex Ureg addr;
171 0a61c07d 2004-04-19 devnull print(" status ", addr.status, "\n");
172 0a61c07d 2004-04-19 devnull print(" pc ", addr.pc, "\n");
173 0a61c07d 2004-04-19 devnull print(" sp ", addr.sp, "\n");
174 0a61c07d 2004-04-19 devnull print(" cause ", addr.cause, "\n");
175 0a61c07d 2004-04-19 devnull print(" badvaddr ", addr.badvaddr, "\n");
176 0a61c07d 2004-04-19 devnull print(" tlbvirt ", addr.tlbvirt, "\n");
177 0a61c07d 2004-04-19 devnull print(" hi ", addr.hi, "\n");
178 0a61c07d 2004-04-19 devnull print(" lo ", addr.lo, "\n");
179 0a61c07d 2004-04-19 devnull print(" r31 ", addr.r31, "\n");
180 0a61c07d 2004-04-19 devnull print(" r30 ", addr.r30, "\n");
181 0a61c07d 2004-04-19 devnull print(" r28 ", addr.r28, "\n");
182 0a61c07d 2004-04-19 devnull print(" r27 ", addr.r27, "\n");
183 0a61c07d 2004-04-19 devnull print(" r26 ", addr.r26, "\n");
184 0a61c07d 2004-04-19 devnull print(" r25 ", addr.r25, "\n");
185 0a61c07d 2004-04-19 devnull print(" r24 ", addr.r24, "\n");
186 0a61c07d 2004-04-19 devnull print(" r23 ", addr.r23, "\n");
187 0a61c07d 2004-04-19 devnull print(" r22 ", addr.r22, "\n");
188 0a61c07d 2004-04-19 devnull print(" r21 ", addr.r21, "\n");
189 0a61c07d 2004-04-19 devnull print(" r20 ", addr.r20, "\n");
190 0a61c07d 2004-04-19 devnull print(" r19 ", addr.r19, "\n");
191 0a61c07d 2004-04-19 devnull print(" r18 ", addr.r18, "\n");
192 0a61c07d 2004-04-19 devnull print(" r17 ", addr.r17, "\n");
193 0a61c07d 2004-04-19 devnull print(" r16 ", addr.r16, "\n");
194 0a61c07d 2004-04-19 devnull print(" r15 ", addr.r15, "\n");
195 0a61c07d 2004-04-19 devnull print(" r14 ", addr.r14, "\n");
196 0a61c07d 2004-04-19 devnull print(" r13 ", addr.r13, "\n");
197 0a61c07d 2004-04-19 devnull print(" r12 ", addr.r12, "\n");
198 0a61c07d 2004-04-19 devnull print(" r11 ", addr.r11, "\n");
199 0a61c07d 2004-04-19 devnull print(" r10 ", addr.r10, "\n");
200 0a61c07d 2004-04-19 devnull print(" r9 ", addr.r9, "\n");
201 0a61c07d 2004-04-19 devnull print(" r8 ", addr.r8, "\n");
202 0a61c07d 2004-04-19 devnull print(" r7 ", addr.r7, "\n");
203 0a61c07d 2004-04-19 devnull print(" r6 ", addr.r6, "\n");
204 0a61c07d 2004-04-19 devnull print(" r5 ", addr.r5, "\n");
205 0a61c07d 2004-04-19 devnull print(" r4 ", addr.r4, "\n");
206 0a61c07d 2004-04-19 devnull print(" r3 ", addr.r3, "\n");
207 0a61c07d 2004-04-19 devnull print(" r2 ", addr.r2, "\n");
208 0a61c07d 2004-04-19 devnull print(" r1 ", addr.r1, "\n");
209 0a61c07d 2004-04-19 devnull };
210 0a61c07d 2004-04-19 devnull
211 0a61c07d 2004-04-19 devnull defn linkreg(addr)
212 0a61c07d 2004-04-19 devnull {
213 0a61c07d 2004-04-19 devnull complex Ureg addr;
214 0a61c07d 2004-04-19 devnull return addr.r31\X;
215 0a61c07d 2004-04-19 devnull }
216 0a61c07d 2004-04-19 devnull
217 0a61c07d 2004-04-19 devnull print(acidfile);