Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh5/sh5 Validate the branch target registers and sa...



details:   https://anonhg.NetBSD.org/src/rev/c22d45b8e9cf
branches:  trunk
changeset: 533980:c22d45b8e9cf
user:      scw <scw%NetBSD.org@localhost>
date:      Thu Jul 11 21:23:30 2002 +0000

description:
Validate the branch target registers and saved PC using the
appropriate macro.

diffstat:

 sys/arch/sh5/sh5/sig_machdep.c |  8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diffs (37 lines):

diff -r 0be429d192f5 -r c22d45b8e9cf sys/arch/sh5/sh5/sig_machdep.c
--- a/sys/arch/sh5/sh5/sig_machdep.c    Thu Jul 11 21:21:58 2002 +0000
+++ b/sys/arch/sh5/sh5/sig_machdep.c    Thu Jul 11 21:23:30 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sig_machdep.c,v 1.4 2002/07/11 14:15:32 scw Exp $      */
+/*     $NetBSD: sig_machdep.c,v 1.5 2002/07/11 21:23:30 scw Exp $      */
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -154,7 +154,6 @@
        } */ *uap = v;
        struct sigcontext *scp, ksc;
        struct trapframe *tf;
-       register_t effmask;
        int i;
 
        tf = p->p_md.md_regs;
@@ -179,9 +178,8 @@
         * a kernel-mode exception when trying to restore invalid
         * values to them just before returning to user-mode.
         */
-       effmask = ~((1ULL << SH5_NEFF_BITS) - 1);
        for (i = 0; i < 8; i++) {
-               if ((llabs(ksc.sc_regs.r_tr[i]) & effmask) != 0 ||
+               if (!SH5_EFF_IS_VALID(ksc.sc_regs.r_tr[i]) ||
                    (ksc.sc_regs.r_tr[i] & 0x3) == 0x3)
                        return (EINVAL);
        }
@@ -189,7 +187,7 @@
        /*
         * Ditto for the PC
         */
-       if ((llabs(ksc.sc_regs.r_pc) & effmask) != 0 ||
+       if (!SH5_EFF_IS_VALID(ksc.sc_regs.r_pc) ||
            (ksc.sc_regs.r_pc & 0x3) == 0x3)
                return (EINVAL);
 



Home | Main Index | Thread Index | Old Index