Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/pc532/pc532 Need to set/restore the PSR explicity i...



details:   https://anonhg.NetBSD.org/src/rev/f21a4f5349f2
branches:  trunk
changeset: 555683:f21a4f5349f2
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Nov 25 04:57:05 2003 +0000

description:
Need to set/restore the PSR explicity in cpu_{set,get}mcontext() since
it is a different size in mcontext_t and "struct reg".
Problem spotted by Christos Zoulas.

diffstat:

 sys/arch/pc532/pc532/machdep.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 79b0f8fe71c2 -r f21a4f5349f2 sys/arch/pc532/pc532/machdep.c
--- a/sys/arch/pc532/pc532/machdep.c    Tue Nov 25 03:40:18 2003 +0000
+++ b/sys/arch/pc532/pc532/machdep.c    Tue Nov 25 04:57:05 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.151 2003/11/06 02:25:07 christos Exp $   */
+/*     $NetBSD: machdep.c,v 1.152 2003/11/25 04:57:05 simonb Exp $     */
 
 /*-
  * Copyright (c) 1982, 1987, 1990 The Regents of the University of California.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.151 2003/11/06 02:25:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.152 2003/11/25 04:57:05 simonb Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -494,8 +494,10 @@
        mcontext_t *mcp;
        unsigned int *flags;
 {
+       struct reg *regs = l->l_md.md_regs;
 
-       (void)memcpy(mcp->__gregs, l->l_md.md_regs, sizeof (mcp->__gregs));
+       (void)memcpy(mcp->__gregs, regs, sizeof (mcp->__gregs));
+       mcp->__gregs[_REG_PS] = regs->r_psr;
        *flags |= _UC_CPU;
 
 #ifdef NS381
@@ -529,8 +531,9 @@
                if (((mcp->__gregs[_REG_PS] ^ regs->r_psr) & PSL_USERSTATIC)
                    != 0)
                        return (EINVAL);
-               (void)memcpy(l->l_md.md_regs, mcp->__gregs,
-                   sizeof (l->l_md.md_regs));
+               (void)memcpy(regs, mcp->__gregs, sizeof (*regs));
+               regs->r_mod = 0;
+               regs->r_psr = mcp->__gregs[_REG_PS];
        }
 
 #ifdef NS381



Home | Main Index | Thread Index | Old Index