Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Remove vm86. Simplifies a number of critical places.
details: https://anonhg.NetBSD.org/src/rev/031cfa83e150
branches: trunk
changeset: 355737:031cfa83e150
user: maxv <maxv%NetBSD.org@localhost>
date: Sat Aug 12 07:07:53 2017 +0000
description:
Remove vm86. Simplifies a number of critical places.
Pass 2.
diffstat:
sys/arch/i386/i386/compat_13_machdep.c | 56 +++++++---------------
sys/arch/i386/i386/compat_16_machdep.c | 76 +++++++++--------------------
sys/arch/i386/i386/i386_trap.S | 9 +--
sys/arch/i386/i386/machdep.c | 74 +++++++---------------------
sys/arch/i386/i386/process_machdep.c | 75 +++++++----------------------
sys/arch/i386/i386/spl.S | 14 +----
sys/arch/i386/i386/trap.c | 11 +---
sys/compat/freebsd/freebsd_machdep.c | 76 +++++++++--------------------
sys/compat/linux/arch/i386/linux_machdep.c | 73 ++++++++--------------------
9 files changed, 133 insertions(+), 331 deletions(-)
diffs (truncated from 776 to 300 lines):
diff -r 950064e1112d -r 031cfa83e150 sys/arch/i386/i386/compat_13_machdep.c
--- a/sys/arch/i386/i386/compat_13_machdep.c Sat Aug 12 06:46:13 2017 +0000
+++ b/sys/arch/i386/i386/compat_13_machdep.c Sat Aug 12 07:07:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_13_machdep.c,v 1.25 2009/11/21 03:11:00 rmind Exp $ */
+/* $NetBSD: compat_13_machdep.c,v 1.26 2017/08/12 07:07:53 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,11 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.25 2009/11/21 03:11:00 rmind Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_vm86.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.26 2017/08/12 07:07:53 maxv Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -47,10 +43,6 @@
#include <compat/sys/signal.h>
#include <compat/sys/signalvar.h>
-#ifdef VM86
-#include <machine/vm86.h>
-#endif
-
int
compat_13_sys_sigreturn(struct lwp *l, const struct compat_13_sys_sigreturn_args *uap, register_t *retval)
{
@@ -73,36 +65,24 @@
/* Restore register context. */
tf = l->l_md.md_regs;
-#ifdef VM86
- if (context.sc_eflags & PSL_VM) {
- void syscall_vm86(struct trapframe *);
- tf->tf_vm86_gs = context.sc_gs;
- tf->tf_vm86_fs = context.sc_fs;
- tf->tf_vm86_es = context.sc_es;
- tf->tf_vm86_ds = context.sc_ds;
- set_vflags(l, context.sc_eflags);
- p->p_md.md_syscall = syscall_vm86;
- } else
-#endif
- {
- /*
- * Check for security violations. If we're returning to
- * protected mode, the CPU will validate the segment registers
- * automatically and generate a trap on violations. We handle
- * 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))
- return (EINVAL);
+ /*
+ * Check for security violations. If we're returning to
+ * protected mode, the CPU will validate the segment registers
+ * automatically and generate a trap on violations. We handle
+ * 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))
+ return (EINVAL);
- tf->tf_gs = context.sc_gs;
- tf->tf_fs = context.sc_fs;
- tf->tf_es = context.sc_es;
- tf->tf_ds = context.sc_ds;
- tf->tf_eflags &= ~PSL_USER;
- tf->tf_eflags |= context.sc_eflags & PSL_USER;
- }
+ tf->tf_gs = context.sc_gs;
+ tf->tf_fs = context.sc_fs;
+ tf->tf_es = context.sc_es;
+ tf->tf_ds = context.sc_ds;
+ tf->tf_eflags &= ~PSL_USER;
+ tf->tf_eflags |= context.sc_eflags & PSL_USER;
+
tf->tf_edi = context.sc_edi;
tf->tf_esi = context.sc_esi;
tf->tf_ebp = context.sc_ebp;
diff -r 950064e1112d -r 031cfa83e150 sys/arch/i386/i386/compat_16_machdep.c
--- a/sys/arch/i386/i386/compat_16_machdep.c Sat Aug 12 06:46:13 2017 +0000
+++ b/sys/arch/i386/i386/compat_16_machdep.c Sat Aug 12 07:07:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_16_machdep.c,v 1.28 2017/08/10 12:49:11 maxv Exp $ */
+/* $NetBSD: compat_16_machdep.c,v 1.29 2017/08/12 07:07:53 maxv Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,10 +30,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.28 2017/08/10 12:49:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.29 2017/08/12 07:07:53 maxv Exp $");
#ifdef _KERNEL_OPT
-#include "opt_vm86.h"
#include "opt_compat_netbsd.h"
#endif
@@ -46,10 +45,6 @@
#include <sys/mount.h>
#include <sys/syscallargs.h>
-#ifdef VM86
-#include <machine/mcontext.h>
-#include <machine/vm86.h>
-#endif
#include <uvm/uvm_extern.h>
#include <machine/pmap.h>
@@ -93,36 +88,24 @@
/* Restore register context. */
tf = l->l_md.md_regs;
-#ifdef VM86
- if (context.sc_eflags & PSL_VM) {
- void syscall_vm86(struct trapframe *);
- tf->tf_vm86_gs = context.sc_gs;
- tf->tf_vm86_fs = context.sc_fs;
- tf->tf_vm86_es = context.sc_es;
- tf->tf_vm86_ds = context.sc_ds;
- set_vflags(l, context.sc_eflags);
- p->p_md.md_syscall = syscall_vm86;
- } else
-#endif
- {
- /*
- * Check for security violations. If we're returning to
- * protected mode, the CPU will validate the segment registers
- * automatically and generate a trap on violations. We handle
- * 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))
- return (EINVAL);
+ /*
+ * Check for security violations. If we're returning to
+ * protected mode, the CPU will validate the segment registers
+ * automatically and generate a trap on violations. We handle
+ * 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))
+ return (EINVAL);
- tf->tf_gs = context.sc_gs;
- tf->tf_fs = context.sc_fs;
- tf->tf_es = context.sc_es;
- tf->tf_ds = context.sc_ds;
- tf->tf_eflags &= ~PSL_USER;
- tf->tf_eflags |= context.sc_eflags & PSL_USER;
- }
+ tf->tf_gs = context.sc_gs;
+ tf->tf_fs = context.sc_fs;
+ tf->tf_es = context.sc_es;
+ tf->tf_ds = context.sc_ds;
+ tf->tf_eflags &= ~PSL_USER;
+ tf->tf_eflags |= context.sc_eflags & PSL_USER;
+
tf->tf_edi = context.sc_edi;
tf->tf_esi = context.sc_esi;
tf->tf_ebp = context.sc_ebp;
@@ -198,23 +181,12 @@
frame.sf_scp = &fp->sf_sc;
/* Save register context. */
-#ifdef VM86
- if (tf->tf_eflags & PSL_VM) {
- frame.sf_sc.sc_gs = tf->tf_vm86_gs;
- frame.sf_sc.sc_fs = tf->tf_vm86_fs;
- frame.sf_sc.sc_es = tf->tf_vm86_es;
- frame.sf_sc.sc_ds = tf->tf_vm86_ds;
- frame.sf_sc.sc_eflags = get_vflags(l);
- (*p->p_emul->e_syscall_intern)(p);
- } else
-#endif
- {
- frame.sf_sc.sc_gs = tf->tf_gs;
- frame.sf_sc.sc_fs = tf->tf_fs;
- frame.sf_sc.sc_es = tf->tf_es;
- frame.sf_sc.sc_ds = tf->tf_ds;
- frame.sf_sc.sc_eflags = tf->tf_eflags;
- }
+ frame.sf_sc.sc_gs = tf->tf_gs;
+ frame.sf_sc.sc_fs = tf->tf_fs;
+ frame.sf_sc.sc_es = tf->tf_es;
+ frame.sf_sc.sc_ds = tf->tf_ds;
+ frame.sf_sc.sc_eflags = tf->tf_eflags;
+
frame.sf_sc.sc_edi = tf->tf_edi;
frame.sf_sc.sc_esi = tf->tf_esi;
frame.sf_sc.sc_ebp = tf->tf_ebp;
diff -r 950064e1112d -r 031cfa83e150 sys/arch/i386/i386/i386_trap.S
--- a/sys/arch/i386/i386/i386_trap.S Sat Aug 12 06:46:13 2017 +0000
+++ b/sys/arch/i386/i386/i386_trap.S Sat Aug 12 07:07:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: i386_trap.S,v 1.8 2017/06/14 17:21:04 maxv Exp $ */
+/* $NetBSD: i386_trap.S,v 1.9 2017/08/12 07:07:53 maxv Exp $ */
/*
* Copyright 2002 (c) Wasabi Systems, Inc.
@@ -66,7 +66,7 @@
#if 0
#include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.8 2017/06/14 17:21:04 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_trap.S,v 1.9 2017/08/12 07:07:53 maxv Exp $");
#endif
/*
@@ -383,12 +383,7 @@
_C_LABEL(trapreturn): .globl trapreturn
testb $CHK_UPL,TF_CS(%esp)
jnz .Lalltraps_checkast
-#ifdef VM86
- testl $PSL_VM,TF_EFLAGS(%esp)
- jz 6f
-#else
jmp 6f
-#endif
.Lalltraps_checkast:
/* Check for ASTs on exit to user mode. */
CLI(%eax)
diff -r 950064e1112d -r 031cfa83e150 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c Sat Aug 12 06:46:13 2017 +0000
+++ b/sys/arch/i386/i386/machdep.c Sat Aug 12 07:07:53 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.788 2017/08/10 12:49:11 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.789 2017/08/12 07:07:53 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.788 2017/08/10 12:49:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.789 2017/08/12 07:07:53 maxv Exp $");
#include "opt_beep.h"
#include "opt_compat_freebsd.h"
@@ -83,7 +83,6 @@
#include "opt_physmem.h"
#include "opt_realmem.h"
#include "opt_user_ldt.h"
-#include "opt_vm86.h"
#include "opt_xen.h"
#include "isa.h"
#include "pci.h"
@@ -172,10 +171,6 @@
#include <ddb/db_extern.h>
#endif
-#ifdef VM86
-#include <machine/vm86.h>
-#endif
-
#include "acpica.h"
#include "bioscall.h"
@@ -593,12 +588,7 @@
&& (SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
if (*onstack)
return (char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size;
-#ifdef VM86
- if (tf->tf_eflags & PSL_VM)
- return (void *)(tf->tf_esp + (tf->tf_ss << 4));
- else
-#endif
- return (void *)tf->tf_esp;
+ return (void *)tf->tf_esp;
}
/*
@@ -1458,22 +1448,12 @@
__greg_t ras_eip;
/* Save register context. */
-#ifdef VM86
- if (tf->tf_eflags & PSL_VM) {
- gr[_REG_GS] = tf->tf_vm86_gs;
- gr[_REG_FS] = tf->tf_vm86_fs;
- gr[_REG_ES] = tf->tf_vm86_es;
- gr[_REG_DS] = tf->tf_vm86_ds;
- gr[_REG_EFL] = get_vflags(l);
- } else
-#endif
- {
- gr[_REG_GS] = tf->tf_gs;
- gr[_REG_FS] = tf->tf_fs;
- gr[_REG_ES] = tf->tf_es;
Home |
Main Index |
Thread Index |
Old Index