Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sh3 fix KERNELMODE() macro (check MD bits, too)



details:   https://anonhg.NetBSD.org/src/rev/bf36de32aa6f
branches:  trunk
changeset: 511673:bf36de32aa6f
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Sun Jun 24 05:34:07 2001 +0000

description:
fix KERNELMODE() macro (check MD bits, too)

diffstat:

 sys/arch/sh3/include/cpu.h      |   8 ++------
 sys/arch/sh3/include/segments.h |  11 ++++-------
 sys/arch/sh3/sh3/trap.c         |  16 ++++------------
 3 files changed, 10 insertions(+), 25 deletions(-)

diffs (90 lines):

diff -r 60937c186672 -r bf36de32aa6f sys/arch/sh3/include/cpu.h
--- a/sys/arch/sh3/include/cpu.h        Sun Jun 24 05:32:55 2001 +0000
+++ b/sys/arch/sh3/include/cpu.h        Sun Jun 24 05:34:07 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.12 2001/05/30 12:28:50 mrg Exp $     */
+/*     $NetBSD: cpu.h,v 1.13 2001/06/24 05:34:07 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -90,11 +90,7 @@
  */
 #define clockframe intrframe
 
-#if 1
-#define        CLKF_USERMODE(frame)    (!KERNELMODE((frame)->if_r15))
-#else
-#define        CLKF_USERMODE(frame)    USERMODE((frame)->if_spc, (frame)->if_ssr)
-#endif
+#define        CLKF_USERMODE(frame)    (!KERNELMODE((frame)->if_r15, (frame)->if_ssr))
 #if 0
 #define        CLKF_BASEPRI(frame)     ((frame)->if_pri == 0)
 #else
diff -r 60937c186672 -r bf36de32aa6f sys/arch/sh3/include/segments.h
--- a/sys/arch/sh3/include/segments.h   Sun Jun 24 05:32:55 2001 +0000
+++ b/sys/arch/sh3/include/segments.h   Sun Jun 24 05:34:07 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: segments.h,v 1.1 1999/09/13 10:31:22 itojun Exp $      */
+/*     $NetBSD: segments.h,v 1.2 2001/06/24 05:34:07 msaitoh Exp $     */
 
 /*-
  * Copyright (c) 1995, 1997
@@ -57,11 +57,8 @@
 #define PSL_USERMODE 0 /* User mode */
 #define PSL_SVMODE   PSL_MD /* SuperVisor Mode */
 
-#define        USERMODE(c, f)          ((f & PSL_MD) == PSL_USERMODE)
-#if 1
-#define        KERNELMODE(sp)  (sp & 0x80000000)
-#else
-#define        KERNELMODE(c, f)        ((f & PSL_MD) == PSL_SVMODE)
-#endif
+#define        KERNELMODE(sp, f)       ((sp & 0x80000000) \
+                                && ((f & PSL_MD) == PSL_SVMODE))
+#define        USERMODE(sp, f)         (!KERNELMODE(sp, f))
 
 #endif /* !_SH3_SEGMENTS_H_ */
diff -r 60937c186672 -r bf36de32aa6f sys/arch/sh3/sh3/trap.c
--- a/sys/arch/sh3/sh3/trap.c   Sun Jun 24 05:32:55 2001 +0000
+++ b/sys/arch/sh3/sh3/trap.c   Sun Jun 24 05:34:07 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.26 2001/06/02 18:09:21 chs Exp $    */
+/*     $NetBSD: trap.c,v 1.27 2001/06/24 05:34:07 msaitoh Exp $        */
 
 /*-
  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
@@ -186,11 +186,7 @@
        }
 #endif
 
-#if 1
-       if (!KERNELMODE(frame.tf_r15)) {
-#else
-       if (!KERNELMODE(frame.tf_spc, frame.tf_ssr)) {
-#endif
+       if (!KERNELMODE(frame.tf_r15, frame.tf_ssr)) {
                type |= T_USER;
                sticks = p->p_sticks;
                p->p_md.md_regs = &frame;
@@ -425,11 +421,7 @@
        u_quad_t sticks;
 
        uvmexp.syscalls++;
-#if 1
-       if (KERNELMODE(frame->tf_r15))
-#else
-       if (!USERMODE(frame->tf_spc, frame->tf_ssr))
-#endif
+       if (KERNELMODE(frame->tf_r15, frame->tf_ssr))
                panic("syscall");
        p = curproc;
        sticks = p->p_sticks;
@@ -708,7 +700,7 @@
                printf("tlb_handler#:va(0x%lx),curproc(%p)\n", va, curproc);
 #endif
 
-       user = !KERNELMODE(frame.tf_r15);
+       user = !KERNELMODE(frame.tf_r15, frame.tf_ssr);
 
        pteh_save = SHREG_PTEH;
        va_save = va;



Home | Main Index | Thread Index | Old Index