Use named indices for RA, SR, MULLO, MULHI, and EPC in the

trapframe.
This commit is contained in:
thorpej 2002-11-04 20:02:09 +00:00
parent 0a3ddcba15
commit 0bc2a57e26
4 changed files with 29 additions and 30 deletions

View File

@ -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 * 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_T8 15
#define TF_T9 16 #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 { struct trapframe {
mips_reg_t tf_regs[TF_NREGS]; 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 */ u_int32_t tf_ppl; /* previous priority level */
int32_t tf_pad; /* for 8 byte aligned */ int32_t tf_pad; /* for 8 byte aligned */
}; };

View File

@ -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 * 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_TA3] = f->f_regs[TA3];
tfp[TF_T8] = f->f_regs[T8]; tfp[TF_T8] = f->f_regs[T8];
tfp[TF_T9] = f->f_regs[T9]; tfp[TF_T9] = f->f_regs[T9];
/* XXX Define named indices for these! */ tfp[TF_RA] = f->f_regs[RA];
tfp[17] = f->f_regs[RA]; tfp[TF_SR] = f->f_regs[SR];
tfp[18] = f->f_regs[SR]; tfp[TF_MULLO] = f->f_regs[MULLO];
tfp[19] = f->f_regs[MULLO]; tfp[TF_MULHI] = f->f_regs[MULHI];
tfp[20] = f->f_regs[MULHI]; tfp[TF_EPC] = f->f_regs[PC];
tfp[21] = f->f_regs[PC];
kdbaux[0] = f->f_regs[S0]; kdbaux[0] = f->f_regs[S0];
kdbaux[1] = f->f_regs[S1]; kdbaux[1] = f->f_regs[S1];
kdbaux[2] = f->f_regs[S2]; 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[TA3] = tfp[TF_TA3];
f->f_regs[T8] = tfp[TF_T8]; f->f_regs[T8] = tfp[TF_T8];
f->f_regs[T9] = tfp[TF_T9]; f->f_regs[T9] = tfp[TF_T9];
/* XXX Define named indices for these! */ f->f_regs[RA] = tfp[TF_RA];
f->f_regs[RA] = tfp[17]; f->f_regs[SR] = tfp[TF_SR];
f->f_regs[SR] = tfp[18]; f->f_regs[MULLO] = tfp[TF_MULLO];
f->f_regs[MULLO] = tfp[19]; f->f_regs[MULHI] = tfp[TF_MULHI];
f->f_regs[MULHI] = tfp[20]; f->f_regs[PC] = tfp[TF_EPC];
f->f_regs[PC] = tfp[21];
f->f_regs[S0] = kdbaux[0]; f->f_regs[S0] = kdbaux[0];
f->f_regs[S1] = kdbaux[1]; f->f_regs[S1] = kdbaux[1];
f->f_regs[S2] = kdbaux[2]; f->f_regs[S2] = kdbaux[2];

View File

@ -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 # Copyright (c) 1997
# Jonathan Stone. All rights reserved. # Jonathan Stone. All rights reserved.
@ -230,11 +230,11 @@ endif
define TF_REG_T8 offsetof(struct trapframe, tf_regs[TF_T8]) 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_T9 offsetof(struct trapframe, tf_regs[TF_T9])
define TF_REG_RA offsetof(struct trapframe, tf_ra) define TF_REG_RA offsetof(struct trapframe, tf_regs[TF_RA])
define TF_REG_SR offsetof(struct trapframe, tf_sr) define TF_REG_SR offsetof(struct trapframe, tf_regs[TF_SR])
define TF_REG_MULLO offsetof(struct trapframe, tf_mullo) define TF_REG_MULLO offsetof(struct trapframe, tf_regs[TF_MULLO])
define TF_REG_MULHI offsetof(struct trapframe, tf_mulhi) define TF_REG_MULHI offsetof(struct trapframe, tf_regs[TF_MULHI])
define TF_REG_EPC offsetof(struct trapframe, tf_epc) define TF_REG_EPC offsetof(struct trapframe, tf_regs[TF_EPC])
define TF_PPL offsetof(struct trapframe, tf_ppl) define TF_PPL offsetof(struct trapframe, tf_ppl)
define CTXSWFRAME_SIZ sizeof(mips_reg_t) * 12 define CTXSWFRAME_SIZ sizeof(mips_reg_t) * 12

View File

@ -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. * Copyright (c) 1988 University of Utah.
@ -44,7 +44,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ #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_cputype.h" /* which mips CPU levels do we support? */
#include "opt_ktrace.h" #include "opt_ktrace.h"
@ -319,7 +319,7 @@ trap(status, cause, vaddr, opc, frame)
goto dopanic; goto dopanic;
/* check for fuswintr() or suswintr() getting a page fault */ /* check for fuswintr() or suswintr() getting a page fault */
if (p->p_addr->u_pcb.pcb_onfault == (caddr_t)fswintrberr) { 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 */ return; /* KERN */
} }
goto pagefault; goto pagefault;
@ -403,7 +403,7 @@ trap(status, cause, vaddr, opc, frame)
copyfault: copyfault:
if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL) if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL)
goto dopanic; 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 */ return; /* KERN */
case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */ case T_ADDR_ERR_LD+T_USER: /* misaligned or kseg access */