Source-Changes-HG archive

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

[src/trunk]: src/sys Remove the second argument from USERMODE and KERNELMODE, ...



details:   https://anonhg.NetBSD.org/src/rev/c41ca4d89011
branches:  trunk
changeset: 356320:c41ca4d89011
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Sep 17 09:41:35 2017 +0000

description:
Remove the second argument from USERMODE and KERNELMODE, it is unused
now that we don't have vm86 anymore.

diffstat:

 sys/arch/amd64/amd64/netbsd32_machdep.c    |   8 ++++----
 sys/arch/amd64/amd64/trap.c                |   8 ++++----
 sys/arch/amd64/include/cpu.h               |   5 ++---
 sys/arch/amd64/include/segments.h          |   8 ++++----
 sys/arch/i386/i386/compat_13_machdep.c     |   6 +++---
 sys/arch/i386/i386/compat_16_machdep.c     |   6 +++---
 sys/arch/i386/i386/db_interface.c          |  10 +++++-----
 sys/arch/i386/i386/machdep.c               |   6 +++---
 sys/arch/i386/i386/process_machdep.c       |   6 +++---
 sys/arch/i386/i386/trap.c                  |  10 +++++-----
 sys/arch/i386/include/cpu.h                |   4 ++--
 sys/arch/i386/include/segments.h           |   6 +++---
 sys/arch/x86/x86/fpu.c                     |   8 ++++----
 sys/arch/x86/x86/kgdb_machdep.c            |   8 ++++----
 sys/compat/freebsd/freebsd_machdep.c       |   6 +++---
 sys/compat/linux/arch/i386/linux_machdep.c |   6 +++---
 16 files changed, 55 insertions(+), 56 deletions(-)

diffs (truncated from 482 to 300 lines):

diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c   Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c   Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.108 2017/08/31 15:41:14 maxv Exp $      */
+/*     $NetBSD: netbsd32_machdep.c,v 1.109 2017/09/17 09:41:35 maxv Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.108 2017/08/31 15:41:14 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.109 2017/09/17 09:41:35 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1061,7 +1061,7 @@
 
        if (__predict_false(pmap->pm_ldt != NULL)) {
                /* Only when the LDT is user-set (with USER_LDT) */
-               if (!USERMODE(scp->sc_cs, scp->sc_eflags))
+               if (!USERMODE(scp->sc_cs))
                        return EINVAL;
        } else {
                if (!VALID_USER_CSEL32(scp->sc_cs))
@@ -1098,7 +1098,7 @@
 
 #ifdef USER_LDT
        /* Userland is allowed to have unfamiliar segment register values */
-       if (!USERMODE(gr[_REG32_CS], gr[_REG32_EFL]))
+       if (!USERMODE(gr[_REG32_CS]))
                return EINVAL;
 #else
        struct pcb *pcb = lwp_getpcb(l);
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/amd64/amd64/trap.c
--- a/sys/arch/amd64/amd64/trap.c       Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/amd64/amd64/trap.c       Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: trap.c,v 1.100 2017/09/15 17:22:09 maxv Exp $  */
+/*     $NetBSD: trap.c,v 1.101 2017/09/17 09:41:35 maxv Exp $  */
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.100 2017/09/15 17:22:09 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.101 2017/09/17 09:41:35 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -290,7 +290,7 @@
                 * The stack frame containing the user registers is
                 * still valid and pointed to by tf_rsp.
                 */
-               if (KERNELMODE(vframe->tf_cs, vframe->tf_eflags))
+               if (KERNELMODE(vframe->tf_cs))
                        return;
                /* There is no valid address for the fault */
                break;
@@ -354,7 +354,7 @@
        }
        type = frame->tf_trapno;
 
-       if (!KERNELMODE(frame->tf_cs, frame->tf_rflags)) {
+       if (!KERNELMODE(frame->tf_cs)) {
                type |= T_USER;
                l->l_md.md_regs = frame;
                LWP_CACHE_CREDS(l, p);
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/amd64/include/cpu.h
--- a/sys/arch/amd64/include/cpu.h      Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/amd64/include/cpu.h      Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.h,v 1.60 2012/01/21 16:48:56 chs Exp $     */
+/*     $NetBSD: cpu.h,v 1.61 2017/09/17 09:41:35 maxv Exp $    */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -83,8 +83,7 @@
 }
 #endif /* __GNUC__ && !_MODULE */
 
-#define        CLKF_USERMODE(frame)    USERMODE((frame)->cf_if.if_tf.tf_cs, \
-                                   (frame)->cf_if.if_tf.tf_rflags)
+#define        CLKF_USERMODE(frame)    USERMODE((frame)->cf_if.if_tf.tf_cs)
 #define CLKF_PC(frame)         ((frame)->cf_if.if_tf.tf_rip)
 #define CLKF_INTR(frame)       (curcpu()->ci_idepth > 0)
 #define LWP_PC(l)              ((l)->l_md.md_regs->tf_rip)
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/amd64/include/segments.h
--- a/sys/arch/amd64/include/segments.h Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/amd64/include/segments.h Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: segments.h,v 1.29 2017/02/05 08:58:39 maxv Exp $       */
+/*     $NetBSD: segments.h,v 1.30 2017/09/17 09:41:35 maxv Exp $       */
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -129,15 +129,15 @@
 
 #define LSEL(s,r)      ((s) | r | SEL_LDT)
 
-#define USERMODE(c, f)         (ISPL(c) == SEL_UPL)
+#define USERMODE(c)            (ISPL(c) == SEL_UPL)
 #ifdef XEN
 /*
  * As KPL == UPL, Xen emulate interrupt in kernel context by pushing
  * a fake CS with XPL privilege
  */
-#define KERNELMODE(c, f)       (ISPL(c) == SEL_XPL)
+#define KERNELMODE(c)          (ISPL(c) == SEL_XPL)
 #else
-#define KERNELMODE(c, f)       (ISPL(c) == SEL_KPL)
+#define KERNELMODE(c)          (ISPL(c) == SEL_KPL)
 #endif
 
 #ifndef _LOCORE
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/i386/i386/compat_13_machdep.c
--- a/sys/arch/i386/i386/compat_13_machdep.c    Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/i386/i386/compat_13_machdep.c    Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_13_machdep.c,v 1.26 2017/08/12 07:07:53 maxv Exp $      */
+/*     $NetBSD: compat_13_machdep.c,v 1.27 2017/09/17 09:41:35 maxv Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.26 2017/08/12 07:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.27 2017/09/17 09:41:35 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -73,7 +73,7 @@
         * the trap, rather than doing all of the checking here.
         */
        if (((context.sc_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
-           !USERMODE(context.sc_cs, context.sc_eflags))
+           !USERMODE(context.sc_cs))
                return (EINVAL);
 
        tf->tf_gs = context.sc_gs;
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/i386/i386/compat_16_machdep.c
--- a/sys/arch/i386/i386/compat_16_machdep.c    Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/i386/i386/compat_16_machdep.c    Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat_16_machdep.c,v 1.29 2017/08/12 07:07:53 maxv Exp $      */
+/*     $NetBSD: compat_16_machdep.c,v 1.30 2017/09/17 09:41:35 maxv Exp $      */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.29 2017/08/12 07:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.30 2017/09/17 09:41:35 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -96,7 +96,7 @@
         * the trap, rather than doing all of the checking here.
         */
        if (((context.sc_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
-           !USERMODE(context.sc_cs, context.sc_eflags))
+           !USERMODE(context.sc_cs))
                return (EINVAL);
 
        tf->tf_gs = context.sc_gs;
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/i386/i386/db_interface.c
--- a/sys/arch/i386/i386/db_interface.c Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/i386/i386/db_interface.c Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_interface.c,v 1.75 2017/09/17 09:04:51 maxv Exp $   */
+/*     $NetBSD: db_interface.c,v 1.76 2017/09/17 09:41:35 maxv Exp $   */
 
 /*
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.75 2017/09/17 09:04:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.76 2017/09/17 09:41:35 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -228,7 +228,7 @@
 #endif
        /* XXX Should switch to kdb's own stack here. */
        ddb_regs = *regs;
-       if (!(flags & TC_TSS) && KERNELMODE(regs->tf_cs, regs->tf_eflags)) {
+       if (!(flags & TC_TSS) && KERNELMODE(regs->tf_cs)) {
                /*
                 * Kernel mode - esp and ss not saved
                 */
@@ -270,7 +270,7 @@
        regs->tf_eip    = ddb_regs.tf_eip;
        regs->tf_cs     = ddb_regs.tf_cs;
        regs->tf_eflags = ddb_regs.tf_eflags;
-       if (!(flags & TC_TSS) && !KERNELMODE(regs->tf_cs, regs->tf_eflags)) {
+       if (!(flags & TC_TSS) && !KERNELMODE(regs->tf_cs)) {
                /* ring transit - saved esp and ss valid */
                regs->tf_esp    = ddb_regs.tf_esp;
                regs->tf_ss     = ddb_regs.tf_ss;
@@ -338,7 +338,7 @@
        regs = *frame;
        flags = regs.tf_err & TC_FLAGMASK;
        regs.tf_err &= ~TC_FLAGMASK;
-       if (!(flags & TC_TSS) && KERNELMODE(regs.tf_cs, regs.tf_eflags)) {
+       if (!(flags & TC_TSS) && KERNELMODE(regs.tf_cs)) {
                /*
                 * Kernel mode - esp and ss not saved
                 */
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/i386/i386/machdep.c      Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.793 2017/09/17 09:04:51 maxv Exp $       */
+/*     $NetBSD: machdep.c,v 1.794 2017/09/17 09:41:35 maxv Exp $       */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.793 2017/09/17 09:04:51 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.794 2017/09/17 09:41:35 maxv Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_freebsd.h"
@@ -1571,7 +1571,7 @@
         * all of the checking here.
         */
        if (((gr[_REG_EFL] ^ tf->tf_eflags) & PSL_USERSTATIC) ||
-           !USERMODE(gr[_REG_CS], gr[_REG_EFL]))
+           !USERMODE(gr[_REG_CS]))
                return EINVAL;
 
        return 0;
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/i386/i386/process_machdep.c
--- a/sys/arch/i386/i386/process_machdep.c      Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/i386/i386/process_machdep.c      Sun Sep 17 09:41:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: process_machdep.c,v 1.90 2017/08/12 07:07:53 maxv Exp $        */
+/*     $NetBSD: process_machdep.c,v 1.91 2017/09/17 09:41:35 maxv Exp $        */
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.90 2017/08/12 07:07:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.91 2017/09/17 09:41:35 maxv Exp $");
 
 #include "opt_ptrace.h"
 
@@ -157,7 +157,7 @@
         * Check for security violations.
         */
        if (((regs->r_eflags ^ tf->tf_eflags) & PSL_USERSTATIC) != 0 ||
-           !USERMODE(regs->r_cs, regs->r_eflags))
+           !USERMODE(regs->r_cs))
                return (EINVAL);
 
        tf->tf_gs = regs->r_gs;
diff -r 03a18fe66082 -r c41ca4d89011 sys/arch/i386/i386/trap.c
--- a/sys/arch/i386/i386/trap.c Sun Sep 17 09:11:19 2017 +0000
+++ b/sys/arch/i386/i386/trap.c Sun Sep 17 09:41:35 2017 +0000
@@ -1,5 +1,5 @@
 
-/*     $NetBSD: trap.c,v 1.290 2017/09/12 14:10:49 gson Exp $  */
+/*     $NetBSD: trap.c,v 1.291 2017/09/17 09:41:35 maxv Exp $  */
 
 /*-
  * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -69,7 +69,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.290 2017/09/12 14:10:49 gson Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.291 2017/09/17 09:41:35 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -275,7 +275,7 @@
                trap_print(frame, l);
        }
 #endif
-       if (type != T_NMI && !KERNELMODE(frame->tf_cs, frame->tf_eflags)) {
+       if (type != T_NMI && !KERNELMODE(frame->tf_cs)) {
                type |= T_USER;
                l->l_md.md_regs = frame;
                pcb->pcb_cr2 = 0;



Home | Main Index | Thread Index | Old Index