]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kdp/ml/ppc/kdp_machdep.c
xnu-792.12.6.tar.gz
[apple/xnu.git] / osfmk / kdp / ml / ppc / kdp_machdep.c
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30
31 #include <mach/mach_types.h>
32 #include <mach/exception_types.h>
33 #include <ppc/exception.h>
34 #include <ppc/proc_reg.h>
35 #include <kdp/kdp_internal.h>
36 #include <ppc/savearea.h>
37 #include <kern/debug.h>
38 #include <IOKit/IOPlatformExpert.h>
39
40 #define KDP_TEST_HARNESS 0
41 #if KDP_TEST_HARNESS
42 #define dprintf(x) kprintf x
43 #else
44 #define dprintf(x)
45 #endif
46
47 void print_saved_state(void *);
48 void kdp_call(void);
49 void kdp_trap( unsigned int, struct savearea *saved_state);
50 int kdp_getc(void);
51 boolean_t kdp_call_kdb(void);
52
53 void
54 kdp_exception(
55 unsigned char *pkt,
56 int *len,
57 unsigned short *remote_port,
58 unsigned int exception,
59 unsigned int code,
60 unsigned int subcode
61 )
62 {
63 struct {
64 kdp_exception_t pkt;
65 kdp_exc_info_t exc;
66 } aligned_pkt;
67 kdp_exception_t *rq = (kdp_exception_t *)&aligned_pkt;
68
69 bcopy((char *)pkt, (char *)rq, sizeof(*rq));
70 rq->hdr.request = KDP_EXCEPTION;
71 rq->hdr.is_reply = 0;
72 rq->hdr.seq = kdp.exception_seq;
73 rq->hdr.key = 0;
74 rq->hdr.len = sizeof (*rq) + sizeof(kdp_exc_info_t);
75
76 rq->n_exc_info = 1;
77 rq->exc_info[0].cpu = 0;
78 rq->exc_info[0].exception = exception;
79 rq->exc_info[0].code = code;
80 rq->exc_info[0].subcode = subcode;
81
82 rq->hdr.len += rq->n_exc_info * sizeof (kdp_exc_info_t);
83
84 bcopy((char *)rq, (char *)pkt, rq->hdr.len);
85
86 kdp.exception_ack_needed = TRUE;
87
88 *remote_port = kdp.exception_port;
89 *len = rq->hdr.len;
90 }
91
92 boolean_t
93 kdp_exception_ack(
94 unsigned char *pkt,
95 int len
96 )
97 {
98 kdp_exception_ack_t aligned_pkt;
99 kdp_exception_ack_t *rq = (kdp_exception_ack_t *)&aligned_pkt;
100
101 if (len < sizeof (*rq))
102 return(FALSE);
103
104 bcopy((char *)pkt, (char *)rq, sizeof(*rq));
105
106 if (!rq->hdr.is_reply || rq->hdr.request != KDP_EXCEPTION)
107 return(FALSE);
108
109 dprintf(("kdp_exception_ack seq %x %x\n", rq->hdr.seq, kdp.exception_seq));
110
111 if (rq->hdr.seq == kdp.exception_seq) {
112 kdp.exception_ack_needed = FALSE;
113 kdp.exception_seq++;
114 }
115 return(TRUE);
116 }
117
118 static void
119 kdp_getintegerstate(
120 struct ppc_thread_state *state
121 )
122 {
123 struct savearea *saved_state;
124
125 saved_state = kdp.saved_state;
126
127 bzero((char *)state,sizeof (struct ppc_thread_state)) ;
128
129 state->srr0 = (unsigned int)saved_state->save_srr0;
130 state->srr1 = (unsigned int)saved_state->save_srr1;
131 state->r0 = (unsigned int)saved_state->save_r0;
132 state->r1 = (unsigned int)saved_state->save_r1;
133 state->r2 = (unsigned int)saved_state->save_r2;
134 state->r3 = (unsigned int)saved_state->save_r3;
135 state->r4 = (unsigned int)saved_state->save_r4;
136 state->r5 = (unsigned int)saved_state->save_r5;
137 state->r6 = (unsigned int)saved_state->save_r6;
138 state->r7 = (unsigned int)saved_state->save_r7;
139 state->r8 = (unsigned int)saved_state->save_r8;
140 state->r9 = (unsigned int)saved_state->save_r9;
141 state->r10 = (unsigned int)saved_state->save_r10;
142 state->r11 = (unsigned int)saved_state->save_r11;
143 state->r12 = (unsigned int)saved_state->save_r12;
144 state->r13 = (unsigned int)saved_state->save_r13;
145 state->r14 = (unsigned int)saved_state->save_r14;
146 state->r15 = (unsigned int)saved_state->save_r15;
147 state->r16 = (unsigned int)saved_state->save_r16;
148 state->r17 = (unsigned int)saved_state->save_r17;
149 state->r18 = (unsigned int)saved_state->save_r18;
150 state->r19 = (unsigned int)saved_state->save_r19;
151 state->r20 = (unsigned int)saved_state->save_r20;
152 state->r21 = (unsigned int)saved_state->save_r21;
153 state->r22 = (unsigned int)saved_state->save_r22;
154 state->r23 = (unsigned int)saved_state->save_r23;
155 state->r24 = (unsigned int)saved_state->save_r24;
156 state->r25 = (unsigned int)saved_state->save_r25;
157 state->r26 = (unsigned int)saved_state->save_r26;
158 state->r27 = (unsigned int)saved_state->save_r27;
159 state->r28 = (unsigned int)saved_state->save_r28;
160 state->r29 = (unsigned int)saved_state->save_r29;
161 state->r30 = (unsigned int)saved_state->save_r30;
162 state->r31 = (unsigned int)saved_state->save_r31;
163 state->cr = (unsigned int)saved_state->save_cr;
164 state->xer = (unsigned int)saved_state->save_xer;
165 state->lr = (unsigned int)saved_state->save_lr;
166 state->ctr = (unsigned int)saved_state->save_ctr;
167 }
168
169 static void
170 kdp_getintegerstate64(
171 struct ppc_thread_state64 *state
172 )
173 {
174 struct savearea *saved_state;
175
176 saved_state = kdp.saved_state;
177
178 bzero((char *)state,sizeof (struct ppc_thread_state64)) ;
179
180 state->srr0 = saved_state->save_srr0;
181 state->srr1 = saved_state->save_srr1;
182 state->r0 = saved_state->save_r0;
183 state->r1 = saved_state->save_r1;
184 state->r2 = saved_state->save_r2;
185 state->r3 = saved_state->save_r3;
186 state->r4 = saved_state->save_r4;
187 state->r5 = saved_state->save_r5;
188 state->r6 = saved_state->save_r6;
189 state->r7 = saved_state->save_r7;
190 state->r8 = saved_state->save_r8;
191 state->r9 = saved_state->save_r9;
192 state->r10 = saved_state->save_r10;
193 state->r11 = saved_state->save_r11;
194 state->r12 = saved_state->save_r12;
195 state->r13 = saved_state->save_r13;
196 state->r14 = saved_state->save_r14;
197 state->r15 = saved_state->save_r15;
198 state->r16 = saved_state->save_r16;
199 state->r17 = saved_state->save_r17;
200 state->r18 = saved_state->save_r18;
201 state->r19 = saved_state->save_r19;
202 state->r20 = saved_state->save_r20;
203 state->r21 = saved_state->save_r21;
204 state->r22 = saved_state->save_r22;
205 state->r23 = saved_state->save_r23;
206 state->r24 = saved_state->save_r24;
207 state->r25 = saved_state->save_r25;
208 state->r26 = saved_state->save_r26;
209 state->r27 = saved_state->save_r27;
210 state->r28 = saved_state->save_r28;
211 state->r29 = saved_state->save_r29;
212 state->r30 = saved_state->save_r30;
213 state->r31 = saved_state->save_r31;
214 state->cr = saved_state->save_cr;
215 state->xer = saved_state->save_xer;
216 state->lr = saved_state->save_lr;
217 state->ctr = saved_state->save_ctr;
218 }
219
220 kdp_error_t
221 kdp_machine_read_regs(
222 unsigned int cpu,
223 unsigned int flavor,
224 char *data,
225 int *size
226 )
227 {
228 switch (flavor) {
229
230 case PPC_THREAD_STATE:
231 dprintf(("kdp_readregs THREAD_STATE\n"));
232 kdp_getintegerstate((struct ppc_thread_state *)data);
233 *size = PPC_THREAD_STATE_COUNT * sizeof(int);
234 return KDPERR_NO_ERROR;
235
236 case PPC_THREAD_STATE64:
237 dprintf(("kdp_readregs THREAD_STATE\n"));
238 kdp_getintegerstate64((struct ppc_thread_state64 *)data);
239 *size = PPC_THREAD_STATE64_COUNT * sizeof(int);
240 return KDPERR_NO_ERROR;
241
242 case PPC_FLOAT_STATE:
243 dprintf(("kdp_readregs THREAD_FPSTATE\n"));
244 bzero((char *)data ,sizeof(struct ppc_float_state));
245 *size = PPC_FLOAT_STATE_COUNT * sizeof(int);
246 return KDPERR_NO_ERROR;
247
248 default:
249 dprintf(("kdp_readregs bad flavor %d\n"));
250 return KDPERR_BADFLAVOR;
251 }
252 }
253
254 static void
255 kdp_setintegerstate(
256 struct ppc_thread_state *state
257 )
258 {
259 struct savearea *saved_state;
260
261 saved_state = kdp.saved_state;
262
263 saved_state->save_srr0 = state->srr0;
264 saved_state->save_srr1 = state->srr1;
265 saved_state->save_r0 = state->r0;
266 saved_state->save_r1 = state->r1;
267 saved_state->save_r2 = state->r2;
268 saved_state->save_r3 = state->r3;
269 saved_state->save_r4 = state->r4;
270 saved_state->save_r5 = state->r5;
271 saved_state->save_r6 = state->r6;
272 saved_state->save_r7 = state->r7;
273 saved_state->save_r8 = state->r8;
274 saved_state->save_r9 = state->r9;
275 saved_state->save_r10 = state->r10;
276 saved_state->save_r11 = state->r11;
277 saved_state->save_r12 = state->r12;
278 saved_state->save_r13 = state->r13;
279 saved_state->save_r14 = state->r14;
280 saved_state->save_r15 = state->r15;
281 saved_state->save_r16 = state->r16;
282 saved_state->save_r17 = state->r17;
283 saved_state->save_r18 = state->r18;
284 saved_state->save_r19 = state->r19;
285 saved_state->save_r20 = state->r20;
286 saved_state->save_r21 = state->r21;
287 saved_state->save_r22 = state->r22;
288 saved_state->save_r23 = state->r23;
289 saved_state->save_r24 = state->r24;
290 saved_state->save_r25 = state->r25;
291 saved_state->save_r26 = state->r26;
292 saved_state->save_r27 = state->r27;
293 saved_state->save_r28 = state->r28;
294 saved_state->save_r29 = state->r29;
295 saved_state->save_r30 = state->r30;
296 saved_state->save_r31 = state->r31;
297 saved_state->save_cr = state->cr;
298 saved_state->save_xer = state->xer;
299 saved_state->save_lr = state->lr;
300 saved_state->save_ctr = state->ctr;
301 }
302
303 static void
304 kdp_setintegerstate64(
305 struct ppc_thread_state64 *state
306 )
307 {
308 struct savearea *saved_state;
309
310 saved_state = kdp.saved_state;
311
312 saved_state->save_srr0 = state->srr0;
313 saved_state->save_srr1 = state->srr1;
314 saved_state->save_r0 = state->r0;
315 saved_state->save_r1 = state->r1;
316 saved_state->save_r2 = state->r2;
317 saved_state->save_r3 = state->r3;
318 saved_state->save_r4 = state->r4;
319 saved_state->save_r5 = state->r5;
320 saved_state->save_r6 = state->r6;
321 saved_state->save_r7 = state->r7;
322 saved_state->save_r8 = state->r8;
323 saved_state->save_r9 = state->r9;
324 saved_state->save_r10 = state->r10;
325 saved_state->save_r11 = state->r11;
326 saved_state->save_r12 = state->r12;
327 saved_state->save_r13 = state->r13;
328 saved_state->save_r14 = state->r14;
329 saved_state->save_r15 = state->r15;
330 saved_state->save_r16 = state->r16;
331 saved_state->save_r17 = state->r17;
332 saved_state->save_r18 = state->r18;
333 saved_state->save_r19 = state->r19;
334 saved_state->save_r20 = state->r20;
335 saved_state->save_r21 = state->r21;
336 saved_state->save_r22 = state->r22;
337 saved_state->save_r23 = state->r23;
338 saved_state->save_r24 = state->r24;
339 saved_state->save_r25 = state->r25;
340 saved_state->save_r26 = state->r26;
341 saved_state->save_r27 = state->r27;
342 saved_state->save_r28 = state->r28;
343 saved_state->save_r29 = state->r29;
344 saved_state->save_r30 = state->r30;
345 saved_state->save_r31 = state->r31;
346 saved_state->save_cr = state->cr;
347 saved_state->save_xer = state->xer;
348 saved_state->save_lr = state->lr;
349 saved_state->save_ctr = state->ctr;
350 }
351
352 kdp_error_t
353 kdp_machine_write_regs(
354 unsigned int cpu,
355 unsigned int flavor,
356 char *data,
357 int *size
358 )
359 {
360 switch (flavor) {
361
362 case PPC_THREAD_STATE:
363 dprintf(("kdp_writeregs THREAD_STATE\n"));
364 kdp_setintegerstate((struct ppc_thread_state *)data);
365
366 #if KDP_TEST_HARNESS
367 DumpTheSave((struct savearea *)data); /* (TEST/DEBUG) */
368 #endif
369 return KDPERR_NO_ERROR;
370
371 case PPC_THREAD_STATE64:
372 dprintf(("kdp_writeregs THREAD_STATE64\n"));
373 kdp_setintegerstate64((struct ppc_thread_state64 *)data);
374
375 #if KDP_TEST_HARNESS
376 DumpTheSave((struct savearea *)data); /* (TEST/DEBUG) */
377 #endif
378 return KDPERR_NO_ERROR;
379 case PPC_FLOAT_STATE:
380 dprintf(("kdp_writeregs THREAD_FPSTATE\n"));
381 return KDPERR_NO_ERROR;
382
383 default:
384 dprintf(("kdp_writeregs bad flavor %d\n"));
385 return KDPERR_BADFLAVOR;
386 }
387 }
388
389 void
390 kdp_machine_hostinfo(
391 kdp_hostinfo_t *hostinfo
392 )
393 {
394 int i;
395
396 hostinfo->cpus_mask = 0;
397 hostinfo->cpu_type = 0;
398
399 for (i = 0; i < machine_info.max_cpus; i++) {
400 if ((PerProcTable[i].ppe_vaddr == (struct per_proc_info *)NULL) ||
401 !(PerProcTable[i].ppe_vaddr->running))
402 continue;
403
404 hostinfo->cpus_mask |= (1 << i);
405 if (hostinfo->cpu_type == 0) {
406 hostinfo->cpu_type = slot_type(i);
407 hostinfo->cpu_subtype = slot_subtype(i);
408 }
409 }
410 }
411
412 void
413 kdp_panic(
414 const char *msg
415 )
416 {
417 printf("kdp panic: %s\n", msg);
418 while(1) {}
419 }
420
421
422 void
423 kdp_reboot(void)
424 {
425 printf("Attempting system restart...");
426 /* Call the platform specific restart*/
427 if (PE_halt_restart)
428 (*PE_halt_restart)(kPERestartCPU);
429 /* If we do reach this, give up */
430 halt_all_cpus(TRUE);
431 }
432
433 int
434 kdp_intr_disbl(void)
435 {
436 return (splhigh());
437 }
438
439 void
440 kdp_intr_enbl(int s)
441 {
442 splx(s);
443 }
444
445 void
446 kdp_us_spin(int usec)
447 {
448 extern void delay(int);
449
450 delay(usec/100);
451 }
452
453 void print_saved_state(void *state)
454 {
455 struct ppc_thread_state *saved_state;
456
457 saved_state = state;
458
459 printf("pc = 0x%x\n", saved_state->srr0);
460 printf("msr = 0x%x\n", saved_state->srr1);
461 printf("rp = 0x%x\n", saved_state->lr);
462 printf("sp = 0x%x\n", saved_state->r1);
463
464 }
465
466 void
467 kdp_call()
468 {
469 Debugger("inline call to debugger(machine_startup)");
470 }
471
472 /*
473 * table to convert system specific code to generic codes for kdb
474 */
475 int kdp_trap_codes[] = {
476 EXC_BAD_ACCESS, /* 0x0000 INVALID EXCEPTION */
477 EXC_BAD_ACCESS, /* 0x0100 System reset */
478 EXC_BAD_ACCESS, /* 0x0200 Machine check */
479 EXC_BAD_ACCESS, /* 0x0300 Data access */
480 EXC_BAD_ACCESS, /* 0x0400 Instruction access */
481 EXC_BAD_ACCESS, /* 0x0500 External interrupt */
482 EXC_BAD_ACCESS, /* 0x0600 Alignment */
483 EXC_BREAKPOINT, /* 0x0700 Program - fp exc, ill/priv instr, trap */
484 EXC_ARITHMETIC, /* 0x0800 Floating point disabled */
485 EXC_SOFTWARE, /* 0x0900 Decrementer */
486 EXC_BAD_ACCESS, /* 0x0A00 I/O controller interface */
487 EXC_BAD_ACCESS, /* 0x0B00 INVALID EXCEPTION */
488 EXC_SOFTWARE, /* 0x0C00 System call exception */
489 EXC_BREAKPOINT, /* 0x0D00 Trace */
490 EXC_SOFTWARE, /* 0x0E00 FP assist */
491 EXC_SOFTWARE, /* 0x0F00 Performance monitoring */
492 EXC_ARITHMETIC, /* 0x0F20 Altivec disabled */
493 EXC_BAD_ACCESS, /* 0x1000 Instruction PTE miss */
494 EXC_BAD_ACCESS, /* 0x1100 Data load PTE miss */
495 EXC_BAD_ACCESS, /* 0x1200 Data store PTE miss */
496 EXC_BREAKPOINT, /* 0x1300 Instruction bkpt */
497 EXC_SOFTWARE, /* 0x1400 System management */
498 EXC_BAD_ACCESS, /* 0x1500 INVALID EXCEPTION */
499 EXC_ARITHMETIC, /* 0x1600 Altivec Assist */
500 EXC_BAD_ACCESS, /* 0x1700 INVALID EXCEPTION */
501 EXC_BAD_ACCESS, /* 0x1800 INVALID EXCEPTION */
502 EXC_BAD_ACCESS, /* 0x1900 INVALID EXCEPTION */
503 EXC_BAD_ACCESS, /* 0x1A00 INVALID EXCEPTION */
504 EXC_BAD_ACCESS, /* 0x1B00 INVALID EXCEPTION */
505 EXC_BAD_ACCESS, /* 0x1C00 INVALID EXCEPTION */
506 EXC_BAD_ACCESS, /* 0x1D00 INVALID EXCEPTION */
507 EXC_BAD_ACCESS, /* 0x1E00 INVALID EXCEPTION */
508 EXC_BAD_ACCESS, /* 0x1F00 INVALID EXCEPTION */
509 EXC_BREAKPOINT, /* 0x2000 Run Mode/Trace */
510 EXC_BAD_ACCESS, /* 0x2100 INVALID EXCEPTION */
511 EXC_BAD_ACCESS, /* 0x2200 INVALID EXCEPTION */
512 EXC_BAD_ACCESS, /* 0x2300 INVALID EXCEPTION */
513 EXC_BAD_ACCESS, /* 0x2400 INVALID EXCEPTION */
514 EXC_BAD_ACCESS, /* 0x2500 INVALID EXCEPTION */
515 EXC_BAD_ACCESS, /* 0x2600 INVALID EXCEPTION */
516 EXC_BAD_ACCESS, /* 0x2700 INVALID EXCEPTION */
517 EXC_BAD_ACCESS, /* 0x2800 INVALID EXCEPTION */
518 EXC_BAD_ACCESS, /* 0x2900 INVALID EXCEPTION */
519 EXC_BAD_ACCESS, /* 0x2A00 INVALID EXCEPTION */
520 EXC_BAD_ACCESS, /* 0x2B00 INVALID EXCEPTION */
521 EXC_BAD_ACCESS, /* 0x2C00 INVALID EXCEPTION */
522 EXC_BAD_ACCESS, /* 0x2D00 INVALID EXCEPTION */
523 EXC_BAD_ACCESS, /* 0x2E00 INVALID EXCEPTION */
524 EXC_BAD_ACCESS, /* 0x2F00 INVALID EXCEPTION */
525 EXC_SOFTWARE /* 0x3000 AST trap (software) */
526 };
527
528 int
529 kdp_getc()
530 {
531 return(cnmaygetc());
532 }
533
534 int kdp_backtrace;
535 int kdp_sr_dump;
536 int kdp_dabr;
537 int kdp_noisy;
538
539 #define kdp_code(x) kdp_trap_codes[((x)==T_AST?0x31:(x)/T_VECTOR_SIZE)]
540
541 void
542 kdp_trap(
543 unsigned int exception,
544 struct savearea *saved_state
545 )
546 {
547 unsigned int *fp;
548 unsigned int sp;
549 struct savearea *state;
550
551 if (kdp_noisy) {
552 if (kdp_backtrace) {
553 printf("\nvector=%x, \n", exception/4);
554 sp = saved_state->save_r1;
555 printf("stack backtrace - sp(%x) ", sp);
556 fp = (unsigned int *) *((unsigned int *)sp);
557 while (fp) {
558 printf("0x%08x ", fp[2]);
559 fp = (unsigned int *)*fp;
560 }
561 printf("\n");
562 }
563 #ifdef XXX
564 if (kdp_sr_dump) {
565 dump_segment_registers();
566 }
567 #endif
568
569 printf("vector=%d ", exception/4);
570 }
571 kdp_raise_exception(kdp_code(exception), 0, 0, saved_state);
572
573 if (kdp_noisy)
574 printf("kdp_trap: kdp_raise_exception() ret\n");
575
576 if ((unsigned int)(saved_state->save_srr0) == 0x7c800008)
577 saved_state->save_srr0 += 4; /* BKPT_SIZE */
578
579 if(saved_state->save_srr1 & (MASK(MSR_SE) | MASK(MSR_BE))) { /* Are we just stepping or continuing */
580 db_run_mode = STEP_ONCE; /* We are stepping */
581 }
582 else db_run_mode = STEP_CONTINUE; /* Otherwise we are continuing */
583
584 #ifdef XXX
585 mtspr(dabr, kdp_dabr);
586 #endif
587 }
588
589 boolean_t
590 kdp_call_kdb(
591 void)
592 {
593 switch_debugger=1;
594 return(TRUE);
595 }
596
597 void kdp_print_registers(struct savearea *state)
598 {
599 int i;
600 for (i=0; i<32; i++) {
601 if ((i % 8) == 0)
602 printf("\n%4d :",i);
603 printf(" %08x",*(&state->save_r0+i));
604 }
605 printf("\n");
606 printf("cr = 0x%08x\t\t",state->save_cr);
607 printf("xer = 0x%08x\n",state->save_xer);
608 printf("lr = 0x%08x\t\t",state->save_lr);
609 printf("ctr = 0x%08x\n",state->save_ctr);
610 printf("srr0(iar) = 0x%08x\t\t",state->save_srr0);
611 printf("srr1(msr) = 0x%08B\n",state->save_srr1,
612 "\x10\x11""EE\x12PR\x13""FP\x14ME\x15""FE0\x16SE\x18"
613 "FE1\x19""AL\x1a""EP\x1bIT\x1c""DT");
614 printf("\n");
615 }
616
617 void
618 kdp_print_backtrace(
619 unsigned int exception,
620 struct savearea *saved_state)
621 {
622 extern void kdp_print_registers(struct savearea *);
623 extern void print_backtrace(struct savearea *);
624
625 disableDebugOuput = FALSE;
626 debug_mode = TRUE;
627 printf("re-entering kdp:\n");
628 printf("vector=%x, \n", exception/4);
629 kdp_print_registers(saved_state);
630 print_backtrace(saved_state);
631 printf("panic: We are hanging here...\n");
632 while(1);
633 }
634
635 unsigned int kdp_ml_get_breakinsn(void)
636 {
637 return 0x7fe00008;
638 }