> Date: Sun, 16 Oct 2016 23:30:07 -0700 > From: Philip Guenther <guent...@gmail.com> > > In 2003(!) a pile of code was deleted from sparc64's locore.s: > ---------------------------- > revision 1.35 > date: 2003/05/17 07:09:08; author: art; state: Exp; lines: +1 -957; > Get rid of lots of hairy ifdefs that we'll most likely never use. > TRAPTRACE, TRAPSTATS, FLTTRACE and SCHED_DEBUG. > > mdw@ henric@ ok. > ---------------------------- > > That was the code that actually put data into the trap_trace[] array, > rendering the remaining trap_trace* code useless. How about we delete > those bits? > > This built and the box booted with the resulting kernel. > > ok?
ok kettenis@ > Index: sparc64/autoconf.c > =================================================================== > RCS file: /cvs/src/sys/arch/sparc64/sparc64/autoconf.c,v > retrieving revision 1.126 > diff -u -p -r1.126 autoconf.c > --- sparc64/autoconf.c 8 Jun 2016 17:24:44 -0000 1.126 > +++ sparc64/autoconf.c 17 Oct 2016 06:25:36 -0000 > @@ -586,11 +586,6 @@ bootpath_build(void) > #else > printf("kernel has no debugger\n"); > #endif > - } else if (*cp == 't') { > - /* turn on traptrace w/o breaking into kdb */ > - extern int trap_trace_dis; > - > - trap_trace_dis = 0; > } > } > } > Index: sparc64/db_interface.c > =================================================================== > RCS file: /cvs/src/sys/arch/sparc64/sparc64/db_interface.c,v > retrieving revision 1.45 > diff -u -p -r1.45 db_interface.c > --- sparc64/db_interface.c 8 Oct 2016 05:49:09 -0000 1.45 > +++ sparc64/db_interface.c 17 Oct 2016 06:25:37 -0000 > @@ -73,17 +73,6 @@ db_regs_t ddb_regs; /* register state */ > > extern void OF_enter(void); > > -extern struct traptrace { > - unsigned short tl:3, /* Trap level */ > - ns:4, /* PCB nsaved */ > - tt:9; /* Trap type */ > - unsigned short pid; /* PID */ > - u_int tstate; /* tstate */ > - u_int tsp; /* sp */ > - u_int tpc; /* pc */ > - u_int tfault; /* MMU tag access */ > -} trap_trace[], trap_trace_end[]; > - > static long nil; > > static int > @@ -231,14 +220,12 @@ void db_pmap_kernel(db_expr_t, int, db_e > void db_pload_cmd(db_expr_t, int, db_expr_t, char *); > void db_pmap_cmd(db_expr_t, int, db_expr_t, char *); > void db_lock(db_expr_t, int, db_expr_t, char *); > -void db_traptrace(db_expr_t, int, db_expr_t, char *); > void db_dump_buf(db_expr_t, int, db_expr_t, char *); > void db_dump_espcmd(db_expr_t, int, db_expr_t, char *); > void db_watch(db_expr_t, int, db_expr_t, char *); > void db_xir(db_expr_t, int, db_expr_t, char *); > > static void db_dump_pmap(struct pmap*); > -static void db_print_trace_entry(struct traptrace *, int); > > #ifdef MULTIPROCESSOR > void db_cpuinfo_cmd(db_expr_t, int, db_expr_t, char *); > @@ -272,9 +259,6 @@ db_ktrap(type, tf) > struct trapstate *ts = &ddb_regs.ddb_ts[0]; > extern int savetstate(struct trapstate *ts); > extern void restoretstate(int tl, struct trapstate *ts); > - extern int trap_trace_dis; > - > - trap_trace_dis++; > > #if NTDA > 0 > tda_full_blast(); > @@ -336,7 +320,6 @@ db_ktrap(type, tf) > *(struct frame *)tf->tf_out[6] = ddb_regs.ddb_fr; > #endif > *tf = ddb_regs.ddb_tf; > - trap_trace_dis--; > > #ifdef MULTIPROCESSOR > if (!db_switch_cpu) > @@ -1098,78 +1081,6 @@ db_setpcb(addr, have_addr, count, modif) > db_printf("PID %ld not found.\n", addr); > } > > -static void > -db_print_trace_entry(te, i) > - struct traptrace *te; > - int i; > -{ > - db_printf("%d:%d p:%d tt:%d:%llx:%llx %llx:%llx ", i, > - (int)te->tl, (int)te->pid, > - (int)te->tt, (unsigned long long)te->tstate, > - (unsigned long long)te->tfault, (unsigned long long)te->tsp, > - (unsigned long long)te->tpc); > - db_printsym((u_long)te->tpc, DB_STGY_PROC, db_printf); > - db_printf(": "); > - if ((te->tpc && !(te->tpc&0x3)) && > - curproc && > - (curproc->p_pid == te->pid)) { > - db_disasm((u_long)te->tpc, 0); > - } else db_printf("\n"); > -} > - > -void > -db_traptrace(addr, have_addr, count, modif) > - db_expr_t addr; > - int have_addr; > - db_expr_t count; > - char *modif; > -{ > - int i, start = 0, full = 0, reverse = 0; > - struct traptrace *end; > - > - start = 0; > - end = &trap_trace_end[0]; > - > - { > - register char c, *cp = modif; > - if (modif) > - while ((c = *cp++) != 0) { > - if (c == 'f') > - full = 1; > - if (c == 'r') > - reverse = 1; > - } > - } > - > - if (have_addr) { > - start = addr / (sizeof (struct traptrace)); > - if (&trap_trace[start] > &trap_trace_end[0]) { > - db_printf("Address out of range.\n"); > - return; > - } > - if (!full) end = &trap_trace[start+1]; > - } > - > - db_printf("#:tl p:pid tt:tt:tstate:tfault sp:pc\n"); > - if (reverse) { > - if (full && start) > - for (i=start; --i;) { > - db_print_trace_entry(&trap_trace[i], i); > - } > - i = (end - &trap_trace[0]); > - while(--i > start) { > - db_print_trace_entry(&trap_trace[i], i); > - } > - } else { > - for (i=start; &trap_trace[i] < end ; i++) { > - db_print_trace_entry(&trap_trace[i], i); > - } > - if (full && start) > - for (i=0; i < start ; i++) { > - db_print_trace_entry(&trap_trace[i], i); > - } > - } > -} > > /* > * Use physical or virtual watchpoint registers -- ugh > @@ -1285,7 +1196,6 @@ struct db_command db_machine_command_tab > { "stack", db_dump_stack, 0, 0 }, > { "tf", db_dump_trap, 0, 0 }, > { "ts", db_dump_ts, 0, 0 }, > - { "traptrace", db_traptrace, 0, 0 }, > { "watch", db_watch, 0, 0 }, > { "window", db_dump_window, 0, 0 }, > { "xir", db_xir, 0, 0 }, > Index: sparc64/locore.s > =================================================================== > RCS file: /cvs/src/sys/arch/sparc64/sparc64/locore.s,v > retrieving revision 1.183 > diff -u -p -r1.183 locore.s > --- sparc64/locore.s 23 May 2016 20:11:49 -0000 1.183 > +++ sparc64/locore.s 17 Oct 2016 06:25:38 -0000 > @@ -1345,21 +1345,6 @@ panic_red: > .endm > #endif /* DEBUG_NOTDEF */ > > -#define TRACESIZ 0x01000 > - .globl _C_LABEL(trap_trace) > - .globl _C_LABEL(trap_trace_ptr) > - .globl _C_LABEL(trap_trace_end) > - .globl _C_LABEL(trap_trace_dis) > - .data > -_C_LABEL(trap_trace_dis): > - .word 1, 1 ! Starts disabled. DDB turns it on. > -_C_LABEL(trap_trace_ptr): > - .word 0, 0, 0, 0 > -_C_LABEL(trap_trace): > - .space TRACESIZ > -_C_LABEL(trap_trace_end): > - .space 0x20 ! safety margin > - > /* > * v9 machines do not have a trap window. > * > Index: sparc64/trap.c > =================================================================== > RCS file: /cvs/src/sys/arch/sparc64/sparc64/trap.c,v > retrieving revision 1.94 > diff -u -p -r1.94 trap.c > --- sparc64/trap.c 8 Oct 2016 05:49:09 -0000 1.94 > +++ sparc64/trap.c 17 Oct 2016 06:25:38 -0000 > @@ -431,10 +431,7 @@ trap(struct trapframe64 *tf, unsigned ty > > default: > if (type < 0x100) { > - extern int trap_trace_dis; > dopanic: > - trap_trace_dis = 1; > - > panic("trap type 0x%x (%s): pc=%lx npc=%lx pstate=%b", > type, type < N_TRAP_TYPES ? trap_type[type] : T, > pc, (long)tf->tf_npc, pstate, PSTATE_BITS); > @@ -851,8 +848,6 @@ data_access_fault(struct trapframe64 *tf > kfault: > onfault = (long)p->p_addr->u_pcb.pcb_onfault; > if (!onfault) { > - extern int trap_trace_dis; > - trap_trace_dis = 1; /* Disable traptrace for > printf */ > (void) splhigh(); > panic("kernel data fault: pc=%lx addr=%lx", > pc, addr); > @@ -934,9 +929,6 @@ data_access_error(struct trapframe64 *tf > if (tstate & TSTATE_PRIV) { > > if (!onfault) { > - extern int trap_trace_dis; > - > - trap_trace_dis = 1; /* Disable traptrace for printf */ > (void) splhigh(); > panic("data fault: pc=%lx addr=%lx sfsr=%lb", > (u_long)pc, (long)sfva, sfsr, SFSR_BITS); > @@ -998,8 +990,6 @@ text_access_fault(struct trapframe64 *tf > > access_type = PROT_EXEC; > if (tstate & TSTATE_PRIV) { > - extern int trap_trace_dis; > - trap_trace_dis = 1; /* Disable traptrace for printf */ > (void) splhigh(); > panic("kernel text_access_fault: pc=%lx va=%lx", pc, va); > /* NOTREACHED */ > @@ -1031,8 +1021,6 @@ text_access_fault(struct trapframe64 *tf > * fault, deliver SIGSEGV. > */ > if (tstate & TSTATE_PRIV) { > - extern int trap_trace_dis; > - trap_trace_dis = 1; /* Disable traptrace for printf */ > (void) splhigh(); > panic("kernel text fault: pc=%llx", (unsigned long > long)pc); > /* NOTREACHED */ > @@ -1076,13 +1064,9 @@ text_access_error(struct trapframe64 *tf > tstate = tf->tf_tstate; > > if ((afsr) != 0) { > - extern int trap_trace_dis; > - > - trap_trace_dis++; /* Disable traptrace for printf */ > printf("text_access_error: memory error...\n"); > printf("text memory error type %d sfsr=%lx sfva=%lx afsr=%lx > afva=%lx tf=%p\n", > type, sfsr, pc, afsr, afva, tf); > - trap_trace_dis--; /* Reenable traptrace for printf */ > > if (tstate & TSTATE_PRIV) > panic("text_access_error: kernel memory error"); > @@ -1101,8 +1085,6 @@ text_access_error(struct trapframe64 *tf > /* Now munch on protections... */ > access_type = PROT_EXEC; > if (tstate & TSTATE_PRIV) { > - extern int trap_trace_dis; > - trap_trace_dis = 1; /* Disable traptrace for printf */ > (void) splhigh(); > panic("kernel text error: pc=%lx sfsr=%lb", pc, > sfsr, SFSR_BITS); > @@ -1136,8 +1118,6 @@ text_access_error(struct trapframe64 *tf > * fault, deliver SIGSEGV. > */ > if (tstate & TSTATE_PRIV) { > - extern int trap_trace_dis; > - trap_trace_dis = 1; /* Disable traptrace for printf */ > (void) splhigh(); > panic("kernel text error: pc=%lx sfsr=%lb", pc, > sfsr, SFSR_BITS); > >