Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Remove support for vm86 on i386. It is bug-friendly...



details:   https://anonhg.NetBSD.org/src/rev/67037e382bd8
branches:  trunk
changeset: 826037:67037e382bd8
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Aug 12 06:46:13 2017 +0000

description:
Remove support for vm86 on i386. It is bug-friendly, and there is no point
in having kernel support for this: the instruction set of the CPU is small,
and it can easily be emulated in userland entirely. There are also several
assumptions in the code that are not respected, and the slightest confusion
in the trap frame can lead to ring0 exploits.

vm86 has received zero maintenance. As far as I can tell, it was added
20 years ago in order to make doscmd work. But doscmd has not been
maintained either, and was removed from pkgsrc in 2011. dosbox can be used
instead: it does not require kernel support, and will produce better
results than our flimsy implementation.

Pass 1. (many pieces still in the tree)

diffstat:

 sys/arch/amd64/conf/ALL            |    5 +-
 sys/arch/i386/conf/ALL             |    5 +-
 sys/arch/i386/conf/GENERIC         |    5 +-
 sys/arch/i386/conf/GENERIC_PS2TINY |    3 +-
 sys/arch/i386/conf/GENERIC_TINY    |    3 +-
 sys/arch/i386/conf/INSTALL_FLOPPY  |    3 +-
 sys/arch/i386/conf/INSTALL_TINY    |    3 +-
 sys/arch/i386/conf/NET4501         |    5 +-
 sys/arch/i386/conf/XEN3_DOM0       |    3 +-
 sys/arch/i386/conf/XEN3_DOMU       |    3 +-
 sys/arch/i386/conf/files.i386      |    8 +-
 sys/arch/i386/i386/vm86.c          |  528 -------------------------------------
 12 files changed, 15 insertions(+), 559 deletions(-)

diffs (truncated from 762 to 300 lines):

diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/amd64/conf/ALL
--- a/sys/arch/amd64/conf/ALL   Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/amd64/conf/ALL   Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.65 2017/08/09 18:48:53 maxv Exp $
+# $NetBSD: ALL,v 1.66 2017/08/12 06:46:13 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,14 +17,13 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident         "ALL-$Revision: 1.65 $"
+#ident         "ALL-$Revision: 1.66 $"
 
 maxusers       64              # estimated number of users
 
 makeoptions    USE_SSP=yes
 
 # CPU-related options.
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 options        X86EMU          # 386 Real Mode emulator
 #options       PAE             # PAE mode (36 bits physical addressing)
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/ALL
--- a/sys/arch/i386/conf/ALL    Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/ALL    Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.425 2017/08/09 18:45:30 maxv Exp $
+# $NetBSD: ALL,v 1.426 2017/08/12 06:46:13 maxv Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,14 +17,13 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident         "ALL-$Revision: 1.425 $"
+#ident         "ALL-$Revision: 1.426 $"
 
 maxusers       64              # estimated number of users
 
 makeoptions    USE_SSP=yes
 
 # CPU-related options.
-options        VM86            # virtual 8086 emulation
 options        USER_LDT        # user-settable LDT; used by WINE
 options        X86EMU          # 386 Real Mode emulator
 options        PAE             # PAE mode (36 bits physical addressing)
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/GENERIC
--- a/sys/arch/i386/conf/GENERIC        Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/GENERIC        Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1164 2017/08/09 18:45:30 maxv Exp $
+# $NetBSD: GENERIC,v 1.1165 2017/08/12 06:46:13 maxv Exp $
 #
 # GENERIC machine description file
 #
@@ -22,12 +22,11 @@
 
 options        INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident         "GENERIC-$Revision: 1.1164 $"
+#ident         "GENERIC-$Revision: 1.1165 $"
 
 maxusers       64              # estimated number of users
 
 # CPU-related options.
-#options       VM86            # virtual 8086 emulation
 options        USER_LDT        # user-settable LDT; used by WINE
 #options       PAE             # PAE mode (36 bits physical addressing)
 
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/GENERIC_PS2TINY
--- a/sys/arch/i386/conf/GENERIC_PS2TINY        Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/GENERIC_PS2TINY        Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC_PS2TINY,v 1.77 2017/02/26 12:21:15 maya Exp $
+#      $NetBSD: GENERIC_PS2TINY,v 1.78 2017/08/12 06:46:13 maxv Exp $
 #
 #      GENERIC-style kernel config for IBM PS/2 with MCA bus. It only contains
 #      IBM PS/2 related stuff and has been generally trimmed down somewhat,
@@ -16,7 +16,6 @@
 maxusers       16              # estimated number of users
 
 # CPU-related options.
-options        VM86            # virtual 8086 emulation
 options        USER_LDT        # user-settable LDT; used by WINE
 
 # delay between "rebooting ..." message and hardware reset, in milliseconds
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/GENERIC_TINY
--- a/sys/arch/i386/conf/GENERIC_TINY   Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/GENERIC_TINY   Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: GENERIC_TINY,v 1.154 2017/08/10 17:33:32 maxv Exp $
+#      $NetBSD: GENERIC_TINY,v 1.155 2017/08/12 06:46:13 maxv Exp $
 #
 #      GENERIC_TINY -- suitable default for 4M machines
 #                      No EISA, PCI, or SCSI.
@@ -14,7 +14,6 @@
 maxusers       8               # estimated number of users
 
 # CPU-related options.
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 
 # This option allows you to force a serial console at the specified
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/INSTALL_FLOPPY
--- a/sys/arch/i386/conf/INSTALL_FLOPPY Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/INSTALL_FLOPPY Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALL_FLOPPY,v 1.40 2017/08/09 18:45:30 maxv Exp $
+#      $NetBSD: INSTALL_FLOPPY,v 1.41 2017/08/12 06:46:13 maxv Exp $
 #
 #      INSTALL - Installation kernel.
 #
@@ -27,7 +27,6 @@
 maxusers       2               # estimated number of users
 
 # CPU-related options.
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 
 # This option allows you to force a serial console at the specified
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/INSTALL_TINY
--- a/sys/arch/i386/conf/INSTALL_TINY   Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/INSTALL_TINY   Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: INSTALL_TINY,v 1.153 2017/08/09 18:45:30 maxv Exp $
+#      $NetBSD: INSTALL_TINY,v 1.154 2017/08/12 06:46:13 maxv Exp $
 #
 #      This kernel should be derived from INSTALL (which is derived
 #      from GENERIC) with some features commented out.
@@ -25,7 +25,6 @@
 maxusers       2               # estimated number of users
 
 # CPU-related options.
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 
 # This option allows you to force a serial console at the specified
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/NET4501
--- a/sys/arch/i386/conf/NET4501        Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/NET4501        Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: NET4501,v 1.97 2017/08/10 17:33:32 maxv Exp $
+# $NetBSD: NET4501,v 1.98 2017/08/12 06:46:13 maxv Exp $
 #
 # NET4501 -- kernel configuration for a Soekris Engineering net4501
 # single-board computer.
@@ -10,7 +10,7 @@
 
 #options       INCLUDE_CONFIG_FILE     # embed config file in kernel binary
 
-#ident                 "NET4501-$Revision: 1.97 $"
+#ident                 "NET4501-$Revision: 1.98 $"
 
 maxusers       32              # estimated number of users
 
@@ -20,7 +20,6 @@
 makeoptions    COPTS="-Os"
 
 # CPU-related options.
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 
 #options       MTRR            # memory-type range register syscall support
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/XEN3_DOM0
--- a/sys/arch/i386/conf/XEN3_DOM0      Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/XEN3_DOM0      Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: XEN3_DOM0,v 1.120 2017/08/10 17:33:32 maxv Exp $
+#      $NetBSD: XEN3_DOM0,v 1.121 2017/08/12 06:46:13 maxv Exp $
 #
 #      XEN3_0: Xen 3.0 domain0 kernel
 
@@ -28,7 +28,6 @@
 
 makeoptions    CPUFLAGS="-march=i686"
 
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 
 # CPU features
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/XEN3_DOMU
--- a/sys/arch/i386/conf/XEN3_DOMU      Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/XEN3_DOMU      Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOMU,v 1.84 2017/08/10 17:33:32 maxv Exp $
+# $NetBSD: XEN3_DOMU,v 1.85 2017/08/12 06:46:13 maxv Exp $
 
 include        "arch/xen/conf/std.xen"
 
@@ -18,7 +18,6 @@
 
 makeoptions    CPUFLAGS="-march=i686"
 
-#options       VM86            # virtual 8086 emulation
 #options       USER_LDT        # user-settable LDT; used by WINE
 
 #options       MTRR            # memory-type range register syscall support
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/conf/files.i386
--- a/sys/arch/i386/conf/files.i386     Sat Aug 12 03:29:23 2017 +0000
+++ b/sys/arch/i386/conf/files.i386     Sat Aug 12 06:46:13 2017 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.i386,v 1.384 2017/08/09 18:45:30 maxv Exp $
+#      $NetBSD: files.i386,v 1.385 2017/08/12 06:46:13 maxv Exp $
 #
 # new style config file for i386 architecture
 #
@@ -18,9 +18,6 @@
 # Obsolete Xbox support
 obsolete defflag       XBOX
 
-# VM86 emulation
-defflag                        VM86
-
 defflag                        PMC
 
 # User-settable LDT (used by WINE)
@@ -318,9 +315,6 @@
 # Compatibility modules
 #
 
-# VM86 mode
-file   arch/i386/i386/vm86.c                   vm86
-
 # Binary compatibility with previous NetBSD releases (COMPAT_XX)
 file   arch/i386/i386/compat_13_machdep.c      compat_13
 file   arch/i386/i386/compat_16_machdep.c      compat_16
diff -r 3d8f5bc16e82 -r 67037e382bd8 sys/arch/i386/i386/vm86.c
--- a/sys/arch/i386/i386/vm86.c Sat Aug 12 03:29:23 2017 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,528 +0,0 @@
-/*     $NetBSD: vm86.c,v 1.51 2009/11/21 03:11:00 rmind Exp $  */
-
-/*-
- * Copyright (c) 1996 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by John T. Kohl and Charles M. Hannum.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm86.c,v 1.51 2009/11/21 03:11:00 rmind Exp $");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/signalvar.h>
-#include <sys/kernel.h>
-#include <sys/proc.h>
-#include <sys/exec.h>
-#include <sys/buf.h>
-#include <sys/reboot.h>
-#include <sys/conf.h>
-#include <sys/file.h>
-#include <sys/callout.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/msgbuf.h>
-#include <sys/mount.h>
-#include <sys/vnode.h>
-#include <sys/device.h>
-#include <sys/syscallargs.h>
-#include <sys/ktrace.h>
-
-#include <machine/sysarch.h>
-#include <machine/vm86.h>
-
-static void fast_intxx(struct lwp *, int);
-static inline int is_bitset(int, void *);
-
-#define        CS(tf)          (*(u_short *)&tf->tf_cs)
-#define        IP(tf)          (*(u_short *)&tf->tf_eip)
-#define        SS(tf)          (*(u_short *)&tf->tf_ss)
-#define        SP(tf)          (*(u_short *)&tf->tf_esp)
-
-#define putword(base, ptr, val) \



Home | Main Index | Thread Index | Old Index