]> git.saurik.com Git - apple/xnu.git/blob - osfmk/ppc/db_low_trace.c
xnu-517.9.4.tar.gz
[apple/xnu.git] / osfmk / ppc / db_low_trace.c
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
11 *
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
18 * under the License.
19 *
20 * @APPLE_LICENSE_HEADER_END@
21 */
22 /*
23 * @OSF_FREE_COPYRIGHT@
24 */
25 /*
26 * @APPLE_FREE_COPYRIGHT@
27 */
28
29 /*
30 * Author: Bill Angell, Apple
31 * Date: 6/97
32 *
33 * exceptions and certain C functions write into a trace table which
34 * can be examined via the machine 'lt' command under kdb
35 */
36
37
38 #include <string.h> /* For strcpy() */
39 #include <mach/boolean.h>
40 #include <machine/db_machdep.h>
41
42 #include <ddb/db_access.h>
43 #include <ddb/db_lex.h>
44 #include <ddb/db_output.h>
45 #include <ddb/db_command.h>
46 #include <ddb/db_sym.h>
47 #include <ddb/db_task_thread.h>
48 #include <ddb/db_command.h> /* For db_option() */
49 #include <ddb/db_examine.h>
50 #include <ddb/db_expr.h>
51 #include <kern/thread.h>
52 #include <kern/task.h>
53 #include <mach/vm_param.h>
54 #include <mach/kmod.h>
55 #include <ppc/Firmware.h>
56 #include <ppc/low_trace.h>
57 #include <ppc/db_low_trace.h>
58 #include <ppc/mappings.h>
59 #include <ppc/pmap.h>
60 #include <ppc/mem.h>
61 #include <ppc/savearea.h>
62 #include <ppc/vmachmon.h>
63
64 void db_dumppca(unsigned int ptegindex);
65 void db_dumpmapping(struct mapping *mp); /* Dump out a mapping */
66 extern kmod_info_t *kmod; /* Find the kmods */
67
68 db_addr_t db_low_trace_prev = 0;
69
70 /*
71 * Print out the low level trace table:
72 *
73 * Displays the entry and 15 before it in newest to oldest order
74 *
75 * lt [entaddr]
76
77 * If entaddr is omitted, it starts with the most current
78 * If entaddr = 0, it starts with the most current and does the whole table
79 */
80 void db_low_trace(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
81
82 int c, i;
83 unsigned int tempx, cnt;
84 unsigned int xTraceCurr, xTraceStart, xTraceEnd, cxltr;
85 db_addr_t next_addr;
86 LowTraceRecord xltr;
87 unsigned char cmark;
88 addr64_t xxltr;
89
90 cnt = 16; /* Default to 16 entries */
91
92 xTraceCurr = trcWork.traceCurr; /* Transfer current pointer */
93 xTraceStart = trcWork.traceStart; /* Transfer start of table */
94 xTraceEnd = trcWork.traceEnd; /* Transfer end of table */
95
96 if(addr == -1) cnt = 0x7FFFFFFF; /* Max the count */
97
98 if(!addr || (addr == -1)) {
99 addr=xTraceCurr-sizeof(LowTraceRecord); /* Start at the newest */
100 if((unsigned int)addr<xTraceStart) addr=xTraceEnd-sizeof(LowTraceRecord); /* Wrap low back to high */
101 }
102
103 if((unsigned int)addr<xTraceStart||(unsigned int)addr>=xTraceEnd) { /* In the table? */
104 db_printf("address not in low memory trace table\n"); /* Tell the fool */
105 return; /* Leave... */
106 }
107
108 if((unsigned int)addr&0x0000007F) { /* Proper alignment? */
109 db_printf("address not aligned on trace entry boundary (0x80)\n"); /* Tell 'em */
110 return; /* Leave... */
111 }
112
113 xxltr = addr; /* Set the start */
114 cxltr = ((xTraceCurr == xTraceStart ? xTraceEnd : xTraceCurr) - sizeof(LowTraceRecord)); /* Get address of newest entry */
115
116 db_low_trace_prev = addr; /* Starting point */
117
118 for(i=0; i < cnt; i++) { /* Dump the 16 (or all) entries */
119
120 ReadReal((addr64_t)xxltr, (unsigned int *)&xltr); /* Get the first half */
121 ReadReal((addr64_t)xxltr + 32, &(((unsigned int *)&xltr)[8])); /* Get the second half */
122 ReadReal((addr64_t)xxltr + 64, &(((unsigned int *)&xltr)[16])); /* Get the second half */
123 ReadReal((addr64_t)xxltr + 96, &(((unsigned int *)&xltr)[24])); /* Get the second half */
124
125 db_printf("\n%s%08llX %1X %08X %08X - %04X\n", (xxltr != cxltr ? " " : "*"),
126 xxltr,
127 xltr.LTR_cpu, xltr.LTR_timeHi, xltr.LTR_timeLo,
128 (xltr.LTR_excpt & 0x8000 ? 0xFFFF : xltr.LTR_excpt * 64)); /* Print the first line */
129
130 db_printf(" DAR/DSR/CR: %016llX %08X %08X\n", xltr.LTR_dar, xltr.LTR_dsisr, xltr.LTR_cr);
131
132 db_printf(" SRR0/SRR1 %016llX %016llX\n", xltr.LTR_srr0, xltr.LTR_srr1);
133 db_printf(" LR/CTR %016llX %016llX\n", xltr.LTR_lr, xltr.LTR_ctr);
134
135 db_printf(" R0/R1/R2 %016llX %016llX %016llX\n", xltr.LTR_r0, xltr.LTR_r1, xltr.LTR_r2);
136 db_printf(" R3/R4/R5 %016llX %016llX %016llX\n", xltr.LTR_r3, xltr.LTR_r4, xltr.LTR_r5);
137 db_printf(" R6/sv/rsv %016llX %016llX %08X\n", xltr.LTR_r6, xltr.LTR_save, xltr.LTR_rsvd0);
138
139 if((cnt != 16) && (xxltr == xTraceCurr)) break; /* If whole table dump, exit when we hit start again... */
140
141 xxltr-=sizeof(LowTraceRecord); /* Back it on up */
142 if(xxltr<xTraceStart)
143 xxltr=(xTraceEnd-sizeof(LowTraceRecord)); /* Wrap low back to high */
144
145 }
146 db_next = (db_expr_t)(xxltr);
147 return;
148 }
149
150
151 /*
152 * Print out 256 bytes
153 *
154 *
155 * dl [entaddr]
156 */
157 void db_display_long(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
158
159 int i;
160
161 for(i=0; i<8; i++) { /* Print 256 bytes */
162 db_printf("%016llX %08X %08X %08X %08X %08X %08X %08X %08X\n", addr, /* Print a line */
163 ((unsigned long *)addr)[0], ((unsigned long *)addr)[1], ((unsigned long *)addr)[2], ((unsigned long *)addr)[3],
164 ((unsigned long *)addr)[4], ((unsigned long *)addr)[5], ((unsigned long *)addr)[6], ((unsigned long *)addr)[7]);
165 addr=(db_expr_t)(addr+0x00000020); /* Point to next address */
166 }
167 db_next = addr;
168
169
170 }
171
172 unsigned char xtran[256] = {
173 /* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */
174 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* 0x */
175 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* 1x */
176 ' ', '!', '"', '#', '$', '%', '&',0x27, '(', ')', '*', '+', ',', '-', '.', '/', /* 2x */
177 '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>', '?', /* 3x */
178 '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', /* 4x */
179 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[',0x5C, ']', '^', '_', /* 5x */
180 '`', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', /* 6x */
181 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~', '.', /* 7x */
182 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* 8x */
183 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* 9x */
184 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* Ax */
185 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* Bx */
186 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* Cx */
187 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* Dx */
188 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* Ex */
189 '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', '.', /* Fx */
190 };
191
192 /*
193 * Print out 256 bytes in characters
194 *
195 *
196 * dc [entaddr]
197 */
198 void db_display_char(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
199
200 int i, j, k;
201 unsigned char xlt[256], *xaddr;
202
203 xaddr = (unsigned char *)addr;
204
205
206 for(i = 0; i < 8; i++) { /* Print 256 bytes */
207 j = 0;
208 for(k = 0; k < 32; k++) {
209 xlt[j] = xtran[*xaddr];
210 xaddr++;
211 j++;
212 if((k & 3) == 3) {
213 xlt[j] = ' ';
214 j++;
215 }
216 }
217 xlt[j] = 0;
218
219 db_printf("%016llX %s\n", (addr64_t)(xaddr - 32), xlt); /* Print a line */
220 }
221
222 db_next = (db_expr_t)xaddr;
223
224
225 }
226
227 /*
228 * Print out 256 bytes of real storage
229 *
230 * Displays the entry and 15 before it in newest to oldest order
231 *
232 * dr [entaddr]
233 */
234 void db_display_real(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
235
236 int i;
237 unsigned int xbuf[8];
238
239 for(i=0; i<8; i++) { /* Print 256 bytes */
240 ReadReal(addr, &xbuf[0]); /* Get the real storage data */
241 db_printf("%016llX %08X %08X %08X %08X %08X %08X %08X %08X\n", addr, /* Print a line */
242 xbuf[0], xbuf[1], xbuf[2], xbuf[3],
243 xbuf[4], xbuf[5], xbuf[6], xbuf[7]);
244 addr = addr + 0x00000020; /* Point to next address */
245 }
246 db_next = addr;
247 }
248
249 unsigned int dvspace = 0;
250
251 /*
252 * Print out virtual to real translation information
253 *
254 *
255 * dm vaddr [space] (defaults to last entered)
256 */
257 void db_display_mappings(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
258
259 db_expr_t xspace;
260 pmap_t pmap;
261 addr64_t lnextva;
262
263 mapping *mp;
264
265 if (db_expression(&xspace)) { /* Get the address space requested */
266 if(xspace >= maxAdrSp) {
267 db_printf("requested address space (%llX) larger than max (%X)\n", xspace, maxAdrSp - 1);
268 return;
269 }
270 dvspace = xspace; /* Get the space or set default */
271 }
272
273 db_printf("mapping information for %016llX in space %8X:\n", addr, dvspace);
274
275 pmap = pmapTrans[dvspace].pmapVAddr; /* Find the pmap address */
276 if(!pmap) { /* The pmap is not in use */
277 db_printf("The space %X is not assigned to a pmap\n", dvspace); /* Say we are wrong */
278 return;
279 }
280
281 mp = hw_find_map(pmap, (addr64_t)addr, &lnextva); /* Try to find the mapping for this address */
282 if((unsigned int)mp == mapRtBadLk) { /* Did we lock up ok? */
283 db_printf("Timeout locking physical entry for virtual address %016ll8X\n", addr);
284 return;
285 }
286
287 if(!mp) { /* Did we find one? */
288 db_printf("Not mapped\n");
289 return; /* Didn't find any, return FALSE... */
290 }
291
292 mapping_drop_busy(mp); /* The mapping shouldn't be changing */
293
294 db_dumpmapping(mp); /* Dump it all out */
295
296 return; /* Tell them we did it */
297
298
299 }
300
301 /*
302 * Print out hash table data
303 *
304 *
305 * dh vaddr [space] (defaults to last entered)
306 */
307 void db_display_hash(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
308
309 db_expr_t xspace;
310 unsigned int seg, vsid, ptegindex, htsize;
311 pmap_t pmap;
312 addr64_t lnextva, llva, vpn, esid;
313 uint64_t hash;
314 int s4bit;
315
316 llva = (addr64_t)((unsigned int)addr); /* Make sure we are 64-bit now */
317
318 s4bit = !((per_proc_info[0].pf.Available & pf64Bit) == 0); /* Are we a big guy? */
319 if (db_expression(&xspace)) { /* Get the address space requested */
320 if(xspace >= maxAdrSp) {
321 db_printf("requested address space (%llX) larger than max (%X)\n", xspace, maxAdrSp - 1);
322 return;
323 }
324 dvspace = xspace; /* Get the space or set default */
325 }
326
327 pmap = pmapTrans[dvspace].pmapVAddr; /* Find the pmap address */
328 if(!pmap) { /* The pmap is not in use */
329 db_printf("The space %X is not assigned to a pmap\n", dvspace); /* Say we are wrong */
330 return;
331 }
332
333 hash = (uint64_t)pmap->space | ((uint64_t)pmap->space << maxAdrSpb) | ((uint64_t)pmap->space << (2 * maxAdrSpb)); /* Get hash value */
334 hash = hash & 0x0000001FFFFFFFFF; /* Make sure we stay within supported ranges */
335
336 esid = ((llva >> 14) & -maxAdrSp) ^ hash; /* Get ESID */
337 llva = ((llva >> 12) & 0xFFFF) ^ esid; /* Get index into hash table */
338
339 if(s4bit) htsize = hash_table_size >> 7; /* Get number of entries in hash table for 64-bit */
340 else htsize = hash_table_size >> 6; /* get number of entries in hash table for 32-bit */
341
342 ptegindex = llva & (htsize - 1); /* Get the index to the pteg and pca */
343 db_dumppca(ptegindex); /* dump the info */
344
345 return; /* Tell them we did it */
346
347
348 }
349
350 /*
351 * Displays all of the in-use pmaps in the system.
352 *
353 * dp
354 */
355 void db_display_pmap(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
356
357 pmap_t pmap;
358 int i;
359 unsigned int v0, v1, st0, st1;
360
361 pmap = (pmap_t)addr;
362 if(!have_addr) pmap = kernel_pmap; /* Start at the beginning */
363
364 db_printf("PMAP (real) Next Prev Space Flags Ref spaceNum Resident Wired\n");
365 // xxxxxxxx rrrrrrrrrrrrrrrr xxxxxxxx pppppppp ssssssss cccccccc vvvvvvvv nnnnnnnn rrrrrrrr wwwwwwwww
366 while(1) { /* Do them all */
367 db_printf("%08X %016llX %08X %08X %08X %08X %08X %08X %08X %08X\n",
368 pmap, (addr64_t)pmap ^ pmap->pmapvr,
369 pmap->pmap_link.next, pmap->pmap_link.prev,
370 pmap->space, pmap->pmapFlags, pmap->ref_count, pmap->spaceNum,
371 pmap->stats.resident_count,
372 pmap->stats.wired_count);
373
374 db_printf("lists = %d, rand = %08X, visits = %016llX, searches = %08X\n",
375 pmap->pmapCurLists, pmap->pmapRandNum,
376 pmap->pmapSearchVisits, pmap->pmapSearchCnt);
377
378 db_printf("cctl = %08X, SCSubTag = %016llX\n",
379 pmap->pmapCCtl, pmap->pmapSCSubTag);
380
381 for(i = 0; i < 16; i +=2) {
382 v0 = (pmap->pmapCCtl >> (31 - i) & 1); /* Get high order bit */
383 v1 = (pmap->pmapCCtl >> (30 - i) & 1); /* Get high order bit */
384 st0 = (pmap->pmapSCSubTag >> (60 - (4 * i))) & 0xF; /* Get the sub-tag */
385 st1 = (pmap->pmapSCSubTag >> (56 - (4 * i))) & 0xF; /* Get the sub-tag */
386
387 db_printf(" %01X %01X %016llX/%016llX %01X %01X %016llX/%016llX\n",
388 v0, st0, pmap->pmapSegCache[i].sgcESID, pmap->pmapSegCache[i].sgcVSID,
389 v1, st1, pmap->pmapSegCache[i+1].sgcESID, pmap->pmapSegCache[i+1].sgcVSID);
390 }
391
392 db_printf("\n");
393 if(have_addr) break; /* Do only one if address supplied */
394 pmap = (pmap_t)pmap->pmap_link.next; /* Skip to the next */
395 if(pmap == kernel_pmap) break; /* We've wrapped, we're done */
396 }
397 return;
398 }
399
400
401 /*
402 * Checks the pmap skip lists
403 *
404 *
405 * cp pmap
406 */
407 void db_check_pmaps(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
408
409 int i;
410 unsigned int ret;
411 uint64_t dumpa[32];
412 pmap_t pmap;
413
414 pmap = (pmap_t)addr;
415 if(!have_addr) pmap = kernel_pmap; /* If no map supplied, start with kernel */
416
417 while(1) { /* Do them all */
418 ret = mapSkipListVerifyC(pmap, &dumpa); /* Check out the map */
419 if(!ret) db_printf("Skiplists verified ok, pmap = %08X\n", pmap);
420 else {
421 db_printf("Verification failure at %08X, pmap = %08X\n", ret, pmap);
422 for(i = 0; i < 32; i += 4) {
423 db_printf("R%02d %016llX %016llX %016llX %016llX\n", i,
424 dumpa[i], dumpa[i + 1], dumpa[i + 2], dumpa[i + 3]);
425 }
426 }
427 if(have_addr) break; /* Do only one if address supplied */
428 pmap = (pmap_t)pmap->pmap_link.next; /* Skip to the next */
429 if(pmap == kernel_pmap) break; /* We've wrapped, we're done */
430 }
431
432 return;
433
434 }
435
436
437 /*
438 * Displays iokit junk
439 *
440 * dp
441 */
442
443 void db_piokjunk(void);
444
445 void db_display_iokit(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
446
447 db_piokjunk();
448
449 return;
450 }
451
452 /*
453 * Prints out a mapping control block
454 *
455 */
456
457 void db_dumpmapping(struct mapping *mp) { /* Dump out a mapping */
458
459 pmap_t pmap;
460 int i;
461
462 db_printf("Dump of mapping block: %08X, pmap: %08X (%016llX)\n", mp, pmapTrans[mp->mpSpace].pmapVAddr,
463 pmapTrans[mp->mpSpace].pmapPAddr); /* Header */
464 db_printf(" mpFlags: %08X\n", mp->mpFlags);
465 db_printf(" mpSpace: %04X\n", mp->mpSpace);
466 db_printf(" mpBSize: %04X\n", mp->mpBSize);
467 db_printf(" mpPte: %08X\n", mp->mpPte);
468 db_printf(" mpPAddr: %08X\n", mp->mpPAddr);
469 db_printf(" mpVAddr: %016llX\n", mp->mpVAddr);
470 db_printf(" mpAlias: %016llX\n", mp->mpAlias);
471 db_printf(" mpList00: %016llX\n", mp->mpList0);
472
473 for(i = 1; i < (mp->mpFlags & mpLists); i++) { /* Dump out secondary physical skip lists */
474 db_printf(" mpList%02d: %016llX\n", i, mp->mpList[i - 1]);
475 }
476
477 return;
478 }
479
480 /*
481 * Prints out a PTEG and PCA
482 *
483 */
484
485 void db_dumppca(unsigned int ptegindex) {
486
487 addr64_t pteg, pca, llva;
488 unsigned int xpteg[32], xpca[8], space, hash, pva, seg, api, va;
489 int i, s4bit;
490 unsigned long long llslot, llseg, llhash;
491
492 s4bit = !((per_proc_info[0].pf.Available & pf64Bit) == 0); /* Are we a big guy? */
493
494 pteg = hash_table_base + (ptegindex << 6); /* Point to the PTEG */
495 if(s4bit) pteg = hash_table_base + (ptegindex << 7); /* Point to the PTEG */
496 pca = hash_table_base - ((ptegindex + 1) * 4); /* Point to the PCA */
497 db_printf("PTEG = %016llX, PCA = %016llX (index = %08X)\n", pteg, pca, ptegindex);
498
499 ReadReal(pteg, &xpteg[0]); /* Get first half of the pteg */
500 ReadReal(pteg + 0x20, &xpteg[8]); /* Get second half of the pteg */
501 ReadReal(pca, &xpca[0]); /* Get pca */
502
503 db_printf("PCA: free = %02X, steal = %02X, auto = %02X, misc = %02X\n",
504 ((xpca[0] >> 24) & 255), ((xpca[0] >> 16) & 255), ((xpca[0] >> 8) & 255), xpca[0] & 255);
505
506 if(!s4bit) { /* Little guy? */
507
508 for(i = 0; i < 16; i += 2) { /* Step through pteg */
509 db_printf("%08X %08X - ", xpteg[i], xpteg[i + 1]); /* Dump the pteg slot */
510
511 if(xpteg[i] & 0x80000000) db_printf(" valid - "); /* Is it valid? */
512 else db_printf("invalid - "); /* Nope, invalid */
513
514 space = (xpteg[i] >> 7) & (maxAdrSp - 1); /* Extract the space */
515 hash = space | (space << maxAdrSpb) | (space << (2 * maxAdrSpb)); /* Get the hash */
516 pva = ptegindex ^ hash; /* Get part of the vaddr */
517 seg = (xpteg[i] >> 7) ^ hash; /* Get the segment number */
518 api = (xpteg[i] & 0x3F); /* Get the API */
519 va = ((seg << (28 - maxAdrSpb)) & 0xF0000000) | (api << 22) | ((pva << 12) & 0x003FF000); /* Get the vaddr */
520 db_printf("va = %08X\n", va);
521 }
522 }
523 else {
524 ReadReal(pteg + 0x40, &xpteg[16]); /* Get third half of the pteg */
525 ReadReal(pteg + 0x60, &xpteg[24]); /* Get fourth half of the pteg */
526
527 for(i = 0; i < 32; i += 4) { /* Step through pteg */
528 db_printf("%08X%08X %08X%08X - ", xpteg[i], xpteg[i + 1], xpteg[i + 2], xpteg[i + 3]); /* Dump the pteg slot */
529
530 if(xpteg[i + 1] & 1) db_printf(" valid - "); /* Is it valid? */
531 else db_printf("invalid - "); /* Nope, invalid */
532
533 llslot = ((long long)xpteg[i] << 32) | (long long)xpteg[i + 1]; /* Make a long long version of this */
534 space = (llslot >> 12) & (maxAdrSp - 1); /* Extract the space */
535 llhash = (unsigned long long)space | ((unsigned long long)space << maxAdrSpb) | ((unsigned long long)space << (2 * maxAdrSpb)); /* Get the hash */
536 llhash = llhash & 0x0000001FFFFFFFFF; /* Make sure we stay within supported ranges */
537 pva = (unsigned long long)ptegindex ^ llhash; /* Get part of the vaddr */
538 llseg = (llslot >> 12) ^ llhash; /* Get the segment number */
539 api = (llslot >> 7) & 0x1F; /* Get the API */
540 llva = ((llseg << (28 - maxAdrSpb)) & 0xFFFFFFFFF0000000ULL) | (api << 23) | ((pva << 12) & 0x007FF000); /* Get the vaddr */
541 db_printf("va = %016llX\n", llva);
542 }
543 }
544
545 return;
546 }
547
548
549 /*
550 * Print out 256 bytes of virtual storage
551 *
552 *
553 * dv [entaddr] [space]
554 * address must be on 32-byte boundary. It will be rounded down if not
555 */
556 void db_display_virtual(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
557
558 int i, size, lines, rlines;
559 unsigned int xbuf[8];
560 db_expr_t xspace;
561 pmap_t pmap;
562
563 mapping *mp, *mpv;
564 addr64_t pa;
565 ppnum_t pnum;
566
567 if (db_expression(&xspace)) { /* Parse the space ID */
568 if(xspace >= (1 << maxAdrSpb)) { /* Check if they gave us a sane space number */
569 db_printf("Invalid space ID: %llX - max is %X\n", xspace, (1 << maxAdrSpb) - 1);
570 return;
571 }
572 dvspace = xspace; /* Get the space or set default */
573 }
574
575 pmap = (pmap_t)pmapTrans[dvspace].pmapVAddr; /* Find the pmap address */
576 if((unsigned int)pmap == 0) { /* Is there actually a pmap here? */
577 db_printf("Address space not found: %X\n", dvspace); /* Complain */
578 return;
579 }
580
581 addr &= -32;
582
583 size = 4096 - (addr & 0x00000FFF); /* Bytes left on page */
584 lines = size / 32; /* Number of lines in first or only part */
585 if(lines > 8) lines = 8;
586 rlines = 8 - lines;
587 if(rlines < 0) lines = 0;
588
589 db_printf("Dumping %016llX (pmap = %08X, space = %X); ", addr, pmap, dvspace);
590
591 pnum = pmap_find_phys(pmap, (addr64_t)addr); /* Phynd the Physical */
592 if(!pnum) { /* Did we find one? */
593 db_printf("Not mapped\n");
594 return; /* Didn't find any, return FALSE... */
595 }
596
597 pa = (addr64_t)(pnum << 12) | (addr64_t)(addr & 0xFFF); /* Get the physical address */
598 db_printf("phys = %016llX\n", pa);
599
600 for(i=0; i<lines; i++) { /* Print n bytes */
601 ReadReal(pa, &xbuf[0]); /* Get the real storage data */
602 db_printf("%016llX %08X %08X %08X %08X %08X %08X %08X %08X\n", addr, /* Print a line */
603 xbuf[0], xbuf[1], xbuf[2], xbuf[3],
604 xbuf[4], xbuf[5], xbuf[6], xbuf[7]);
605 addr = (db_expr_t)((unsigned int)addr + 0x00000020); /* Point to next address */
606 pa = pa + 0x00000020; /* Point to next address */
607 }
608 db_next = addr;
609
610 if(!rlines) return;
611
612 db_printf("Dumping %016llX (pmap = %08X, space = %X); ", addr, pmap, dvspace);
613
614 pnum = pmap_find_phys(pmap, (addr64_t)((unsigned int)addr)); /* Phynd the Physical */
615 if(!pnum) { /* Did we find one? */
616 db_printf("Not mapped\n");
617 return; /* Didn't find any, return FALSE... */
618 }
619
620 pa = (addr64_t)(pnum << 12) | (addr64_t)((unsigned int)addr & 0xFFF); /* Get the physical address */
621 db_printf("phys = %016llX\n", pa);
622
623 for(i=0; i<rlines; i++) { /* Print n bytes */
624 ReadReal(pa, &xbuf[0]); /* Get the real storage data */
625 db_printf("%016llX %08X %08X %08X %08X %08X %08X %08X %08X\n", addr, /* Print a line */
626 xbuf[0], xbuf[1], xbuf[2], xbuf[3],
627 xbuf[4], xbuf[5], xbuf[6], xbuf[7]);
628 addr = (db_expr_t)(addr + 0x00000020); /* Point to next address */
629 pa = pa + 0x00000020; /* Point to next address */
630 }
631 db_next = addr;
632
633
634 }
635
636
637 /*
638 * Print out savearea stuff
639 *
640 *
641 * ds
642 */
643
644 #define chainmax 32
645
646 void db_display_save(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
647
648 int i, j, totsaves, tottasks, taskact, chainsize, vmid, didvmhead;
649 processor_set_t pset = &default_pset;
650 task_t task;
651 thread_act_t act;
652 savearea *save;
653 vmmCntrlTable *CTable;
654
655 tottasks = 0;
656 totsaves = 0;
657
658 for(task = (task_t)pset->tasks.next; task != (task_t)&pset->tasks.next; task = (task_t)task->pset_tasks.next) { /* Go through the tasks */
659 taskact = 0; /* Reset activation count */
660 db_printf("\nTask %4d @%08X:\n", tottasks, task); /* Show where we're at */
661 for(act = (thread_act_t)task->threads.next; act != (thread_act_t)&task->threads; act = (thread_act_t)act->task_threads.next) { /* Go through activations */
662 db_printf(" Act %4d @%08X - p: %08X current context: %08X\n",
663 taskact, act, act->mact.pcb, act->mact.curctx);
664
665 save = (savearea *)act->mact.pcb; /* Set the start of the normal chain */
666 chainsize = 0;
667
668 db_printf(" General context - fp: %08X fl: %08X fc: %d vp: %08X vl: %08X vp: %d\n",
669 act->mact.facctx.FPUsave, act->mact.facctx.FPUlevel, act->mact.facctx.FPUcpu,
670 act->mact.facctx.VMXsave, act->mact.facctx.VMXlevel, act->mact.facctx.VMXcpu);
671
672 while(save) { /* Do them all */
673 totsaves++; /* Count savearea */
674 db_printf(" Norm %08X: %016llX %016llX - tot = %d\n", save, save->save_srr0, save->save_srr1, totsaves);
675 save = (savearea *)save->save_hdr.save_prev; /* Next one */
676 if(chainsize++ > chainmax) { /* See if we might be in a loop */
677 db_printf(" Chain terminated by count (%d) before %08X\n", chainmax, save);
678 break;
679 }
680 }
681
682 save = (savearea *)act->mact.facctx.FPUsave; /* Set the start of the floating point chain */
683 chainsize = 0;
684 while(save) { /* Do them all */
685 totsaves++; /* Count savearea */
686 db_printf(" FPU %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
687 save = (savearea *)save->save_hdr.save_prev; /* Next one */
688 if(chainsize++ > chainmax) { /* See if we might be in a loop */
689 db_printf(" Chain terminated by count (%d) before %08X\n", chainmax, save);
690 break;
691 }
692 }
693
694 save = (savearea *)act->mact.facctx.VMXsave; /* Set the start of the floating point chain */
695 chainsize = 0;
696 while(save) { /* Do them all */
697 totsaves++; /* Count savearea */
698 db_printf(" Vec %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
699 save = (savearea *)save->save_hdr.save_prev; /* Next one */
700 if(chainsize++ > chainmax) { /* See if we might be in a loop */
701 db_printf(" Chain terminated by count (%d) before %08X\n", chainmax, save);
702 break;
703 }
704 }
705
706 if(CTable = act->mact.vmmControl) { /* Are there virtual machines? */
707
708 for(vmid = 0; vmid < kVmmMaxContexts; vmid++) {
709
710 if(!(CTable->vmmc[vmid].vmmFlags & vmmInUse)) continue; /* Skip if vm is not in use */
711
712 if(!CTable->vmmc[vmid].vmmFacCtx.FPUsave && !CTable->vmmc[vmid].vmmFacCtx.VMXsave) continue; /* If neither types, skip this vm */
713
714 db_printf(" VMachine ID %3d - fp: %08X fl: %08X fc: %d vp: %08X vl: %08X vp: %d\n", vmid, /* Title it */
715 CTable->vmmc[vmid].vmmFacCtx.FPUsave, CTable->vmmc[vmid].vmmFacCtx.FPUlevel, CTable->vmmc[vmid].vmmFacCtx.FPUcpu,
716 CTable->vmmc[vmid].vmmFacCtx.VMXsave, CTable->vmmc[vmid].vmmFacCtx.VMXlevel, CTable->vmmc[vmid].vmmFacCtx.VMXcpu
717 );
718
719 save = (savearea *)CTable->vmmc[vmid].vmmFacCtx.FPUsave; /* Set the start of the floating point chain */
720 chainsize = 0;
721 while(save) { /* Do them all */
722 totsaves++; /* Count savearea */
723 db_printf(" FPU %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
724 save = (savearea *)save->save_hdr.save_prev; /* Next one */
725 if(chainsize++ > chainmax) { /* See if we might be in a loop */
726 db_printf(" Chain terminated by count (%d) before %08X\n", chainmax, save);
727 break;
728 }
729 }
730
731 save = (savearea *)CTable->vmmc[vmid].vmmFacCtx.VMXsave; /* Set the start of the floating point chain */
732 chainsize = 0;
733 while(save) { /* Do them all */
734 totsaves++; /* Count savearea */
735 db_printf(" Vec %08X: %08X - tot = %d\n", save, save->save_hdr.save_level, totsaves);
736 save = (savearea *)save->save_hdr.save_prev; /* Next one */
737 if(chainsize++ > chainmax) { /* See if we might be in a loop */
738 db_printf(" Chain terminated by count (%d) before %08X\n", chainmax, save);
739 break;
740 }
741 }
742 }
743 }
744 taskact++;
745 }
746 tottasks++;
747 }
748
749 db_printf("Total saveareas accounted for: %d\n", totsaves);
750 return;
751 }
752
753 /*
754 * Print out extra registers
755 *
756 *
757 * dx
758 */
759
760 extern unsigned int dbfloats[33][2];
761 extern unsigned int dbvecs[33][4];
762 extern unsigned int dbspecrs[80];
763
764 void db_display_xregs(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
765
766 int i, j, pents;
767
768 stSpecrs(dbspecrs); /* Save special registers */
769 db_printf("PIR: %08X\n", dbspecrs[0]);
770 db_printf("PVR: %08X\n", dbspecrs[1]);
771 db_printf("SDR1: %08X\n", dbspecrs[22]);
772 db_printf("HID0: %08X\n", dbspecrs[39]);
773 db_printf("HID1: %08X\n", dbspecrs[40]);
774 db_printf("L2CR: %08X\n", dbspecrs[41]);
775 db_printf("MSSCR0: %08X\n", dbspecrs[42]);
776 db_printf("MSSCR1: %08X\n", dbspecrs[43]);
777 db_printf("THRM1: %08X\n", dbspecrs[44]);
778 db_printf("THRM2: %08X\n", dbspecrs[45]);
779 db_printf("THRM3: %08X\n", dbspecrs[46]);
780 db_printf("ICTC: %08X\n", dbspecrs[47]);
781 db_printf("L2CR2: %08X\n", dbspecrs[48]);
782 db_printf("DABR: %08X\n", dbspecrs[49]);
783 db_printf("\n");
784
785 db_printf("DBAT: %08X %08X %08X %08X\n", dbspecrs[2], dbspecrs[3], dbspecrs[4], dbspecrs[5]);
786 db_printf(" %08X %08X %08X %08X\n", dbspecrs[6], dbspecrs[7], dbspecrs[8], dbspecrs[9]);
787 db_printf("IBAT: %08X %08X %08X %08X\n", dbspecrs[10], dbspecrs[11], dbspecrs[12], dbspecrs[13]);
788 db_printf(" %08X %08X %08X %08X\n", dbspecrs[14], dbspecrs[15], dbspecrs[16], dbspecrs[17]);
789 db_printf("SPRG: %08X %08X %08X %08X\n", dbspecrs[18], dbspecrs[19], dbspecrs[20], dbspecrs[21]);
790 db_printf("\n");
791 for(i = 0; i < 16; i += 8) { /* Print 8 at a time */
792 db_printf("SR%02d: %08X %08X %08X %08X %08X %08X %08X %08X\n", i,
793 dbspecrs[23+i], dbspecrs[24+i], dbspecrs[25+i], dbspecrs[26+i],
794 dbspecrs[27+i], dbspecrs[28+i], dbspecrs[29+i], dbspecrs[30+i]);
795 }
796
797 db_printf("\n");
798
799 stFloat(dbfloats); /* Save floating point registers */
800 for(i = 0; i < 32; i += 4) { /* Print 4 at a time */
801 db_printf("F%02d: %08X %08X %08X %08X %08X %08X %08X %08X\n", i,
802 dbfloats[i][0], dbfloats[i][1], dbfloats[i+1][0], dbfloats[i+1][1],
803 dbfloats[i+2][0], dbfloats[i+2][1], dbfloats[i+3][0], dbfloats[i+3][1]);
804 }
805 db_printf("FCR: %08X %08X\n", dbfloats[32][0], dbfloats[32][1]); /* Print FSCR */
806
807 if(!stVectors(dbvecs)) return; /* Return if not Altivec capable */
808
809 db_printf("\n");
810
811 for(i = 0; i < 32; i += 2) { /* Print 2 at a time */
812 db_printf("V%02d: %08X %08X %08X %08X %08X %08X %08X %08X\n", i,
813 dbvecs[i][0], dbvecs[i][1], dbvecs[i][2], dbvecs[i][3],
814 dbvecs[i+1][0], dbvecs[i+1][1], dbvecs[i+1][2], dbvecs[i+1][3]);
815 }
816 db_printf("VCR: %08X %08X %08X %08X\n", dbvecs[32][0], dbvecs[32][1], dbvecs[32][2], dbvecs[32][3]); /* Print VSCR */
817
818 return; /* Tell them we did it */
819
820
821 }
822
823 /*
824 * Check check mappings and hash table for consistency
825 *
826 * cm
827 */
828 void db_check_mappings(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
829
830 addr64_t pteg, pca, llva, lnextva;
831 unsigned int xpteg[32], xpca[8], space, hash, pva, seg, api, va, free, free2, xauto, PTEGcnt, wimgkk, wimgxx, slotoff;
832 int i, j, fnderr, slot, slot2, k, s4bit;
833 pmap_t pmap;
834 mapping *mp;
835 ppnum_t ppn, pa, aoff;
836 unsigned long long llslot, llseg, llhash;
837
838 s4bit = 0; /* Assume dinky? */
839 if(per_proc_info[0].pf.Available & pf64Bit) s4bit = 1; /* Are we a big guy? */
840
841 PTEGcnt = hash_table_size / 64; /* Get the number of PTEGS */
842 if(s4bit) PTEGcnt = PTEGcnt / 2; /* PTEGs are twice as big */
843
844 pteg = hash_table_base; /* Start of hash table */
845 pca = hash_table_base - 4; /* Start of PCA */
846
847 for(i = 0; i < PTEGcnt; i++) { /* Step through them all */
848
849 fnderr = 0;
850
851 ReadReal(pteg, &xpteg[0]); /* Get first half of the pteg */
852 ReadReal(pteg + 0x20, &xpteg[8]); /* Get second half of the pteg */
853 if(s4bit) { /* See if we need the other half */
854 ReadReal(pteg + 0x40, &xpteg[16]); /* Get third half of the pteg */
855 ReadReal(pteg + 0x60, &xpteg[24]); /* Get fourth half of the pteg */
856 }
857 ReadReal(pca, &xpca[0]); /* Get pca */
858
859 if(xpca[0] & 0x00000001) { /* Is PCA locked? */
860 db_printf("Unexpected locked PCA\n"); /* Yeah, this may be bad */
861 fnderr = 1; /* Remember to print the pca/pteg pair later */
862 }
863
864 free = 0x80000000;
865
866 for(j = 0; j < 7; j++) { /* Search for duplicates */
867 slot = j * 2; /* Point to the slot */
868 if(s4bit) slot = slot * 2; /* Adjust for bigger slots */
869 if(!(xpca[0] & free)) { /* Check more if slot is allocated */
870 for(k = j + 1; k < 8; k++) { /* Search remaining slots */
871 slot2 = k * 2; /* Point to the slot */
872 if(s4bit) slot2 = slot2 * 2; /* Adjust for bigger slots */
873 if((xpteg[slot] == xpteg[slot2])
874 && (!s4bit || (xpteg[slot + 1] == xpteg[slot2 + 1]))) { /* Do we have duplicates? */
875 db_printf("Duplicate tags in pteg, slot %d and slot %d\n", j, k);
876 fnderr = 1;
877 }
878 }
879 }
880 free = free >> 1; /* Move slot over */
881 }
882
883 free = 0x80000000;
884 xauto = 0x00008000;
885
886 for(j = 0; j < 8; j++) { /* Step through the slots */
887
888 slot = j * 2; /* Point to the slot */
889 if(s4bit) slot = slot * 2; /* Hagfish? */
890 if(xpca[0] & free) { /* Check if marked free */
891 if((!s4bit && (xpteg[slot] & 0x80000000)) /* Is a supposedly free slot valid? */
892 || (s4bit && (xpteg[slot + 1] & 1))) {
893 db_printf("Free slot still valid - %d\n", j);
894 fnderr = 1;
895 }
896 }
897 else { /* We have an in use slot here */
898
899 if(!(!s4bit && (xpteg[slot] & 0x80000000)) /* Is a supposedly in use slot valid? */
900 && !(s4bit && (xpteg[slot + 1] & 1))) {
901 db_printf("Inuse slot not valid - %d\n", j);
902 fnderr = 1;
903 }
904 else { /* Slot is valid, check mapping */
905 if(!s4bit) { /* Not Hagfish? */
906 space = (xpteg[slot] >> 7) & (maxAdrSp - 1); /* Extract the space */
907 hash = space | (space << maxAdrSpb) | (space << (2 * maxAdrSpb)); /* Get the hash */
908 pva = i ^ hash; /* Get part of the vaddr */
909 seg = (xpteg[slot] >> 7) ^ hash; /* Get the segment number */
910 api = (xpteg[slot] & 0x3F); /* Get the API */
911 va = ((seg << (28 - maxAdrSpb)) & 0xF0000000) | (api << 22) | ((pva << 12) & 0x003FF000); /* Get the vaddr */
912 llva = (addr64_t)va; /* Make this a long long */
913 wimgxx = xpteg[slot + 1] & 0x7F; /* Get the wimg and pp */
914 ppn = xpteg[slot + 1] >> 12; /* Get physical page number */
915 slotoff = (i * 64) + (j * 8) | 1; /* Get offset to slot and valid bit */
916 }
917 else { /* Yes, Hagfish */
918 llslot = ((long long)xpteg[slot] << 32) | (long long)xpteg[slot + 1]; /* Make a long long version of this */
919 space = (llslot >> 12) & (maxAdrSp - 1); /* Extract the space */
920 llhash = (unsigned long long)space | ((unsigned long long)space << maxAdrSpb) | ((unsigned long long)space << (2 * maxAdrSpb)); /* Get the hash */
921 llhash = llhash & 0x0000001FFFFFFFFF; /* Make sure we stay within supported ranges */
922 pva = i ^ llhash; /* Get part of the vaddr */
923 llseg = ((llslot >> 12) ^ llhash); /* Get the segment number */
924 api = (llslot >> 7) & 0x1F; /* Get the API */
925 llva = ((llseg << (28 - maxAdrSpb)) & 0xFFFFFFFFF0000000ULL) | (api << 23) | ((pva << 12) & 0x007FF000); /* Get the vaddr */
926 wimgxx = xpteg[slot + 3] & 0x7F; /* Get the wimg and pp */
927 ppn = (xpteg[slot + 2] << 20) | (xpteg[slot + 3] >> 12); /* Get physical page number */
928 slotoff = (i * 128) + (j * 16) | 1; /* Get offset to slot and valid bit */
929 }
930
931 pmap = pmapTrans[space].pmapVAddr; /* Find the pmap address */
932 if(!pmap) { /* The pmap is not in use */
933 db_printf("The space %08X is not assigned to a pmap, slot = %d\n", space, slot); /* Say we are wrong */
934 fnderr = 1;
935 goto dcmout;
936 }
937
938 mp = hw_find_map(pmap, llva, &lnextva); /* Try to find the mapping for this address */
939 // db_printf("%08X - %017llX\n", mp, llva);
940 if((unsigned int)mp == mapRtBadLk) { /* Did we lock up ok? */
941 db_printf("Timeout locking mapping for for virtual address %016ll8X, slot = %d\n", llva, j);
942 return;
943 }
944
945 if(!mp) { /* Did we find one? */
946 db_printf("Not mapped, slot = %d, va = %08X\n", j, (unsigned int)llva);
947 fnderr = 1;
948 goto dcmout;
949 }
950
951 if((mp->mpFlags & 0xFF000000) > 0x01000000) { /* Is busy count too high? */
952 db_printf("Busy count too high, slot = %d\n", j);
953 fnderr = 1;
954 }
955
956 if(mp->mpFlags & mpBlock) { /* Is this a block map? */
957 if(!(xpca[0] & xauto)) { /* Is it marked as such? */
958 db_printf("mapping marked as block, PCA is not, slot = %d\n", j);
959 fnderr = 1;
960 }
961 }
962 else { /* Is a block */
963 if(xpca[0] & xauto) { /* Is it marked as such? */
964 db_printf("mapping not marked as block, PCA is, slot = %d\n", j);
965 fnderr = 1;
966 }
967 if(mp->mpPte != slotoff) { /* See if mapping PTEG offset is us */
968 db_printf("mapping does not point to PTE, slot = %d\n", j);
969 fnderr = 1;
970 }
971 }
972
973 wimgkk = (unsigned int)mp->mpVAddr; /* Get last half of vaddr where keys, etc are */
974 wimgkk = (wimgkk ^ wimgxx) & 0x7F; /* XOR to find differences from PTE */
975 if(wimgkk) { /* See if key in PTE is what we want */
976 db_printf("key or WIMG does not match, slot = %d\n", j);
977 fnderr = 1;
978 }
979
980 aoff = (ppnum_t)((llva >> 12) - (mp->mpVAddr >> 12)); /* Get the offset from vaddr */
981 pa = aoff + mp->mpPAddr; /* Get the physical page number we expect */
982 if(pa != ppn) { /* Is physical address expected? */
983 db_printf("Physical address does not match, slot = %d\n", j);
984 fnderr = 1;
985 }
986
987 mapping_drop_busy(mp); /* We're done with the mapping */
988 }
989
990 }
991 dcmout:
992 free = free >> 1;
993 xauto = xauto >> 1;
994 }
995
996
997 if(fnderr)db_dumppca(i); /* Print if error */
998
999 pteg = pteg + 64; /* Go to the next one */
1000 if(s4bit) pteg = pteg + 64; /* Hagfish? */
1001 pca = pca - 4; /* Go to the next one */
1002
1003
1004 }
1005
1006 return;
1007 }
1008
1009 /*
1010 * Displays all of the kmods in the system.
1011 *
1012 * dp
1013 */
1014 void db_display_kmod(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
1015
1016 kmod_info_t *kmd;
1017 unsigned int strt, end;
1018
1019 kmd = kmod; /* Start at the start */
1020
1021 db_printf("info addr start - end name ver\n");
1022
1023 while(kmd) { /* Dump 'em all */
1024 strt = (unsigned int)kmd->address + kmd->hdr_size; /* Get start of kmod text */
1025 end = (unsigned int)kmd->address + kmd->size; /* Get end of kmod */
1026 db_printf("%08X %08X %08X - %08X: %s, %s\n", kmd, kmd->address, strt, end,
1027 kmd->name, kmd->version);
1028 kmd = kmd->next; /* Step to it */
1029 }
1030
1031 return;
1032 }
1033
1034 /*
1035 * Displays stuff
1036 *
1037 * gs
1038 */
1039 unsigned char xxgpo[36] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
1040
1041 void db_gsnoop(db_expr_t addr, int have_addr, db_expr_t count, char * modif) {
1042
1043 int i, j;
1044 unsigned char *gp, gpn[36];
1045 #define ngpr 34
1046
1047 gp = (unsigned char *)0x8000005C;
1048
1049 for(i = 0; i < ngpr; i++) gpn[i] = gp[i]; /* Copy 'em */
1050
1051 for(i = 0; i < ngpr; i++) {
1052 db_printf("%02X ", gpn[i]);
1053 }
1054 db_printf("\n");
1055
1056 for(i = 0; i < ngpr; i++) {
1057 if(gpn[i] != xxgpo[i]) db_printf("^^ ");
1058 else db_printf(" ");
1059 }
1060 db_printf("\n");
1061
1062 for(i = 0; i < ngpr; i++) xxgpo[i] = gpn[i]; /* Save 'em */
1063
1064 return;
1065 }
1066
1067
1068 void Dumbo(void);
1069 void Dumbo(void){
1070 }