diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-03-05 17:24:28 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2016-03-05 17:24:28 +0000 |
commit | 1d0172aa638760dac8ca8e2bdc719ac4efbd0e6d (patch) | |
tree | a7995f1efd4927b99136e7311c38394569e3ace3 | |
parent | 5388689c8f35cbd5b90160b53d1f0b9f4f8c7c68 (diff) |
Define db_reg_t like the other archs by typedef'ing "struct trapframe".
This will allow us to use some of the DDB macros on trapframe which are
not DDB_REGS.
-rw-r--r-- | sys/arch/macppc/macppc/db_interface.c | 10 | ||||
-rw-r--r-- | sys/arch/powerpc/ddb/db_trace.c | 84 | ||||
-rw-r--r-- | sys/arch/powerpc/include/db_machdep.h | 15 | ||||
-rw-r--r-- | sys/arch/socppc/socppc/db_interface.c | 10 |
4 files changed, 58 insertions, 61 deletions
diff --git a/sys/arch/macppc/macppc/db_interface.c b/sys/arch/macppc/macppc/db_interface.c index 86ec76cd859..e56d3424f6d 100644 --- a/sys/arch/macppc/macppc/db_interface.c +++ b/sys/arch/macppc/macppc/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.11 2016/02/28 11:56:40 mpi Exp $ */ +/* $OpenBSD: db_interface.c,v 1.12 2016/03/05 17:24:27 mpi Exp $ */ /* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ /* @@ -88,10 +88,10 @@ db_trap_glue(struct trapframe *frame) while (db_enter_ddb()) { #endif - bcopy(frame->fixreg, DDB_REGS->tf.fixreg, + bcopy(frame->fixreg, DDB_REGS->fixreg, 32 * sizeof(u_int32_t)); - DDB_REGS->tf.srr0 = frame->srr0; - DDB_REGS->tf.srr1 = frame->srr1; + DDB_REGS->srr0 = frame->srr0; + DDB_REGS->srr1 = frame->srr1; s = splhigh(); db_active++; @@ -101,7 +101,7 @@ db_trap_glue(struct trapframe *frame) db_active--; splx(s); - bcopy(DDB_REGS->tf.fixreg, frame->fixreg, + bcopy(DDB_REGS->fixreg, frame->fixreg, 32 * sizeof(u_int32_t)); #ifdef MULTIPROCESSOR if (!db_switch_cpu) diff --git a/sys/arch/powerpc/ddb/db_trace.c b/sys/arch/powerpc/ddb/db_trace.c index 87bcc5f5296..df6e91ccbef 100644 --- a/sys/arch/powerpc/ddb/db_trace.c +++ b/sys/arch/powerpc/ddb/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.7 2016/03/02 10:41:08 mpi Exp $ */ +/* $OpenBSD: db_trace.c,v 1.8 2016/03/05 17:24:27 mpi Exp $ */ /* $NetBSD: db_trace.c,v 1.15 1996/02/22 23:23:41 gwr Exp $ */ /* @@ -48,44 +48,44 @@ db_regs_t ddb_regs; struct db_variable db_regs[] = { - { "r0", (long *)&ddb_regs.tf.fixreg[0], FCN_NULL }, - { "r1", (long *)&ddb_regs.tf.fixreg[1], FCN_NULL }, - { "r2", (long *)&ddb_regs.tf.fixreg[2], FCN_NULL }, - { "r3", (long *)&ddb_regs.tf.fixreg[3], FCN_NULL }, - { "r4", (long *)&ddb_regs.tf.fixreg[4], FCN_NULL }, - { "r5", (long *)&ddb_regs.tf.fixreg[5], FCN_NULL }, - { "r6", (long *)&ddb_regs.tf.fixreg[6], FCN_NULL }, - { "r7", (long *)&ddb_regs.tf.fixreg[7], FCN_NULL }, - { "r8", (long *)&ddb_regs.tf.fixreg[8], FCN_NULL }, - { "r9", (long *)&ddb_regs.tf.fixreg[9], FCN_NULL }, - { "r10", (long *)&ddb_regs.tf.fixreg[10], FCN_NULL }, - { "r11", (long *)&ddb_regs.tf.fixreg[11], FCN_NULL }, - { "r12", (long *)&ddb_regs.tf.fixreg[12], FCN_NULL }, - { "r13", (long *)&ddb_regs.tf.fixreg[13], FCN_NULL }, - { "r14", (long *)&ddb_regs.tf.fixreg[13], FCN_NULL }, - { "r15", (long *)&ddb_regs.tf.fixreg[13], FCN_NULL }, - { "r16", (long *)&ddb_regs.tf.fixreg[13], FCN_NULL }, - { "r17", (long *)&ddb_regs.tf.fixreg[17], FCN_NULL }, - { "r18", (long *)&ddb_regs.tf.fixreg[18], FCN_NULL }, - { "r19", (long *)&ddb_regs.tf.fixreg[19], FCN_NULL }, - { "r20", (long *)&ddb_regs.tf.fixreg[20], FCN_NULL }, - { "r21", (long *)&ddb_regs.tf.fixreg[21], FCN_NULL }, - { "r22", (long *)&ddb_regs.tf.fixreg[22], FCN_NULL }, - { "r23", (long *)&ddb_regs.tf.fixreg[23], FCN_NULL }, - { "r24", (long *)&ddb_regs.tf.fixreg[24], FCN_NULL }, - { "r25", (long *)&ddb_regs.tf.fixreg[25], FCN_NULL }, - { "r26", (long *)&ddb_regs.tf.fixreg[26], FCN_NULL }, - { "r27", (long *)&ddb_regs.tf.fixreg[27], FCN_NULL }, - { "r28", (long *)&ddb_regs.tf.fixreg[28], FCN_NULL }, - { "r29", (long *)&ddb_regs.tf.fixreg[29], FCN_NULL }, - { "r30", (long *)&ddb_regs.tf.fixreg[30], FCN_NULL }, - { "r31", (long *)&ddb_regs.tf.fixreg[31], FCN_NULL }, - { "lr", (long *)&ddb_regs.tf.lr, FCN_NULL }, - { "cr", (long *)&ddb_regs.tf.cr, FCN_NULL }, - { "xer", (long *)&ddb_regs.tf.xer, FCN_NULL }, - { "ctr", (long *)&ddb_regs.tf.ctr, FCN_NULL }, - { "iar", (long *)&ddb_regs.tf.srr0, FCN_NULL }, - { "msr", (long *)&ddb_regs.tf.srr1, FCN_NULL }, + { "r0", (long *)&ddb_regs.fixreg[0], FCN_NULL }, + { "r1", (long *)&ddb_regs.fixreg[1], FCN_NULL }, + { "r2", (long *)&ddb_regs.fixreg[2], FCN_NULL }, + { "r3", (long *)&ddb_regs.fixreg[3], FCN_NULL }, + { "r4", (long *)&ddb_regs.fixreg[4], FCN_NULL }, + { "r5", (long *)&ddb_regs.fixreg[5], FCN_NULL }, + { "r6", (long *)&ddb_regs.fixreg[6], FCN_NULL }, + { "r7", (long *)&ddb_regs.fixreg[7], FCN_NULL }, + { "r8", (long *)&ddb_regs.fixreg[8], FCN_NULL }, + { "r9", (long *)&ddb_regs.fixreg[9], FCN_NULL }, + { "r10", (long *)&ddb_regs.fixreg[10], FCN_NULL }, + { "r11", (long *)&ddb_regs.fixreg[11], FCN_NULL }, + { "r12", (long *)&ddb_regs.fixreg[12], FCN_NULL }, + { "r13", (long *)&ddb_regs.fixreg[13], FCN_NULL }, + { "r14", (long *)&ddb_regs.fixreg[13], FCN_NULL }, + { "r15", (long *)&ddb_regs.fixreg[13], FCN_NULL }, + { "r16", (long *)&ddb_regs.fixreg[13], FCN_NULL }, + { "r17", (long *)&ddb_regs.fixreg[17], FCN_NULL }, + { "r18", (long *)&ddb_regs.fixreg[18], FCN_NULL }, + { "r19", (long *)&ddb_regs.fixreg[19], FCN_NULL }, + { "r20", (long *)&ddb_regs.fixreg[20], FCN_NULL }, + { "r21", (long *)&ddb_regs.fixreg[21], FCN_NULL }, + { "r22", (long *)&ddb_regs.fixreg[22], FCN_NULL }, + { "r23", (long *)&ddb_regs.fixreg[23], FCN_NULL }, + { "r24", (long *)&ddb_regs.fixreg[24], FCN_NULL }, + { "r25", (long *)&ddb_regs.fixreg[25], FCN_NULL }, + { "r26", (long *)&ddb_regs.fixreg[26], FCN_NULL }, + { "r27", (long *)&ddb_regs.fixreg[27], FCN_NULL }, + { "r28", (long *)&ddb_regs.fixreg[28], FCN_NULL }, + { "r29", (long *)&ddb_regs.fixreg[29], FCN_NULL }, + { "r30", (long *)&ddb_regs.fixreg[30], FCN_NULL }, + { "r31", (long *)&ddb_regs.fixreg[31], FCN_NULL }, + { "lr", (long *)&ddb_regs.lr, FCN_NULL }, + { "cr", (long *)&ddb_regs.cr, FCN_NULL }, + { "xer", (long *)&ddb_regs.xer, FCN_NULL }, + { "ctr", (long *)&ddb_regs.ctr, FCN_NULL }, + { "iar", (long *)&ddb_regs.srr0, FCN_NULL }, + { "msr", (long *)&ddb_regs.srr1, FCN_NULL }, }; struct db_variable *db_eregs = db_regs + nitems(db_regs); @@ -96,7 +96,7 @@ struct db_variable *db_eregs = db_regs + nitems(db_regs); void db_save_regs(struct trapframe *frame) { - bcopy(frame, &(ddb_regs.tf), sizeof (struct trapframe)); + bcopy(frame, &ddb_regs, sizeof (struct trapframe)); } /* from locore.S */ @@ -130,8 +130,8 @@ db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count, } if (!have_addr) { - sp = ddb_regs.tf.fixreg[1]; - lr = ddb_regs.tf.srr0; + sp = ddb_regs.fixreg[1]; + lr = ddb_regs.srr0; } else { if (trace_proc) { struct proc *p = pfind((pid_t)addr); diff --git a/sys/arch/powerpc/include/db_machdep.h b/sys/arch/powerpc/include/db_machdep.h index 771005b6e0f..1c8030e6d44 100644 --- a/sys/arch/powerpc/include/db_machdep.h +++ b/sys/arch/powerpc/include/db_machdep.h @@ -1,4 +1,4 @@ -/* $OpenBSD: db_machdep.h,v 1.26 2015/11/24 13:33:18 mpi Exp $ */ +/* $OpenBSD: db_machdep.h,v 1.27 2016/03/05 17:24:27 mpi Exp $*/ /* $NetBSD: db_machdep.h,v 1.13 1996/04/29 20:50:08 leo Exp $ */ /* @@ -39,14 +39,11 @@ typedef vaddr_t db_addr_t; /* address - unsigned */ typedef long db_expr_t; /* expression - signed */ -struct powerpc_saved_state { - struct trapframe tf; -}; -typedef struct powerpc_saved_state db_regs_t; +typedef struct trapframe db_regs_t; extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (&ddb_regs) -#define PC_REGS(regs) ((regs)->tf.srr0) +#define PC_REGS(regs) ((regs)->srr0) #define SET_PC_REGS(regs, value) PC_REGS(regs) = (value) #define BKPT_INST 0x7C810808 /* breakpoint instruction */ @@ -54,11 +51,11 @@ extern db_regs_t ddb_regs; /* register state */ #define BKPT_SIZE (4) /* size of breakpoint inst */ #define BKPT_SET(inst) (BKPT_INST) -#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf.srr0 -= 4) +#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->srr0 -= 4) #define SR_SINGLESTEP 0x8000 -#define db_clear_single_step(regs) ((regs)->tf.srr1 &= ~SR_SINGLESTEP) -#define db_set_single_step(regs) ((regs)->tf.srr1 |= SR_SINGLESTEP) +#define db_clear_single_step(regs) ((regs)->srr1 &= ~SR_SINGLESTEP) +#define db_set_single_step(regs) ((regs)->srr1 |= SR_SINGLESTEP) #define T_BREAKPOINT 0xffff #define IS_BREAKPOINT_TRAP(type, code) ((type) == T_BREAKPOINT) diff --git a/sys/arch/socppc/socppc/db_interface.c b/sys/arch/socppc/socppc/db_interface.c index 927a88b24ef..6772076584b 100644 --- a/sys/arch/socppc/socppc/db_interface.c +++ b/sys/arch/socppc/socppc/db_interface.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_interface.c,v 1.2 2016/02/28 11:56:40 mpi Exp $ */ +/* $OpenBSD: db_interface.c,v 1.3 2016/03/05 17:24:27 mpi Exp $ */ /* $NetBSD: db_interface.c,v 1.12 2001/07/22 11:29:46 wiz Exp $ */ #include <sys/param.h> @@ -26,16 +26,16 @@ db_trap_glue(struct trapframe *frame) || (frame->exc == EXC_PGM && (frame->srr1 & 0x20000)) || frame->exc == EXC_BPT)) { - bcopy(frame->fixreg, DDB_REGS->tf.fixreg, + bcopy(frame->fixreg, DDB_REGS->fixreg, 32 * sizeof(u_int32_t)); - DDB_REGS->tf.srr0 = frame->srr0; - DDB_REGS->tf.srr1 = frame->srr1; + DDB_REGS->srr0 = frame->srr0; + DDB_REGS->srr1 = frame->srr1; cnpollc(TRUE); db_trap(T_BREAKPOINT, 0); cnpollc(FALSE); - bcopy(DDB_REGS->tf.fixreg, frame->fixreg, + bcopy(DDB_REGS->fixreg, frame->fixreg, 32 * sizeof(u_int32_t)); return 1; |