diff options
| author | thorpej <thorpej@NetBSD.org> | 2002-11-04 20:02:09 +0000 |
|---|---|---|
| committer | thorpej <thorpej@NetBSD.org> | 2002-11-04 20:02:09 +0000 |
| commit | 0bc2a57e26da69b8b7d9ca18a6739e7b58b4f0bd (patch) | |
| tree | 8c6959d691678eaade333709e6d1e71efcc4c4a5 | |
| parent | 0a3ddcba154dba6f43cbc1d7ad59e2ac5ecebba8 (diff) | |
Use named indices for RA, SR, MULLO, MULHI, and EPC in the
trapframe.
| -rw-r--r-- | sys/arch/mips/include/locore.h | 15 | ||||
| -rw-r--r-- | sys/arch/mips/mips/db_interface.c | 24 | ||||
| -rw-r--r-- | sys/arch/mips/mips/genassym.cf | 12 | ||||
| -rw-r--r-- | sys/arch/mips/mips/trap.c | 8 |
4 files changed, 29 insertions, 30 deletions
diff --git a/sys/arch/mips/include/locore.h b/sys/arch/mips/include/locore.h index db9b4101cb3..1abf6029c1b 100644 --- a/sys/arch/mips/include/locore.h +++ b/sys/arch/mips/include/locore.h @@ -1,4 +1,4 @@ -/* $NetBSD: locore.h,v 1.64 2002/11/04 19:40:04 thorpej Exp $ */ +/* $NetBSD: locore.h,v 1.65 2002/11/04 20:02:09 thorpej Exp $ */ /* * Copyright 1996 The Board of Trustees of The Leland Stanford @@ -341,15 +341,16 @@ void mips_machdep_cache_config(void); #define TF_T8 15 #define TF_T9 16 -#define TF_NREGS 17 +#define TF_RA 17 +#define TF_SR 18 +#define TF_MULLO 19 +#define TF_MULHI 20 +#define TF_EPC 21 /* may be changed by trap() call */ + +#define TF_NREGS 22 struct trapframe { mips_reg_t tf_regs[TF_NREGS]; - mips_reg_t tf_ra; - mips_reg_t tf_sr; - mips_reg_t tf_mullo; - mips_reg_t tf_mulhi; - mips_reg_t tf_epc; /* may be changed by trap() call */ u_int32_t tf_ppl; /* previous priority level */ int32_t tf_pad; /* for 8 byte aligned */ }; diff --git a/sys/arch/mips/mips/db_interface.c b/sys/arch/mips/mips/db_interface.c index 4b504637224..01923632c82 100644 --- a/sys/arch/mips/mips/db_interface.c +++ b/sys/arch/mips/mips/db_interface.c @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.44 2002/11/04 19:51:05 thorpej Exp $ */ +/* $NetBSD: db_interface.c,v 1.45 2002/11/04 20:02:09 thorpej Exp $ */ /* * Mach Operating System @@ -192,12 +192,11 @@ kdb_trap(int type, mips_reg_t /* struct trapframe */ *tfp) tfp[TF_TA3] = f->f_regs[TA3]; tfp[TF_T8] = f->f_regs[T8]; tfp[TF_T9] = f->f_regs[T9]; - /* XXX Define named indices for these! */ - tfp[17] = f->f_regs[RA]; - tfp[18] = f->f_regs[SR]; - tfp[19] = f->f_regs[MULLO]; - tfp[20] = f->f_regs[MULHI]; - tfp[21] = f->f_regs[PC]; + tfp[TF_RA] = f->f_regs[RA]; + tfp[TF_SR] = f->f_regs[SR]; + tfp[TF_MULLO] = f->f_regs[MULLO]; + tfp[TF_MULHI] = f->f_regs[MULHI]; + tfp[TF_EPC] = f->f_regs[PC]; kdbaux[0] = f->f_regs[S0]; kdbaux[1] = f->f_regs[S1]; kdbaux[2] = f->f_regs[S2]; @@ -250,12 +249,11 @@ db_set_ddb_regs(int type, mips_reg_t *tfp) f->f_regs[TA3] = tfp[TF_TA3]; f->f_regs[T8] = tfp[TF_T8]; f->f_regs[T9] = tfp[TF_T9]; - /* XXX Define named indices for these! */ - f->f_regs[RA] = tfp[17]; - f->f_regs[SR] = tfp[18]; - f->f_regs[MULLO] = tfp[19]; - f->f_regs[MULHI] = tfp[20]; - f->f_regs[PC] = tfp[21]; + f->f_regs[RA] = tfp[TF_RA]; + f->f_regs[SR] = tfp[TF_SR]; + f->f_regs[MULLO] = tfp[TF_MULLO]; + f->f_regs[MULHI] = tfp[TF_MULHI]; + f->f_regs[PC] = tfp[TF_EPC]; f->f_regs[S0] = kdbaux[0]; f->f_regs[S1] = kdbaux[1]; f->f_regs[S2] = kdbaux[2]; diff --git a/sys/arch/mips/mips/genassym.cf b/sys/arch/mips/mips/genassym.cf index b8e6a778ea8..5b6625da5de 100644 --- a/sys/arch/mips/mips/genassym.cf +++ b/sys/arch/mips/mips/genassym.cf @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.30 2002/11/04 19:40:05 thorpej Exp $ +# $NetBSD: genassym.cf,v 1.31 2002/11/04 20:02:10 thorpej Exp $ # # Copyright (c) 1997 # Jonathan Stone. All rights reserved. @@ -230,11 +230,11 @@ endif define TF_REG_T8 offsetof(struct trapframe, tf_regs[TF_T8]) define TF_REG_T9 offsetof(struct trapframe, tf_regs[TF_T9]) -define TF_REG_RA offsetof(struct trapframe, tf_ra) -define TF_REG_SR offsetof(struct trapframe, tf_sr) -define TF_REG_MULLO offsetof(struct trapframe, tf_mullo) -define TF_REG_MULHI offsetof(struct trapframe, tf_mulhi) -define TF_REG_EPC offsetof(struct trapframe, tf_epc) +define TF_REG_RA offsetof(struct trapframe, tf_regs[TF_RA]) +define TF_REG_SR offsetof(struct trapframe, tf_regs[TF_SR]) +define TF_REG_MULLO offsetof(struct trapframe, tf_regs[TF_MULLO]) +define TF_REG_MULHI offsetof(struct trapframe, tf_regs[TF_MULHI]) +define TF_REG_EPC offsetof(struct trapframe, tf_regs[TF_EPC]) define TF_PPL offsetof(struct trapframe, tf_ppl) define CTXSWFRAME_SIZ sizeof(mips_reg_t) * 12 diff --git a/sys/arch/mips/mips/trap.c b/sys/arch/mips/mips/trap.c index 7f13f62fae9..026c620fd24 100644 --- a/sys/arch/mips/mips/trap.c +++ b/sys/arch/mips/mips/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.173 2002/09/22 05:40:35 gmcgarry Exp $ */ +/* $NetBSD: trap.c,v 1.174 2002/11/04 20:02:10 thorpej Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -44,7 +44,7 @@ #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.173 2002/09/22 05:40:35 gmcgarry Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.174 2002/11/04 20:02:10 thorpej Exp $"); #include "opt_cputype.h" /* which mips CPU levels do we support? */ #include "opt_ktrace.h" @@ -319,7 +319,7 @@ trap(status, cause, vaddr, opc, frame) goto dopanic; /* check for fuswintr() or suswintr() getting a page fault */ if (p->p_addr->u_pcb.pcb_onfault == (caddr_t)fswintrberr) { - frame->tf_epc = (int)fswintrberr; + frame->tf_regs[TF_EPC] = (int)fswintrberr; return; /* KERN */ } goto pagefault; @@ -403,7 +403,7 @@ trap(status, cause, vaddr, opc, frame) copyfault: if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL) goto dopanic; - frame->tf_epc = (int)p->p_addr->u_pcb.pcb_onfault; + frame->tf_regs[TF_EPC] = (int)p->p_addr->u_pcb.pcb_onfault; return; /* KERN */ case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */ |
