Instead of treating the trap/syscall/exception frame like a struct
containing a substruct (the hardware frame) and an array of registers, treat it like one big array of registers, for easier and prettier access. Update everything to deal with that.
This commit is contained in:
parent
3e323f7a08
commit
105697388d
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: genassym.c,v 1.6 1996/07/11 03:53:23 cgd Exp $ */
|
||||
/* $NetBSD: genassym.c,v 1.7 1996/07/11 05:31:16 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
|
@ -82,8 +82,6 @@ main(argc, argv)
|
|||
def("VM_MAX_ADDRESS", VM_MAX_ADDRESS);
|
||||
|
||||
/* Register offsets, for stack frames. */
|
||||
def("FRAMESIZE", sizeof(struct trapframe));
|
||||
def("FRAME_NSAVEREGS", FRAME_NSAVEREGS);
|
||||
def("FRAME_V0", FRAME_V0);
|
||||
def("FRAME_T0", FRAME_T0);
|
||||
def("FRAME_T1", FRAME_T1);
|
||||
|
@ -111,11 +109,17 @@ main(argc, argv)
|
|||
def("FRAME_T12", FRAME_T12);
|
||||
def("FRAME_AT", FRAME_AT);
|
||||
def("FRAME_SP", FRAME_SP);
|
||||
off("TF_AF_PS", struct trapframe, tf_af.af_ps);
|
||||
off("TF_AF_PC", struct trapframe, tf_af.af_pc);
|
||||
off("TF_AF_A0", struct trapframe, tf_af.af_a0);
|
||||
off("TF_AF_A1", struct trapframe, tf_af.af_a1);
|
||||
off("TF_AF_A2", struct trapframe, tf_af.af_a2);
|
||||
|
||||
def("FRAME_SW_SIZE", FRAME_SW_SIZE);
|
||||
|
||||
def("FRAME_PS", FRAME_PS);
|
||||
def("FRAME_PC", FRAME_PC);
|
||||
def("FRAME_GP", FRAME_GP);
|
||||
def("FRAME_A0", FRAME_A0);
|
||||
def("FRAME_A1", FRAME_A1);
|
||||
def("FRAME_A2", FRAME_A2);
|
||||
|
||||
def("FRAME_SIZE", FRAME_SIZE);
|
||||
|
||||
/* bits of the PS register */
|
||||
def("ALPHA_PSL_USERMODE", ALPHA_PSL_USERMODE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: interrupt.c,v 1.7 1996/07/11 03:53:25 cgd Exp $ */
|
||||
/* $NetBSD: interrupt.c,v 1.8 1996/07/11 05:31:18 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -130,7 +130,7 @@ machine_check(framep, logoutp, vec)
|
|||
|
||||
if (!mc_expected)
|
||||
panic("machine check: vec 0x%lx, pc = 0x%lx, ra = 0x%lx",
|
||||
vec, framep->tf_af.af_pc, framep->tf_regs[FRAME_RA]);
|
||||
vec, framep->tf_regs[FRAME_PC], framep->tf_regs[FRAME_RA]);
|
||||
|
||||
mc_expected = 0;
|
||||
mc_received = 1;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore.s,v 1.17 1996/07/11 03:53:26 cgd Exp $ */
|
||||
/* $NetBSD: locore.s,v 1.18 1996/07/11 05:31:19 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -106,7 +106,7 @@ NESTED_NOPROFILE(__start,1,0,ra,0,0)
|
|||
* Note that setregs() is responsible for setting its contents
|
||||
* to 'reasonable' values.
|
||||
*/
|
||||
lda sp,-(FRAMESIZE)(sp) /* space for struct trapframe */
|
||||
lda sp,-(FRAME_SIZE * 8)(sp) /* space for struct trapframe */
|
||||
|
||||
mov sp, a0 /* main()'s arg is frame ptr */
|
||||
CALL(main) /* go to main()! */
|
||||
|
@ -186,7 +186,7 @@ LEAF(rei, 1) /* XXX should be NESTED */
|
|||
br pv, 1f
|
||||
1: SETGP(pv)
|
||||
|
||||
ldq s1, TF_AF_PS(sp) /* get the saved PS */
|
||||
ldq s1, (FRAME_PS * 8)(sp) /* get the saved PS */
|
||||
and s1, ALPHA_PSL_IPL_MASK, t0 /* look at the saved IPL */
|
||||
bne t0, Lrestoreregs /* != 0: can't do AST or SIR */
|
||||
|
||||
|
@ -258,7 +258,7 @@ Lrestoreregs:
|
|||
ldq t12,(FRAME_T12*8)(sp)
|
||||
ldq at_reg,(FRAME_AT*8)(sp)
|
||||
|
||||
lda sp,(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,(FRAME_SW_SIZE*8)(sp)
|
||||
call_pal PAL_OSF1_rti
|
||||
END(rei)
|
||||
|
||||
|
@ -271,7 +271,7 @@ Lrestoreregs:
|
|||
|
||||
LEAF(XentArith, 2) /* XXX should be NESTED */
|
||||
.set noat
|
||||
lda sp,-(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,-(FRAME_SW_SIZE*8)(sp)
|
||||
stq v0,(FRAME_V0*8)(sp)
|
||||
stq t0,(FRAME_T0*8)(sp)
|
||||
stq t1,(FRAME_T1*8)(sp)
|
||||
|
@ -327,7 +327,7 @@ LEAF(XentArith, 2) /* XXX should be NESTED */
|
|||
|
||||
LEAF(XentIF, 1) /* XXX should be NESTED */
|
||||
.set noat
|
||||
lda sp,-(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,-(FRAME_SW_SIZE*8)(sp)
|
||||
stq v0,(FRAME_V0*8)(sp)
|
||||
stq t0,(FRAME_T0*8)(sp)
|
||||
stq t1,(FRAME_T1*8)(sp)
|
||||
|
@ -366,7 +366,7 @@ LEAF(XentIF, 1) /* XXX should be NESTED */
|
|||
|
||||
or s0, T_IFLT, a0 /* type = T_IFLT|type*/
|
||||
mov s0, a1 /* code = type */
|
||||
ldq a2, TF_AF_PC(sp) /* v = frame's pc */
|
||||
ldq a2, (FRAME_PC * 8)(sp) /* v = frame's pc */
|
||||
mov sp, a3 /* frame */
|
||||
CALL(trap)
|
||||
|
||||
|
@ -382,7 +382,7 @@ LEAF(XentIF, 1) /* XXX should be NESTED */
|
|||
|
||||
LEAF(XentInt, 2) /* XXX should be NESTED */
|
||||
.set noat
|
||||
lda sp,-(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,-(FRAME_SW_SIZE*8)(sp)
|
||||
stq v0,(FRAME_V0*8)(sp)
|
||||
stq t0,(FRAME_T0*8)(sp)
|
||||
stq t1,(FRAME_T1*8)(sp)
|
||||
|
@ -439,7 +439,7 @@ LEAF(XentInt, 2) /* XXX should be NESTED */
|
|||
|
||||
LEAF(XentMM, 3) /* XXX should be NESTED */
|
||||
.set noat
|
||||
lda sp,-(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,-(FRAME_SW_SIZE*8)(sp)
|
||||
stq v0,(FRAME_V0*8)(sp)
|
||||
stq t0,(FRAME_T0*8)(sp)
|
||||
stq t1,(FRAME_T1*8)(sp)
|
||||
|
@ -496,7 +496,7 @@ LEAF(XentMM, 3) /* XXX should be NESTED */
|
|||
|
||||
LEAF(XentSys, 0) /* XXX should be NESTED */
|
||||
.set noat
|
||||
lda sp,-(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,-(FRAME_SW_SIZE*8)(sp)
|
||||
stq v0,(FRAME_V0*8)(sp) /* in case we need to restart */
|
||||
stq s0,(FRAME_S0*8)(sp)
|
||||
stq s1,(FRAME_S1*8)(sp)
|
||||
|
@ -505,9 +505,9 @@ LEAF(XentSys, 0) /* XXX should be NESTED */
|
|||
stq s4,(FRAME_S4*8)(sp)
|
||||
stq s5,(FRAME_S5*8)(sp)
|
||||
stq s6,(FRAME_S6*8)(sp)
|
||||
stq a0,TF_AF_A0(sp)
|
||||
stq a1,TF_AF_A1(sp)
|
||||
stq a2,TF_AF_A2(sp)
|
||||
stq a0,(FRAME_A0 * 8)(sp)
|
||||
stq a1,(FRAME_A1 * 8)(sp)
|
||||
stq a2,(FRAME_A2 * 8)(sp)
|
||||
stq a3,(FRAME_A3*8)(sp)
|
||||
stq a4,(FRAME_A4*8)(sp)
|
||||
stq a5,(FRAME_A5*8)(sp)
|
||||
|
@ -540,7 +540,7 @@ LEAF(XentSys, 0) /* XXX should be NESTED */
|
|||
|
||||
LEAF(XentUna, 3) /* XXX should be NESTED */
|
||||
.set noat
|
||||
lda sp,-(FRAME_NSAVEREGS*8)(sp)
|
||||
lda sp,-(FRAME_SW_SIZE*8)(sp)
|
||||
stq v0,(FRAME_V0*8)(sp)
|
||||
stq t0,(FRAME_T0*8)(sp)
|
||||
stq t1,(FRAME_T1*8)(sp)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.33 1996/07/11 03:53:29 cgd Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.34 1996/07/11 05:31:21 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -913,9 +913,9 @@ frametoreg(framep, regp)
|
|||
regp->r_regs[R_S4] = framep->tf_regs[FRAME_S4];
|
||||
regp->r_regs[R_S5] = framep->tf_regs[FRAME_S5];
|
||||
regp->r_regs[R_S6] = framep->tf_regs[FRAME_S6];
|
||||
regp->r_regs[R_A0] = framep->tf_af.af_a0;
|
||||
regp->r_regs[R_A1] = framep->tf_af.af_a1;
|
||||
regp->r_regs[R_A2] = framep->tf_af.af_a2;
|
||||
regp->r_regs[R_A0] = framep->tf_regs[FRAME_A0];
|
||||
regp->r_regs[R_A1] = framep->tf_regs[FRAME_A1];
|
||||
regp->r_regs[R_A2] = framep->tf_regs[FRAME_A2];
|
||||
regp->r_regs[R_A3] = framep->tf_regs[FRAME_A3];
|
||||
regp->r_regs[R_A4] = framep->tf_regs[FRAME_A4];
|
||||
regp->r_regs[R_A5] = framep->tf_regs[FRAME_A5];
|
||||
|
@ -926,7 +926,7 @@ frametoreg(framep, regp)
|
|||
regp->r_regs[R_RA] = framep->tf_regs[FRAME_RA];
|
||||
regp->r_regs[R_T12] = framep->tf_regs[FRAME_T12];
|
||||
regp->r_regs[R_AT] = framep->tf_regs[FRAME_AT];
|
||||
regp->r_regs[R_GP] = framep->tf_af.af_gp;
|
||||
regp->r_regs[R_GP] = framep->tf_regs[FRAME_GP];
|
||||
regp->r_regs[R_SP] = framep->tf_regs[FRAME_SP];
|
||||
regp->r_regs[R_ZERO] = 0;
|
||||
}
|
||||
|
@ -953,9 +953,9 @@ regtoframe(regp, framep)
|
|||
framep->tf_regs[FRAME_S4] = regp->r_regs[R_S4];
|
||||
framep->tf_regs[FRAME_S5] = regp->r_regs[R_S5];
|
||||
framep->tf_regs[FRAME_S6] = regp->r_regs[R_S6];
|
||||
framep->tf_af.af_a0 = regp->r_regs[R_A0];
|
||||
framep->tf_af.af_a1 = regp->r_regs[R_A1];
|
||||
framep->tf_af.af_a2 = regp->r_regs[R_A2];
|
||||
framep->tf_regs[FRAME_A0] = regp->r_regs[R_A0];
|
||||
framep->tf_regs[FRAME_A1] = regp->r_regs[R_A1];
|
||||
framep->tf_regs[FRAME_A2] = regp->r_regs[R_A2];
|
||||
framep->tf_regs[FRAME_A3] = regp->r_regs[R_A3];
|
||||
framep->tf_regs[FRAME_A4] = regp->r_regs[R_A4];
|
||||
framep->tf_regs[FRAME_A5] = regp->r_regs[R_A5];
|
||||
|
@ -966,7 +966,7 @@ regtoframe(regp, framep)
|
|||
framep->tf_regs[FRAME_RA] = regp->r_regs[R_RA];
|
||||
framep->tf_regs[FRAME_T12] = regp->r_regs[R_T12];
|
||||
framep->tf_regs[FRAME_AT] = regp->r_regs[R_AT];
|
||||
framep->tf_af.af_gp = regp->r_regs[R_GP];
|
||||
framep->tf_regs[FRAME_GP] = regp->r_regs[R_GP];
|
||||
framep->tf_regs[FRAME_SP] = regp->r_regs[R_SP];
|
||||
/* ??? = regp->r_regs[R_ZERO]; */
|
||||
}
|
||||
|
@ -1067,8 +1067,8 @@ sendsig(catcher, sig, mask, code)
|
|||
*/
|
||||
ksc.sc_onstack = oonstack;
|
||||
ksc.sc_mask = mask;
|
||||
ksc.sc_pc = frame->tf_af.af_pc;
|
||||
ksc.sc_ps = frame->tf_af.af_ps;
|
||||
ksc.sc_pc = frame->tf_regs[FRAME_PC];
|
||||
ksc.sc_ps = frame->tf_regs[FRAME_PS];
|
||||
|
||||
/* copy the registers. */
|
||||
frametoreg(frame, (struct reg *)ksc.sc_regs);
|
||||
|
@ -1108,17 +1108,18 @@ sendsig(catcher, sig, mask, code)
|
|||
/*
|
||||
* Set up the registers to return to sigcode.
|
||||
*/
|
||||
frame->tf_af.af_pc = (u_int64_t)PS_STRINGS - (esigcode - sigcode);
|
||||
frame->tf_regs[FRAME_PC] =
|
||||
(u_int64_t)PS_STRINGS - (esigcode - sigcode);
|
||||
frame->tf_regs[FRAME_SP] = (u_int64_t)scp;
|
||||
frame->tf_af.af_a0 = sig;
|
||||
frame->tf_af.af_a1 = code;
|
||||
frame->tf_af.af_a2 = (u_int64_t)scp;
|
||||
frame->tf_regs[FRAME_A0] = sig;
|
||||
frame->tf_regs[FRAME_A1] = code;
|
||||
frame->tf_regs[FRAME_A2] = (u_int64_t)scp;
|
||||
frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */
|
||||
|
||||
#ifdef DEBUG
|
||||
if (sigdebug & SDB_FOLLOW)
|
||||
printf("sendsig(%d): pc %lx, catcher %lx\n", p->p_pid,
|
||||
frame->tf_af.af_pc, frame->tf_regs[FRAME_A3]);
|
||||
frame->tf_regs[FRAME_PC], frame->tf_regs[FRAME_A3]);
|
||||
if ((sigdebug & SDB_KSTACK) && p->p_pid == sigpid)
|
||||
printf("sendsig(%d): sig %d returns\n",
|
||||
p->p_pid, sig);
|
||||
|
@ -1176,8 +1177,8 @@ sys_sigreturn(p, v, retval)
|
|||
p->p_sigacts->ps_sigstk.ss_flags &= ~SS_ONSTACK;
|
||||
p->p_sigmask = ksc.sc_mask &~ sigcantmask;
|
||||
|
||||
p->p_md.md_tf->tf_af.af_pc = ksc.sc_pc;
|
||||
p->p_md.md_tf->tf_af.af_ps =
|
||||
p->p_md.md_tf->tf_regs[FRAME_PC] = ksc.sc_pc;
|
||||
p->p_md.md_tf->tf_regs[FRAME_PS] =
|
||||
(ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR;
|
||||
|
||||
regtoframe((struct reg *)ksc.sc_regs, p->p_md.md_tf);
|
||||
|
@ -1248,25 +1249,17 @@ setregs(p, pack, stack, retval)
|
|||
extern struct proc *fpcurproc;
|
||||
|
||||
#ifdef DEBUG
|
||||
for (i = 0; i < FRAME_NSAVEREGS; i++)
|
||||
for (i = 0; i < FRAME_SIZE; i++)
|
||||
tfp->tf_regs[i] = 0xbabefacedeadbeef;
|
||||
tfp->tf_af.af_gp = 0xbabefacedeadbeef;
|
||||
tfp->tf_af.af_a0 = 0xbabefacedeadbeef;
|
||||
tfp->tf_af.af_a1 = 0xbabefacedeadbeef;
|
||||
tfp->tf_af.af_a2 = 0xbabefacedeadbeef;
|
||||
#else
|
||||
bzero(tfp->tf_regs, FRAME_NSAVEREGS * sizeof tfp->tf_regs[0]);
|
||||
tfp->tf_af.af_gp = 0;
|
||||
tfp->tf_af.af_a0 = 0;
|
||||
tfp->tf_af.af_a1 = 0;
|
||||
tfp->tf_af.af_a2 = 0;
|
||||
bzero(tfp->tf_regs, FRAME_SIZE * sizeof tfp->tf_regs[0]);
|
||||
#endif
|
||||
bzero(&p->p_addr->u_pcb.pcb_fp, sizeof p->p_addr->u_pcb.pcb_fp);
|
||||
#define FP_RN 2 /* XXX */
|
||||
p->p_addr->u_pcb.pcb_fp.fpr_cr = (long)FP_RN << 58;
|
||||
tfp->tf_regs[FRAME_SP] = stack; /* restored to usp in trap return */
|
||||
tfp->tf_af.af_ps = ALPHA_PSL_USERSET;
|
||||
tfp->tf_af.af_pc = pack->ep_entry & ~3;
|
||||
tfp->tf_regs[FRAME_PS] = ALPHA_PSL_USERSET;
|
||||
tfp->tf_regs[FRAME_PC] = pack->ep_entry & ~3;
|
||||
|
||||
p->p_md.md_flags &= ~MDP_FPUSED;
|
||||
if (fpcurproc == p)
|
||||
|
@ -1455,7 +1448,7 @@ cpu_exec_ecoff_setregs(p, epp, stack, retval)
|
|||
struct ecoff_exechdr *execp = (struct ecoff_exechdr *)epp->ep_hdr;
|
||||
|
||||
setregs(p, epp, stack, retval);
|
||||
p->p_md.md_tf->tf_af.af_gp = execp->a.gp_value;
|
||||
p->p_md.md_tf->tf_regs[FRAME_GP] = execp->a.gp_value;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: process_machdep.c,v 1.5 1996/07/11 03:53:31 cgd Exp $ */
|
||||
/* $NetBSD: process_machdep.c,v 1.6 1996/07/11 05:31:23 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Christopher G. Demetriou
|
||||
|
@ -72,7 +72,7 @@ process_read_regs(p, regs)
|
|||
{
|
||||
|
||||
frametoreg(process_frame(p), regs);
|
||||
regs->r_regs[R_ZERO] = process_frame(p)->tf_af.af_pc;
|
||||
regs->r_regs[R_ZERO] = process_frame(p)->tf_regs[FRAME_PC];
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ process_write_regs(p, regs)
|
|||
struct reg *regs;
|
||||
{
|
||||
|
||||
process_frame(p)->tf_af.af_pc = regs->r_regs[R_ZERO];
|
||||
process_frame(p)->tf_regs[FRAME_PC] = regs->r_regs[R_ZERO];
|
||||
regtoframe(regs, process_frame(p));
|
||||
return (0);
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ process_set_pc(p, addr)
|
|||
{
|
||||
struct trapframe *frame = process_frame(p);
|
||||
|
||||
frame->tf_af.af_pc = (u_int64_t)addr;
|
||||
frame->tf_regs[FRAME_PC] = (u_int64_t)addr;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.7 1996/07/11 03:53:33 cgd Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.8 1996/07/11 05:31:24 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -113,7 +113,7 @@ trap(type, code, v, framep)
|
|||
cnt.v_trap++;
|
||||
p = curproc;
|
||||
ucode = 0;
|
||||
if ((framep->tf_af.af_ps & ALPHA_PSL_USERMODE) != 0) {
|
||||
if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) {
|
||||
type |= T_USER;
|
||||
sticks = p->p_sticks;
|
||||
p->p_md.md_tf = framep;
|
||||
|
@ -130,7 +130,7 @@ trap(type, code, v, framep)
|
|||
dopanic:
|
||||
printf("trap type %ld, code = 0x%lx, v = 0x%lx\n", type,
|
||||
code, v);
|
||||
printf("pc = 0x%lx\n", framep->tf_af.af_pc);
|
||||
printf("pc = 0x%lx\n", framep->tf_regs[FRAME_PC]);
|
||||
printf("curproc = 0x%lx\n", curproc);
|
||||
if (curproc != NULL)
|
||||
printf("curproc->p_pid = 0x%d\n", curproc->p_pid);
|
||||
|
@ -164,7 +164,7 @@ dopanic:
|
|||
if (p == NULL || p->p_addr->u_pcb.pcb_onfault == NULL)
|
||||
goto dopanic;
|
||||
else {
|
||||
framep->tf_af.af_pc = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
|
||||
framep->tf_regs[FRAME_PC] = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
|
||||
p->p_addr->u_pcb.pcb_onfault = NULL;
|
||||
}
|
||||
goto out;
|
||||
|
@ -198,7 +198,7 @@ sigfpe: i = SIGFPE;
|
|||
goto out;
|
||||
|
||||
case T_GENTRAP|T_USER:
|
||||
if (framep->tf_af.af_a0 == -2) /* weird! */
|
||||
if (framep->tf_regs[FRAME_A0] == -2) /* weird! */
|
||||
goto sigfpe;
|
||||
case T_BPT|T_USER:
|
||||
case T_BUGCHK|T_USER:
|
||||
|
@ -227,7 +227,7 @@ sigfpe: i = SIGFPE;
|
|||
/* if it was caused by fuswintr or suswintr, just punt. */
|
||||
if ((type & T_USER) == 0 && p != NULL &&
|
||||
p->p_addr->u_pcb.pcb_onfault == (caddr_t)fswintrberr) {
|
||||
framep->tf_af.af_pc = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
|
||||
framep->tf_regs[FRAME_PC] = (u_int64_t)p->p_addr->u_pcb.pcb_onfault;
|
||||
p->p_addr->u_pcb.pcb_onfault = NULL;
|
||||
goto out;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ sigfpe: i = SIGFPE;
|
|||
#ifdef VMFAULT_TRACE
|
||||
printf("vm_fault(0x%lx (pmap 0x%lx), 0x%lx (0x%lx), 0x%lx, %d) -> 0x%lx at pc 0x%lx\n",
|
||||
map, map == kernel_map ? pmap_kernel() : &vm->vm_pmap,
|
||||
va, v, ftype, FALSE, rv, framep->tf_af.af_pc);
|
||||
va, v, ftype, FALSE, rv, framep->tf_regs[FRAME_PC]);
|
||||
#endif
|
||||
/*
|
||||
* If this was a stack access we keep track of the maximum
|
||||
|
@ -284,10 +284,10 @@ sigfpe: i = SIGFPE;
|
|||
}
|
||||
if (rv == KERN_SUCCESS)
|
||||
goto out;
|
||||
if ((framep->tf_af.af_ps & ALPHA_PSL_USERMODE) == 0) {
|
||||
if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) {
|
||||
if (p != NULL &&
|
||||
p->p_addr->u_pcb.pcb_onfault != NULL) {
|
||||
framep->tf_af.af_pc =
|
||||
framep->tf_regs[FRAME_PC] =
|
||||
(u_int64_t)p->p_addr->u_pcb.pcb_onfault;
|
||||
p->p_addr->u_pcb.pcb_onfault = NULL;
|
||||
goto out;
|
||||
|
@ -316,7 +316,7 @@ sigfpe: i = SIGFPE;
|
|||
out:
|
||||
if ((type & T_USER) == 0)
|
||||
return;
|
||||
userret(p, framep->tf_af.af_pc, sticks);
|
||||
userret(p, framep->tf_regs[FRAME_PC], sticks);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -350,13 +350,13 @@ syscall(code, framep)
|
|||
#endif
|
||||
|
||||
#if notdef /* can't happen, ever. */
|
||||
if ((framep->tf_af.af_ps & ALPHA_PSL_USERMODE) == 0) {
|
||||
if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) {
|
||||
panic("syscall");
|
||||
#endif
|
||||
cnt.v_syscall++;
|
||||
p = curproc;
|
||||
p->p_md.md_tf = framep;
|
||||
opc = framep->tf_af.af_pc - 4;
|
||||
opc = framep->tf_regs[FRAME_PC] - 4;
|
||||
sticks = p->p_sticks;
|
||||
|
||||
callp = p->p_emul->e_sysent;
|
||||
|
@ -368,7 +368,7 @@ syscall(code, framep)
|
|||
switch (code) {
|
||||
case OSF1_SYS_syscall:
|
||||
/* OSF/1 syscall() */
|
||||
code = framep->tf_af.af_a0;
|
||||
code = framep->tf_regs[FRAME_A0];
|
||||
hidden = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -383,7 +383,7 @@ syscall(code, framep)
|
|||
* syscall() and __syscall() are handled the same on
|
||||
* the alpha, as everything is 64-bit aligned, anyway.
|
||||
*/
|
||||
code = framep->tf_af.af_a0;
|
||||
code = framep->tf_regs[FRAME_A0];
|
||||
hidden = 1;
|
||||
break;
|
||||
default:
|
||||
|
@ -410,11 +410,11 @@ syscall(code, framep)
|
|||
case 4:
|
||||
args[3] = framep->tf_regs[FRAME_A3];
|
||||
case 3:
|
||||
args[2] = framep->tf_af.af_a2;
|
||||
args[2] = framep->tf_regs[FRAME_A2];
|
||||
case 2:
|
||||
args[1] = framep->tf_af.af_a1;
|
||||
args[1] = framep->tf_regs[FRAME_A1];
|
||||
case 1:
|
||||
args[0] = framep->tf_af.af_a0;
|
||||
args[0] = framep->tf_regs[FRAME_A0];
|
||||
case 0:
|
||||
break;
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ syscall(code, framep)
|
|||
framep->tf_regs[FRAME_A3] = 0;
|
||||
break;
|
||||
case ERESTART:
|
||||
framep->tf_af.af_pc = opc;
|
||||
framep->tf_regs[FRAME_PC] = opc;
|
||||
break;
|
||||
case EJUSTRETURN:
|
||||
break;
|
||||
|
@ -457,7 +457,7 @@ syscall(code, framep)
|
|||
scdebug_ret(p, code, error, rval);
|
||||
#endif
|
||||
|
||||
userret(p, framep->tf_af.af_pc, sticks);
|
||||
userret(p, framep->tf_regs[FRAME_PC], sticks);
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_SYSRET))
|
||||
ktrsysret(p->p_tracep, code, error, rval[0]);
|
||||
|
@ -476,7 +476,7 @@ child_return(p)
|
|||
* Return values in the frame set by cpu_fork().
|
||||
*/
|
||||
|
||||
userret(p, p->p_md.md_tf->tf_af.af_pc, 0);
|
||||
userret(p, p->p_md.md_tf->tf_regs[FRAME_PC], 0);
|
||||
#ifdef KTRACE
|
||||
if (KTRPOINT(p, KTR_SYSRET))
|
||||
ktrsysret(p->p_tracep, SYS_fork, 0, 0);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: alpha_cpu.h,v 1.2 1996/07/11 03:44:50 cgd Exp $ */
|
||||
/* $NetBSD: alpha_cpu.h,v 1.3 1996/07/11 05:31:29 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -67,17 +67,24 @@ struct alpha_pcb {
|
|||
#define ALPHA_PCB_FLAGS_PME 0x4000000000000000
|
||||
|
||||
/*
|
||||
* Interrupt/Exception/Syscall Stack Frame
|
||||
* Interrupt/Exception/Syscall "Hardware" (really PALcode)
|
||||
* Stack Frame definitions
|
||||
*
|
||||
* These are quadword offsets from the sp on kernel entry, i.e.
|
||||
* to get to the value in question you access (sp + (offset * 8)).
|
||||
*
|
||||
* On syscall entry, A0-A2 aren't written to memory but space
|
||||
* _is_ reserved for them.
|
||||
*/
|
||||
|
||||
struct alpha_frame {
|
||||
unsigned long af_ps; /* processor status */
|
||||
unsigned long af_pc; /* program counter */
|
||||
unsigned long af_gp; /* GP */
|
||||
unsigned long af_a0; /* A0 */
|
||||
unsigned long af_a1; /* A1 */
|
||||
unsigned long af_a2; /* A2 */
|
||||
};
|
||||
#define ALPHA_HWFRAME_PS 0 /* processor status register */
|
||||
#define ALPHA_HWFRAME_PC 1 /* program counter */
|
||||
#define ALPHA_HWFRAME_GP 2 /* global pointer */
|
||||
#define ALPHA_HWFRAME_A0 3 /* a0 */
|
||||
#define ALPHA_HWFRAME_A1 4 /* a1 */
|
||||
#define ALPHA_HWFRAME_A2 5 /* a2 */
|
||||
|
||||
#define ALPHA_HWFRAME_SIZE 6 /* 6 8-byte words */
|
||||
|
||||
/*
|
||||
* Processor Status Register [OSF/1 PALcode Specific]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cpu.h,v 1.10 1996/07/11 03:46:00 cgd Exp $ */
|
||||
/* $NetBSD: cpu.h,v 1.11 1996/07/11 05:31:30 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -66,10 +66,10 @@ struct clockframe {
|
|||
struct trapframe cf_tf;
|
||||
};
|
||||
#define CLKF_USERMODE(framep) \
|
||||
(((framep)->cf_tf.tf_af.af_ps & ALPHA_PSL_USERMODE) != 0)
|
||||
(((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0)
|
||||
#define CLKF_BASEPRI(framep) \
|
||||
(((framep)->cf_tf.tf_af.af_ps & ALPHA_PSL_IPL_MASK) == 0)
|
||||
#define CLKF_PC(framep) ((framep)->cf_tf.tf_af.af_pc)
|
||||
(((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_IPL_MASK) == 0)
|
||||
#define CLKF_PC(framep) ((framep)->cf_tf.tf_regs[FRAME_PC])
|
||||
/*
|
||||
* XXX No way to accurately tell if we were in interrupt mode before taking
|
||||
* clock interrupt.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_machdep.h,v 1.1 1995/11/23 02:35:54 cgd Exp $ */
|
||||
/* $NetBSD: db_machdep.h,v 1.2 1996/07/11 05:31:31 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Carnegie-Mellon University.
|
||||
|
@ -45,12 +45,12 @@ typedef struct trapframe db_regs_t;
|
|||
db_regs_t ddb_regs; /* register state */
|
||||
#define DDB_REGS (&ddb_regs)
|
||||
|
||||
#define PC_REGS(regs) ((db_addr_t)(regs)->tf_pc)
|
||||
#define PC_REGS(regs) ((db_addr_t)(regs)->tf_regs[FRAME_PC])
|
||||
|
||||
#define BKPT_INST 0x00000080 /* breakpoint instruction */
|
||||
#define BKPT_SIZE (4) /* size of breakpoint inst */
|
||||
#define BKPT_SET(inst) (BKPT_INST)
|
||||
|
||||
#define FIXUP_PC_AFTER_BREAK ddb_regs.tf_pc -= BKPT_SIZE;
|
||||
#define FIXUP_PC_AFTER_BREAK ddb_regs.tf_regs[FRAME_PC] -= BKPT_SIZE;
|
||||
|
||||
#endif /* _ALPHA_DB_MACHDEP_H_ */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: frame.h,v 1.2 1996/07/11 03:46:02 cgd Exp $ */
|
||||
/* $NetBSD: frame.h,v 1.3 1996/07/11 05:31:32 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -33,18 +33,19 @@
|
|||
#include <machine/alpha_cpu.h>
|
||||
|
||||
/*
|
||||
* Trap and syscall frame.
|
||||
* Software trap, exception, and syscall frame.
|
||||
*
|
||||
* Hardware puts fields marked "[HW]" on stack. We have to add
|
||||
* all of the general-purpose registers except for zero, for sp,
|
||||
* which is automatically saved in usp for traps, and implicitly
|
||||
* saved for syscalls, and for a0-a2, which are saved by hardware.
|
||||
* Includes "hardware" (PALcode) frame.
|
||||
*
|
||||
* PALcode puts ALPHA_HWFRAME_* fields on stack. We have to add
|
||||
* all of the general-purpose registers except for zero, for sp
|
||||
* (which is automatically saved in the PCB's USP field for entries
|
||||
* from user mode, and which is implicitly saved and restored by the
|
||||
* calling conventions for entries from kernel mode), and (on traps
|
||||
* and exceptions) for a0, a1, and a2 (which are saved by PALcode).
|
||||
*/
|
||||
|
||||
/* Number of registers saved, including padding. */
|
||||
#define FRAME_NSAVEREGS 28
|
||||
|
||||
/* The offsets of the registers to be saved, into the array. */
|
||||
/* Quadword offsets of the registers to be saved. */
|
||||
#define FRAME_V0 0
|
||||
#define FRAME_T0 1
|
||||
#define FRAME_T1 2
|
||||
|
@ -72,11 +73,22 @@
|
|||
#define FRAME_T12 24
|
||||
#define FRAME_AT 25
|
||||
#define FRAME_SP 26
|
||||
#define FRAME_SPARE 27 /* spare; padding */
|
||||
|
||||
#define FRAME_SW_SIZE (FRAME_SP + 1)
|
||||
#define FRAME_HW_OFFSET FRAME_SW_SIZE
|
||||
|
||||
#define FRAME_PS (FRAME_HW_OFFSET + ALPHA_HWFRAME_PS)
|
||||
#define FRAME_PC (FRAME_HW_OFFSET + ALPHA_HWFRAME_PC)
|
||||
#define FRAME_GP (FRAME_HW_OFFSET + ALPHA_HWFRAME_GP)
|
||||
#define FRAME_A0 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A0)
|
||||
#define FRAME_A1 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A1)
|
||||
#define FRAME_A2 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A2)
|
||||
|
||||
#define FRAME_HW_SIZE ALPHA_HWFRAME_SIZE
|
||||
#define FRAME_SIZE (FRAME_HW_OFFSET + FRAME_HW_SIZE)
|
||||
|
||||
struct trapframe {
|
||||
u_int64_t tf_regs[FRAME_NSAVEREGS]; /* GPRs (listed above) */
|
||||
struct alpha_frame tf_af; /* hardware-defined frame */
|
||||
unsigned long tf_regs[FRAME_SIZE]; /* See above */
|
||||
};
|
||||
|
||||
#endif /* _ALPHA_FRAME_H_ */
|
||||
|
|
Loading…
Reference in New Issue