have to take care to have a valid SP value in the unaligned fixup and
opdec (emulation) handlers.
This commit is contained in:
parent
ea2a114cf0
commit
b0f5f854e4
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.48 1999/05/09 19:43:58 cgd Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.49 1999/05/10 01:27:28 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
|
||||
|
@ -64,7 +64,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.48 1999/05/09 19:43:58 cgd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.49 1999/05/10 01:27:28 cgd Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -967,6 +967,13 @@ unaligned_fixup(va, opcode, reg, p)
|
|||
int intdata; /* signed to get extension when storing */
|
||||
u_int16_t worddata; /* unsigned to _avoid_ extension */
|
||||
|
||||
/*
|
||||
* Read USP into frame in case it's the register to be modified.
|
||||
* This keeps us from having to check for it in lots of places
|
||||
* later.
|
||||
*/
|
||||
p->p_md.md_tf->tf_regs[FRAME_SP] = alpha_pal_rdusp();
|
||||
|
||||
/*
|
||||
* Figure out what actions to take.
|
||||
*
|
||||
|
@ -1107,6 +1114,11 @@ unaligned_fixup(va, opcode, reg, p)
|
|||
signal = SIGBUS;
|
||||
|
||||
out:
|
||||
/*
|
||||
* Write back USP.
|
||||
*/
|
||||
alpha_pal_wrusp(p->p_md.md_tf->tf_regs[FRAME_SP]);
|
||||
|
||||
return (signal);
|
||||
}
|
||||
|
||||
|
@ -1132,6 +1144,13 @@ handle_opdec(p, ucodep)
|
|||
u_int64_t inst_pc;
|
||||
int sig;
|
||||
|
||||
/*
|
||||
* Read USP into frame in case it's going to be used or modified.
|
||||
* This keeps us from having to check for it in lots of places
|
||||
* later.
|
||||
*/
|
||||
p->p_md.md_tf->tf_regs[FRAME_SP] = alpha_pal_rdusp();
|
||||
|
||||
inst_pc = memaddr = p->p_md.md_tf->tf_regs[FRAME_PC] - 4;
|
||||
if (copyin((caddr_t)inst_pc, &inst, sizeof (inst)) != 0) {
|
||||
/*
|
||||
|
@ -1244,6 +1263,13 @@ handle_opdec(p, ucodep)
|
|||
goto sigill;
|
||||
}
|
||||
|
||||
/*
|
||||
* Write back USP. Note that in the error cases below,
|
||||
* nothing will have been successfully modified so we don't
|
||||
* have to write it out.
|
||||
*/
|
||||
alpha_pal_wrusp(p->p_md.md_tf->tf_regs[FRAME_SP]);
|
||||
|
||||
return (0);
|
||||
|
||||
sigill:
|
||||
|
|
Loading…
Reference in New Issue