Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/i386/i386 Handle the VM86-mode syscall problem by c...



details:   https://anonhg.NetBSD.org/src/rev/fb91508c6154
branches:  trunk
changeset: 500413:fb91508c6154
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Mon Dec 11 17:36:03 2000 +0000

description:
Handle the VM86-mode syscall problem by changing the syscall vector when
jumping in or out of VM86 mode.

diffstat:

 sys/arch/i386/i386/compat_13_machdep.c |   7 ++++-
 sys/arch/i386/i386/freebsd_machdep.c   |   8 +++++-
 sys/arch/i386/i386/ibcs2_machdep.c     |   5 ++-
 sys/arch/i386/i386/ibcs2_syscall.c     |  24 +-------------------
 sys/arch/i386/i386/linux_syscall.c     |  24 +-------------------
 sys/arch/i386/i386/machdep.c           |   6 ++++-
 sys/arch/i386/i386/process_machdep.c   |  13 ++++++++--
 sys/arch/i386/i386/svr4_machdep.c      |  11 +++++++-
 sys/arch/i386/i386/svr4_syscall.c      |  24 +-------------------
 sys/arch/i386/i386/syscall.c           |  40 ++++++++++++++-------------------
 10 files changed, 58 insertions(+), 104 deletions(-)

diffs (truncated from 405 to 300 lines):

diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/compat_13_machdep.c
--- a/sys/arch/i386/i386/compat_13_machdep.c    Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/compat_13_machdep.c    Mon Dec 11 17:36:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: compat_13_machdep.c,v 1.3 1998/09/13 01:42:45 thorpej Exp $    */
+/*     $NetBSD: compat_13_machdep.c,v 1.4 2000/12/11 17:36:03 mycroft Exp $    */
 
 /*-
- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -76,11 +76,14 @@
        tf = p->p_md.md_regs;
 #ifdef VM86
        if (context.sc_eflags & PSL_VM) {
+               void syscall_vm86 __P((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(p, context.sc_eflags);
+               p->p_md.md_syscall = syscall_vm86;
        } else
 #endif
        {
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/freebsd_machdep.c
--- a/sys/arch/i386/i386/freebsd_machdep.c      Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/freebsd_machdep.c      Mon Dec 11 17:36:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: freebsd_machdep.c,v 1.24 2000/12/11 05:37:01 mycroft Exp $     */
+/*     $NetBSD: freebsd_machdep.c,v 1.25 2000/12/11 17:36:03 mycroft Exp $     */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -126,6 +126,7 @@
                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(p);
+               (*p->p_emul->e_syscall_intern)(p);
        } else
 #endif
        {
@@ -213,9 +214,12 @@
        tf = p->p_md.md_regs;
 #ifdef VM86
        if (context.sc_eflags & PSL_VM) {
+               void syscall_vm86 __P((struct trapframe));
+
                tf->tf_vm86_es = context.sc_es;
                tf->tf_vm86_ds = context.sc_ds;
                set_vflags(p, context.sc_eflags);
+               p->p_md.md_syscall = syscall_vm86;
        } else
 #endif
        {
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/ibcs2_machdep.c
--- a/sys/arch/i386/i386/ibcs2_machdep.c        Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/ibcs2_machdep.c        Mon Dec 11 17:36:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: ibcs2_machdep.c,v 1.11 2000/11/29 21:53:48 jdolecek Exp $      */
+/*     $NetBSD: ibcs2_machdep.c,v 1.12 2000/12/11 17:36:03 mycroft Exp $       */
 
 /*-
- * Copyright (c) 1997 The NetBSD Foundation, Inc.
+ * Copyright (c) 1997, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -133,6 +133,7 @@
                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(p);
+               (*p->p_emul->e_syscall_intern)(p);
        } else
 #endif
        {
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/ibcs2_syscall.c
--- a/sys/arch/i386/i386/ibcs2_syscall.c        Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/ibcs2_syscall.c        Mon Dec 11 17:36:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_syscall.c,v 1.9 2000/12/11 16:49:15 mycroft Exp $        */
+/*     $NetBSD: ibcs2_syscall.c,v 1.10 2000/12/11 17:36:03 mycroft Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -108,17 +108,6 @@
        callp = ibcs2_sysent;
        params = (caddr_t)frame.tf_esp + sizeof(int);
 
-#ifdef VM86
-       /*
-        * VM86 mode application found our syscall trap gate by accident; let
-        * it get a SIGSYS and have the VM86 handler in the process take care
-        * of it.
-        */
-       if (frame.tf_eflags & PSL_VM)
-               code = -1;
-       else
-#endif /* VM86 */
-
        switch (code) {
        case SYS_syscall:
                /*
@@ -200,17 +189,6 @@
        callp = ibcs2_sysent;
        params = (caddr_t)frame.tf_esp + sizeof(int);
 
-#ifdef VM86
-       /*
-        * VM86 mode application found our syscall trap gate by accident; let
-        * it get a SIGSYS and have the VM86 handler in the process take care
-        * of it.
-        */
-       if (frame.tf_eflags & PSL_VM)
-               code = -1;
-       else
-#endif /* VM86 */
-
        switch (code) {
        case SYS_syscall:
                /*
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/linux_syscall.c
--- a/sys/arch/i386/i386/linux_syscall.c        Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/linux_syscall.c        Mon Dec 11 17:36:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: linux_syscall.c,v 1.9 2000/12/11 16:49:15 mycroft Exp $        */
+/*     $NetBSD: linux_syscall.c,v 1.10 2000/12/11 17:36:03 mycroft Exp $       */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -104,17 +104,6 @@
        code = frame.tf_eax;
        callp = linux_sysent;
 
-#ifdef VM86
-       /*
-        * VM86 mode application found our syscall trap gate by accident; let
-        * it get a SIGSYS and have the VM86 handler in the process take care
-        * of it.
-        */
-       if (frame.tf_eflags & PSL_VM)
-               code = -1;
-       else
-#endif /* VM86 */
-
        callp += (code & (LINUX_SYS_NSYSENT - 1));
        argsize = callp->sy_argsize;
        if (argsize) {
@@ -196,17 +185,6 @@
        code = frame.tf_eax;
        callp = linux_sysent;
 
-#ifdef VM86
-       /*
-        * VM86 mode application found our syscall trap gate by accident; let
-        * it get a SIGSYS and have the VM86 handler in the process take care
-        * of it.
-        */
-       if (frame.tf_eflags & PSL_VM)
-               code = -1;
-       else
-#endif /* VM86 */
-
        callp += (code & (LINUX_SYS_NSYSENT - 1));
        argsize = callp->sy_argsize;
        if (argsize) {
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/machdep.c
--- a/sys/arch/i386/i386/machdep.c      Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/machdep.c      Mon Dec 11 17:36:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.421 2000/11/29 09:56:02 aymeric Exp $    */
+/*     $NetBSD: machdep.c,v 1.422 2000/12/11 17:36:03 mycroft Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -1190,6 +1190,7 @@
                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(p);
+               (*p->p_emul->e_syscall_intern)(p);
        } else
 #endif
        {
@@ -1291,11 +1292,14 @@
        tf = p->p_md.md_regs;
 #ifdef VM86
        if (context.sc_eflags & PSL_VM) {
+               void syscall_vm86 __P((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(p, context.sc_eflags);
+               p->p_md.md_syscall = syscall_vm86;
        } else
 #endif
        {
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/process_machdep.c
--- a/sys/arch/i386/i386/process_machdep.c      Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/process_machdep.c      Mon Dec 11 17:36:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: process_machdep.c,v 1.31 2000/06/29 08:44:54 mrg Exp $ */
+/*     $NetBSD: process_machdep.c,v 1.32 2000/12/11 17:36:03 mycroft Exp $     */
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -182,12 +182,15 @@
        pmap_t pmap = p->p_vmspace->vm_map.pmap;
 
 #ifdef VM86
-       if (tf->tf_eflags & PSL_VM) {
+       if (regs->r_eflags & PSL_VM) {
+               void syscall_vm86 __P((struct trapframe));
+
                tf->tf_vm86_gs = regs->r_gs;
                tf->tf_vm86_fs = regs->r_fs;
                tf->tf_vm86_es = regs->r_es;
                tf->tf_vm86_ds = regs->r_ds;
                set_vflags(p, regs->r_eflags);
+               p->p_md.md_syscall = syscall_vm86;
        } else
 #endif
        {
@@ -225,6 +228,10 @@
                pcb->pcb_fs = regs->r_fs;
                tf->tf_es = regs->r_es;
                tf->tf_ds = regs->r_ds;
+#ifdef VM86
+               if (tf->tf_eflags & PSL_VM)
+                       (*p->p_emul->e_syscall_intern)(p);
+#endif
                tf->tf_eflags = regs->r_eflags;
        }
        tf->tf_edi = regs->r_edi;
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/svr4_machdep.c
--- a/sys/arch/i386/i386/svr4_machdep.c Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/svr4_machdep.c Mon Dec 11 17:36:03 2000 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: svr4_machdep.c,v 1.48 2000/11/29 21:53:48 jdolecek Exp $        */
+/*     $NetBSD: svr4_machdep.c,v 1.49 2000/12/11 17:36:03 mycroft Exp $         */
 
 /*-
- * Copyright (c) 1994 The NetBSD Foundation, Inc.
+ * Copyright (c) 1994, 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -208,11 +208,14 @@
        tf = p->p_md.md_regs;
 #ifdef VM86
        if (r[SVR4_X86_EFL] & PSL_VM) {
+               void syscall_vm86 __P((struct trapframe));
+
                tf->tf_vm86_gs = r[SVR4_X86_GS];
                tf->tf_vm86_fs = r[SVR4_X86_FS];
                tf->tf_vm86_es = r[SVR4_X86_ES];
                tf->tf_vm86_ds = r[SVR4_X86_DS];
                set_vflags(p, r[SVR4_X86_EFL]);
+               p->p_md.md_syscall = syscall_vm86;
        } else
 #endif
        {
@@ -229,6 +232,10 @@
                /* %fs and %gs were restored by the trampoline. */
                tf->tf_es = r[SVR4_X86_ES];
                tf->tf_ds = r[SVR4_X86_DS];
+#ifdef VM86
+               if (tf->tf_eflags & PSL_VM)
+                       (*p->p_emul->e_syscall_intern)(p);
+#endif
                tf->tf_eflags = r[SVR4_X86_EFL];
        }
        tf->tf_edi = r[SVR4_X86_EDI];
diff -r 963e056e83f7 -r fb91508c6154 sys/arch/i386/i386/svr4_syscall.c
--- a/sys/arch/i386/i386/svr4_syscall.c Mon Dec 11 17:07:38 2000 +0000
+++ b/sys/arch/i386/i386/svr4_syscall.c Mon Dec 11 17:36:03 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: svr4_syscall.c,v 1.8 2000/12/11 16:49:15 mycroft Exp $ */
+/*     $NetBSD: svr4_syscall.c,v 1.9 2000/12/11 17:36:03 mycroft Exp $ */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -105,17 +105,6 @@
        callp = svr4_sysent;
        params = (caddr_t)frame.tf_esp + sizeof(int);
 
-#ifdef VM86
-       /*



Home | Main Index | Thread Index | Old Index