Module Name: src Committed By: matt Date: Wed Aug 1 21:30:25 UTC 2012
Modified Files: src/sys/arch/powerpc/booke: booke_machdep.c e500_intr.c trap.c src/sys/arch/powerpc/include/booke: cpuvar.h src/sys/arch/powerpc/powerpc: db_interface.c Log Message: Add a machine splhist command to give (a incomplete) spl history. (only the most recent are going to be accurate). splraise(6) from 0 at 549214603 splraise(7) from 6 at 549214643 (+40) splx(6) from 7 at 549214691 (+48) splx(0) from 6 at 549214730 (+39) To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/booke/booke_machdep.c cvs rdiff -u -r1.20 -r1.21 src/sys/arch/powerpc/booke/e500_intr.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/powerpc/booke/trap.c cvs rdiff -u -r1.15 -r1.16 src/sys/arch/powerpc/include/booke/cpuvar.h cvs rdiff -u -r1.50 -r1.51 src/sys/arch/powerpc/powerpc/db_interface.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/powerpc/booke/booke_machdep.c diff -u src/sys/arch/powerpc/booke/booke_machdep.c:1.15 src/sys/arch/powerpc/booke/booke_machdep.c:1.16 --- src/sys/arch/powerpc/booke/booke_machdep.c:1.15 Wed Jul 18 18:51:59 2012 +++ src/sys/arch/powerpc/booke/booke_machdep.c Wed Aug 1 21:30:21 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: booke_machdep.c,v 1.15 2012/07/18 18:51:59 matt Exp $ */ +/* $NetBSD: booke_machdep.c,v 1.16 2012/08/01 21:30:21 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -38,7 +38,7 @@ #define _POWERPC_BUS_DMA_PRIVATE #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.15 2012/07/18 18:51:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: booke_machdep.c,v 1.16 2012/08/01 21:30:21 matt Exp $"); #include "opt_modular.h" @@ -570,3 +570,102 @@ booke_sstep(struct trapframe *tf) mtspr(SPR_DBCR1, dbcr1); mtspr(SPR_DBCR0, dbcr0); } + +#ifdef DIAGNOSTIC +static inline void +swap_data(uint64_t *data, size_t a, size_t b) +{ + uint64_t swap = data[a]; + data[a] = data[b]; + data[b] = swap; +} + +static void +sort_data(uint64_t *data, size_t count) +{ +#if 0 + /* + * Mostly classic bubble sort + */ + do { + size_t new_count = 0; + for (size_t i = 1; i < count; i++) { + if (tbs[i - 1] > tbs[i]) { + swap_tbs(tbs, i - 1, i); + new_count = i; + } + } + count = new_count; + } while (count > 0); +#else + /* + * Comb sort + */ + size_t gap = count; + bool swapped = false; + while (gap > 1 || swapped) { + if (gap > 1) { + /* + * phi = (1 + sqrt(5)) / 2 [golden ratio] + * N = 1 / (1 - e^-phi)) = 1.247330950103979 + * + * We want to but can't use floating point to calculate + * gap = (size_t)((double)gap / N) + * + * So we will use the multicative inverse of N + * (module 65536) to achieve the division. + * + * iN = 2^16 / 1.24733... = 52540 + * x / N == (x * iN) / 65536 + */ + gap = (gap * 52540) / 65536; + } + + swapped = false; + + for (size_t i = 0; gap + i < count; i++) { + if (data[i] > data[i + gap]) { + swap_data(data, i, i + gap); + swapped = true; + } + } + } +#endif +} +#endif + +void +dump_splhist(struct cpu_info *ci, void (*pr)(const char *, ...)) +{ +#ifdef DIAGNOSTIC + struct cpu_softc * const cpu = ci->ci_softc; + uint64_t tbs[NIPL*NIPL]; + size_t ntbs = 0; + for (size_t to = 0; to < NIPL; to++) { + for (size_t from = 0; from < NIPL; from++) { + uint64_t tb = cpu->cpu_spl_tb[to][from]; + if (tb == 0) + continue; + tbs[ntbs++] = (tb << 8) | (to << 4) | from; + } + } + sort_data(tbs, ntbs); + + if (pr == NULL) + pr = printf; + uint64_t last_tb = 0; + for (size_t i = 0; i < ntbs; i++) { + uint64_t tb = tbs[i]; + size_t from = tb & 15; + size_t to = (tb >> 4) & 15; + tb >>= 8; + (*pr)("%s(%zu) from %zu at %"PRId64"", + from < to ? "splraise" : "splx", + to, from, tb); + if (last_tb && from != IPL_NONE) + (*pr)(" (+%"PRId64")", tb - last_tb); + (*pr)("\n"); + last_tb = tb; + } +#endif +} Index: src/sys/arch/powerpc/booke/e500_intr.c diff -u src/sys/arch/powerpc/booke/e500_intr.c:1.20 src/sys/arch/powerpc/booke/e500_intr.c:1.21 --- src/sys/arch/powerpc/booke/e500_intr.c:1.20 Wed Jul 18 16:45:33 2012 +++ src/sys/arch/powerpc/booke/e500_intr.c Wed Aug 1 21:30:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: e500_intr.c,v 1.20 2012/07/18 16:45:33 matt Exp $ */ +/* $NetBSD: e500_intr.c,v 1.21 2012/08/01 21:30:22 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -39,7 +39,7 @@ #define __INTR_PRIVATE #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.20 2012/07/18 16:45:33 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: e500_intr.c,v 1.21 2012/08/01 21:30:22 matt Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -419,6 +419,8 @@ const struct intrsw e500_intrsw = { #endif }; +static bool wdog_barked; + static inline uint32_t openpic_read(struct cpu_softc *cpu, bus_size_t offset) { @@ -474,21 +476,14 @@ e500_splset(struct cpu_info *ci, int ipl { struct cpu_softc * const cpu = ci->ci_softc; - //KASSERT(!cpu_intr_p() || ipl >= IPL_VM); KASSERT((curlwp->l_pflag & LP_INTR) == 0 || ipl != IPL_NONE); -#if 0 - u_int ctpr = ipl; - KASSERT(openpic_read(cpu, OPENPIC_CTPR) == ci->ci_cpl); -#elif 0 - u_int old_ctpr = (ci->ci_cpl >= IPL_VM ? 15 : ci->ci_cpl); - u_int ctpr = (ipl >= IPL_VM ? 15 : ipl); - KASSERT(openpic_read(cpu, OPENPIC_CTPR) == old_ctpr); -#else const u_int ctpr = IPL2CTPR(ipl); KASSERT(openpic_read(cpu, OPENPIC_CTPR) == IPL2CTPR(ci->ci_cpl)); -#endif openpic_write(cpu, OPENPIC_CTPR, ctpr); KASSERT(openpic_read(cpu, OPENPIC_CTPR) == ctpr); +#ifdef DIAGNOSTIC + cpu->cpu_spl_tb[ipl][ci->ci_cpl] = mftb(); +#endif ci->ci_cpl = ipl; } @@ -502,8 +497,10 @@ e500_spl0(void) #ifdef __HAVE_FAST_SOFTINTS if (__predict_false(ci->ci_data.cpu_softints != 0)) { e500_splset(ci, IPL_HIGH); + wrtee(PSL_EE); powerpc_softint(ci, IPL_NONE, (vaddr_t)__builtin_return_address(0)); + wrtee(0); } #endif /* __HAVE_FAST_SOFTINTS */ e500_splset(ci, IPL_NONE); @@ -518,7 +515,7 @@ e500_splx(int ipl) const int old_ipl = ci->ci_cpl; /* if we paniced because of watchdog, PSL_CE will be clear. */ - KASSERT(panicstr != NULL || (mfmsr() & PSL_CE)); + KASSERT(wdog_barked || (mfmsr() & PSL_CE)); if (ipl == old_ipl) return; @@ -536,8 +533,10 @@ e500_splx(int ipl) const u_int softints = ci->ci_data.cpu_softints & (IPL_SOFTMASK << ipl); if (__predict_false(softints != 0)) { e500_splset(ci, IPL_HIGH); + wrtee(msr); powerpc_softint(ci, ipl, (vaddr_t)__builtin_return_address(0)); + wrtee(0); } #endif /* __HAVE_FAST_SOFTINTS */ e500_splset(ci, ipl); @@ -555,13 +554,13 @@ e500_splraise(int ipl) const int old_ipl = ci->ci_cpl; /* if we paniced because of watchdog, PSL_CE will be clear. */ - KASSERT(panicstr != NULL || (mfmsr() & PSL_CE)); + KASSERT(wdog_barked || (mfmsr() & PSL_CE)); if (old_ipl < ipl) { //const register_t msr = wrtee(0); e500_splset(ci, ipl); -#if 1 +#if 0 if (old_ipl < IPL_VM && ipl >= IPL_VM) msr = 0; #endif @@ -830,9 +829,15 @@ e500_fitintr(struct trapframe *tf) static void e500_wdogintr(struct trapframe *tf) { + struct cpu_info * const ci = curcpu(); mtspr(SPR_TSR, TSR_ENW|TSR_WIS); - panic("%s: tf=%p tb=%"PRId64" srr0/srr1=%#lx/%#lx", __func__, tf, - mftb(), tf->tf_srr0, tf->tf_srr1); + wdog_barked = true; + dump_splhist(ci, NULL); + dump_trapframe(tf, NULL); + panic("%s: tf=%p tb=%"PRId64" srr0/srr1=%#lx/%#lx" + " cpl=%d idepth=%d, mtxcount=%d", + __func__, tf, mftb(), tf->tf_srr0, tf->tf_srr1, + ci->ci_cpl, ci->ci_idepth, ci->ci_mtx_count); } static void @@ -843,7 +848,7 @@ e500_extintr(struct trapframe *tf) const int old_ipl = ci->ci_cpl; /* if we paniced because of watchdog, PSL_CE will be clear. */ - KASSERT(panicstr != NULL || (mfmsr() & PSL_CE)); + KASSERT(wdog_barked || (mfmsr() & PSL_CE)); #if 0 // printf("%s(%p): idepth=%d enter\n", __func__, tf, ci->ci_idepth); @@ -878,8 +883,8 @@ e500_extintr(struct trapframe *tf) /* * Find out the pending interrupt. */ - if (mfmsr() & PSL_EE) - panic("%s(%p): MSR[EE] turned on (%#lx)!", __func__, tf, mfmsr()); + KASSERTMSG((mfmsr() & PSL_EE) == 0, + "%s(%p): MSR[EE] left on (%#lx)!", __func__, tf, mfmsr()); if (IPL2CTPR(old_ipl) != openpic_read(cpu, OPENPIC_CTPR)) panic("%s(%p): %d: old_ipl(%u) + %u != OPENPIC_CTPR (%u)", __func__, tf, __LINE__, old_ipl, @@ -947,8 +952,8 @@ e500_extintr(struct trapframe *tf) * because the loop we interrupted will complete looking * for interrupts. */ - if (mfmsr() & PSL_EE) - panic("%s(%p): MSR[EE] left on (%#lx)!", __func__, tf, mfmsr()); + KASSERTMSG((mfmsr() & PSL_EE) == 0, + "%s(%p): MSR[EE] left on (%#lx)!", __func__, tf, mfmsr()); if (IPL2CTPR(old_ipl) != openpic_read(cpu, OPENPIC_CTPR)) panic("%s(%p): %d: old_ipl(%u) + %u != OPENPIC_CTPR (%u)", __func__, tf, __LINE__, old_ipl, @@ -973,16 +978,14 @@ e500_extintr(struct trapframe *tf) if (__predict_false(softints != 0)) { KASSERT(old_ipl < IPL_VM); e500_splset(ci, IPL_HIGH); /* pop to high */ + wrtee(PSL_EE); /* reenable interrupts */ powerpc_softint(ci, old_ipl, /* deal with them */ tf->tf_srr0); + wrtee(0); /* disable interrupts */ e500_splset(ci, old_ipl); /* and drop back */ } #endif /* __HAVE_FAST_SOFTINTS */ -#if 1 KASSERT(ci->ci_cpl == old_ipl); -#else - e500_splset(ci, old_ipl); /* and drop back */ -#endif /* * If we interrupted while power-saving and we need to exit idle, Index: src/sys/arch/powerpc/booke/trap.c diff -u src/sys/arch/powerpc/booke/trap.c:1.19 src/sys/arch/powerpc/booke/trap.c:1.20 --- src/sys/arch/powerpc/booke/trap.c:1.19 Wed Aug 1 16:35:50 2012 +++ src/sys/arch/powerpc/booke/trap.c Wed Aug 1 21:30:22 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.19 2012/08/01 16:35:50 matt Exp $ */ +/* $NetBSD: trap.c,v 1.20 2012/08/01 21:30:22 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -38,7 +38,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.19 2012/08/01 16:35:50 matt Exp $"); +__KERNEL_RCSID(1, "$NetBSD: trap.c,v 1.20 2012/08/01 21:30:22 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -270,7 +270,7 @@ isi_exception(struct trapframe *tf, ksig pt_entry_t * const ptep = trap_pte_lookup(tf, trunc_page(faultva), PSL_IS); if (ptep == NULL) - dump_trapframe(tf); + dump_trapframe(tf, NULL); KASSERT(ptep != NULL); pt_entry_t pte = *ptep; @@ -620,18 +620,21 @@ embedded_fp_round_exception(struct trapf } void -dump_trapframe(const struct trapframe *tf) +dump_trapframe(const struct trapframe *tf, void (*pr)(const char *, ...)) { - printf("trapframe %p (exc=%x srr0/1=%#lx/%#lx esr/dear=%#x/%#lx)\n", + if (pr == NULL) + pr = printf; + (*pr)("trapframe %p (exc=%x srr0/1=%#lx/%#lx esr/dear=%#x/%#lx)\n", tf, tf->tf_exc, tf->tf_srr0, tf->tf_srr1, tf->tf_esr, tf->tf_dear); - printf("lr =%08lx ctr=%08lx cr =%08x xer=%08x\n", + (*pr)("lr =%08lx ctr=%08lx cr =%08x xer=%08x\n", tf->tf_lr, tf->tf_ctr, tf->tf_cr, tf->tf_xer); for (u_int r = 0; r < 32; r += 4) { - printf("r%02u=%08lx r%02u=%08lx r%02u=%08lx r%02u=%08lx\n", + (*pr)("r%02u=%08lx r%02u=%08lx r%02u=%08lx r%02u=%08lx\n", r+0, tf->tf_fixreg[r+0], r+1, tf->tf_fixreg[r+1], r+2, tf->tf_fixreg[r+2], r+3, tf->tf_fixreg[r+3]); } } + static bool ddb_exception(struct trapframe *tf) { @@ -659,7 +662,7 @@ ddb_exception(struct trapframe *tf) } } printf(" %u\n", ci->ci_cpl); - dump_trapframe(tf); + dump_trapframe(tf, NULL); #endif if (kdb_trap(tf->tf_exc, tf)) { tf->tf_srr0 += 4; @@ -714,7 +717,7 @@ trap(enum ppc_booke_exceptions trap_code || (register_t)tf < (register_t)l->l_addr + PAGE_SIZE) { printf("%s(entry): pid %d.%d (%s): invalid tf addr %p\n", __func__, p->p_pid, l->l_lid, p->p_comm, tf); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } #endif @@ -723,7 +726,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(entry): pid %d.%d (%s): %s: PSL_CE (%#lx) not set\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], mfmsr()); - dump_trapframe(tf); + dump_trapframe(tf, NULL); } #endif @@ -732,7 +735,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(entry): pid %d.%d (%s): %s invalid sp %#lx (sprg1=%#lx)\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], tf->tf_fixreg[1], mfspr(SPR_SPRG1)); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } @@ -740,7 +743,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(entry): pid %d.%d (%s): %s invalid PSL %#lx\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], tf->tf_srr1); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } @@ -801,7 +804,7 @@ trap(enum ppc_booke_exceptions trap_code break; case T_EMBEDDED_PERF_MONITOR: //db_stack_trace_print(tf->tf_fixreg[1], true, 40, "", printf); - dump_trapframe(tf); + dump_trapframe(tf, NULL); rv = EPERM; break; case T_AST: @@ -812,14 +815,14 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(ast-exit): pid %d.%d (%s): invalid sp %#lx\n", __func__, p->p_pid, l->l_lid, p->p_comm, tf->tf_fixreg[1]); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } if ((tf->tf_srr1 & (PSL_DS|PSL_IS)) != (PSL_DS|PSL_IS)) { printf("%s(entry): pid %d.%d (%s): %s invalid PSL %#lx\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], tf->tf_srr1); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } #if 0 @@ -827,7 +830,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(exit): pid %d.%d (%s): %s: PSL_CE (%#lx) not set\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], mfmsr()); - dump_trapframe(tf); + dump_trapframe(tf, NULL); } #endif userret(l, tf); @@ -837,7 +840,7 @@ trap(enum ppc_booke_exceptions trap_code if (rv != 0) { if (!onfaulted(tf, rv)) { db_stack_trace_print(tf->tf_fixreg[1], true, 40, "", printf); - dump_trapframe(tf); + dump_trapframe(tf, NULL); panic("%s: pid %d.%d (%s): %s exception in kernel mode" " (tf=%p, dear=%#lx, esr=%#x," " srr0/1=%#lx/%#lx)", @@ -852,7 +855,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(exit): pid %d.%d (%s): invalid kern sp %#lx\n", __func__, p->p_pid, l->l_lid, p->p_comm, tf->tf_fixreg[1]); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } #endif @@ -862,7 +865,7 @@ trap(enum ppc_booke_exceptions trap_code __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], mfmsr()); mtmsr(mfmsr()|PSL_CE); - dump_trapframe(tf); + dump_trapframe(tf, NULL); } #endif } else { @@ -880,7 +883,7 @@ trap(enum ppc_booke_exceptions trap_code __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code]); if (cpu_printfataltraps > 1) - dump_trapframe(tf); + dump_trapframe(tf, NULL); } (*p->p_emul->e_trapsignal)(l, &ksi); } @@ -889,7 +892,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(exit): pid %d.%d (%s): %s invalid PSL %#lx\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], tf->tf_srr1); - dump_trapframe(tf); + dump_trapframe(tf, NULL); Debugger(); } #endif @@ -898,7 +901,7 @@ trap(enum ppc_booke_exceptions trap_code printf("%s(exit): pid %d.%d (%s): %s: PSL_CE (%#lx) not set\n", __func__, p->p_pid, l->l_lid, p->p_comm, trap_names[trap_code], mfmsr()); - dump_trapframe(tf); + dump_trapframe(tf, NULL); } #endif userret(l, tf); Index: src/sys/arch/powerpc/include/booke/cpuvar.h diff -u src/sys/arch/powerpc/include/booke/cpuvar.h:1.15 src/sys/arch/powerpc/include/booke/cpuvar.h:1.16 --- src/sys/arch/powerpc/include/booke/cpuvar.h:1.15 Wed Aug 1 16:35:50 2012 +++ src/sys/arch/powerpc/include/booke/cpuvar.h Wed Aug 1 21:30:24 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.15 2012/08/01 16:35:50 matt Exp $ */ +/* $NetBSD: cpuvar.h,v 1.16 2012/08/01 21:30:24 matt Exp $ */ /*- * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc. * All rights reserved. @@ -172,6 +172,7 @@ uint8_t cpu_read_1(bus_size_t); void cpu_write_4(bus_size_t, uint32_t); void cpu_write_1(bus_size_t, uint8_t); +void dump_splhist(struct cpu_info *, void (*)(const char *, ...)); void calc_delayconst(void); struct intrsw; @@ -197,7 +198,7 @@ const void * board_info_get_data(const char *, size_t *); /* trap.c */ -void dump_trapframe(const struct trapframe *); +void dump_trapframe(const struct trapframe *, void (*)(const char *, ...)); extern char root_string[]; extern paddr_t msgbuf_paddr; Index: src/sys/arch/powerpc/powerpc/db_interface.c diff -u src/sys/arch/powerpc/powerpc/db_interface.c:1.50 src/sys/arch/powerpc/powerpc/db_interface.c:1.51 --- src/sys/arch/powerpc/powerpc/db_interface.c:1.50 Wed Feb 1 09:51:00 2012 +++ src/sys/arch/powerpc/powerpc/db_interface.c Wed Aug 1 21:30:24 2012 @@ -1,8 +1,8 @@ -/* $NetBSD: db_interface.c,v 1.50 2012/02/01 09:51:00 matt Exp $ */ +/* $NetBSD: db_interface.c,v 1.51 2012/08/01 21:30:24 matt Exp $ */ /* $OpenBSD: db_interface.c,v 1.2 1996/12/28 06:21:50 rahnds Exp $ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.50 2012/02/01 09:51:00 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.51 2012/08/01 21:30:24 matt Exp $"); #define USERACC @@ -84,6 +84,7 @@ static void db_ppc4xx_useracc(db_expr_t, #ifdef PPC_BOOKE static void db_ppcbooke_reset(db_expr_t, bool, db_expr_t, const char *); +static void db_ppcbooke_splhist(db_expr_t, bool, db_expr_t, const char *); static void db_ppcbooke_tf(db_expr_t, bool, db_expr_t, const char *); static void db_ppcbooke_dumptlb(db_expr_t, bool, db_expr_t, const char *); #endif @@ -130,6 +131,9 @@ const struct db_command db_machine_comma "Display the contents of the trapframe", "address", " address:\tthe struct trapframe to print") }, + { DDB_ADD_CMD("splhist", db_ppcbooke_splhist, 0, + "Display the splraise/splx splx", + NULL, NULL) }, { DDB_ADD_CMD("tlb", db_ppcbooke_dumptlb, 0, "Display instruction translation storage buffer information.", NULL,NULL) }, @@ -762,22 +766,20 @@ db_ppcbooke_reset(db_expr_t addr, bool h } static void -db_ppcbooke_tf(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) +db_ppcbooke_splhist(db_expr_t addr, bool have_addr, db_expr_t count, + const char *modif) +{ + dump_splhist(curcpu(), db_printf); +} + +static void +db_ppcbooke_tf(db_expr_t addr, bool have_addr, db_expr_t count, + const char *modif) { if (!have_addr) return; - const struct trapframe * const tf = (const struct trapframe *)addr; - - db_printf("trapframe %p (exc=%x srr0/1=%#lx/%#lx esr/dear=%#x/%#lx)\n", - tf, tf->tf_exc, tf->tf_srr0, tf->tf_srr1, tf->tf_esr, tf->tf_dear); - db_printf("lr =%08lx ctr=%08lx cr =%08x xer=%08x\n", - tf->tf_lr, tf->tf_ctr, tf->tf_cr, tf->tf_xer); - for (u_int r = 0; r < 32; r += 4) { - db_printf("r%02u=%08lx r%02u=%08lx r%02u=%08lx r%02u=%08lx\n", - r+0, tf->tf_fixreg[r+0], r+1, tf->tf_fixreg[r+1], - r+2, tf->tf_fixreg[r+2], r+3, tf->tf_fixreg[r+3]); - } + dump_trapframe((const struct trapframe *)addr, db_printf); } static void