Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/alpha have to take care to have a valid SP va...



details:   https://anonhg.NetBSD.org/src/rev/6dba31ed2833
branches:  trunk
changeset: 472849:6dba31ed2833
user:      cgd <cgd%NetBSD.org@localhost>
date:      Mon May 10 01:27:28 1999 +0000

description:
have to take care to have a valid SP value in the unaligned fixup and
opdec (emulation) handlers.

diffstat:

 sys/arch/alpha/alpha/trap.c |  30 ++++++++++++++++++++++++++++--
 1 files changed, 28 insertions(+), 2 deletions(-)

diffs (72 lines):

diff -r a9509bfe1cae -r 6dba31ed2833 sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c       Sun May 09 22:48:35 1999 +0000
+++ b/sys/arch/alpha/alpha/trap.c       Mon May 10 01:27:28 1999 +0000
@@ -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>
@@ -968,6 +968,13 @@
        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.
         *
         * XXX In the future, this should have a per-process component
@@ -1107,6 +1114,11 @@
                signal = SIGBUS;
 
 out:
+       /*
+        * Write back USP.
+        */
+       alpha_pal_wrusp(p->p_md.md_tf->tf_regs[FRAME_SP]);
+
        return (signal);
 }
 
@@ -1132,6 +1144,13 @@
        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 @@
                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:



Home | Main Index | Thread Index | Old Index