From 5f07393373c8129e9ee8b7c470b65779f08df195 Mon Sep 17 00:00:00 2001 From: Jonathan Lemon Date: Thu, 28 Aug 1997 14:36:56 +0000 Subject: [PATCH] Remove the vm86 support as an LKM, and link it directly into the kernel if 'options "VM86"' is in the config file. The LKM was really for development, and has probably outlived its usefulness. --- sys/amd64/amd64/sys_machdep.c | 13 +++++------ sys/amd64/amd64/trap.c | 9 +++---- sys/conf/files.i386 | 3 ++- sys/i386/conf/files.i386 | 3 ++- sys/i386/i386/sys_machdep.c | 13 +++++------ sys/i386/i386/trap.c | 9 +++---- sys/i386/i386/vm86.c | 44 +++-------------------------------- sys/i386/include/vm86.h | 6 ++--- sys/kern/subr_trap.c | 9 +++---- 9 files changed, 37 insertions(+), 72 deletions(-) diff --git a/sys/amd64/amd64/sys_machdep.c b/sys/amd64/amd64/sys_machdep.c index be355bb57a7a..57164846658c 100644 --- a/sys/amd64/amd64/sys_machdep.c +++ b/sys/amd64/amd64/sys_machdep.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - * $Id: sys_machdep.c,v 1.22 1997/07/20 08:37:23 bde Exp $ + * $Id: sys_machdep.c,v 1.23 1997/08/09 00:02:49 dyson Exp $ * */ @@ -51,7 +51,10 @@ #include #include +#ifdef VM86 #include +#include +#endif /* VM86 */ #include /* for kernel_map */ @@ -71,7 +74,6 @@ static int i386_set_ldt __P((struct proc *, char *, int *)); static int i386_get_ioperm __P((struct proc *, char *, int *)); static int i386_set_ioperm __P((struct proc *, char *, int *)); int i386_extend_pcb __P((struct proc *)); -int (*vm86_sysarch) __P((struct proc *, char *, int *)); #endif #ifndef _SYS_SYSPROTO_H_ @@ -107,11 +109,8 @@ sysarch(p, uap, retval) error = i386_set_ioperm(p, uap->parms, retval); break; case I386_VM86: - if (vm86_sysarch) { - error = (*vm86_sysarch)(p, uap->parms, retval); - break; - } - /* FALL THROUGH */ + error = vm86_sysarch(p, uap->parms, retval); + break; #endif default: error = EINVAL; diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 5895361a0ce9..b27583f1d985 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.107 1997/08/21 06:32:39 charnier Exp $ + * $Id: trap.c,v 1.108 1997/08/26 18:10:33 peter Exp $ */ /* @@ -85,7 +85,6 @@ extern struct i386tss common_tss; -int (*vm86_emulate) __P((struct vm86frame *)); int (*pmath_emulate) __P((struct trapframe *)); extern void trap __P((struct trapframe frame)); @@ -246,12 +245,14 @@ trap(frame) */ case T_PROTFLT: /* general protection fault */ case T_STKFLT: /* stack fault */ - if (vm86_emulate && (frame.tf_eflags & PSL_VM)) { - i = (*vm86_emulate)((struct vm86frame *)&frame); +#ifdef VM86 + if (frame.tf_eflags & PSL_VM) { + i = vm86_emulate((struct vm86frame *)&frame); if (i == 0) goto out; break; } +#endif /* VM86 */ /* FALL THROUGH */ case T_SEGNPFLT: /* segment not present fault */ diff --git a/sys/conf/files.i386 b/sys/conf/files.i386 index 9d7f07d89c00..749078c010b4 100644 --- a/sys/conf/files.i386 +++ b/sys/conf/files.i386 @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.171 1997/08/14 14:03:27 msmith Exp $ +# $Id: files.i386,v 1.172 1997/08/28 12:18:08 jkh Exp $ # aic7xxx_asm optional ahc device-driver \ dependency "$S/dev/aic7xxx/*.[chyl]" \ @@ -81,6 +81,7 @@ i386/i386/sys_machdep.c standard i386/i386/trap.c standard i386/i386/userconfig.c optional userconfig i386/i386/vm_machdep.c standard +i386/i386/vm86.c optional vm86 i386/ibcs2/ibcs2_fcntl.c optional ibcs2 i386/ibcs2/ibcs2_stat.c optional ibcs2 i386/ibcs2/ibcs2_ipc.c optional ibcs2 diff --git a/sys/i386/conf/files.i386 b/sys/i386/conf/files.i386 index 9d7f07d89c00..749078c010b4 100644 --- a/sys/i386/conf/files.i386 +++ b/sys/i386/conf/files.i386 @@ -1,7 +1,7 @@ # This file tells config what files go into building a kernel, # files marked standard are always included. # -# $Id: files.i386,v 1.171 1997/08/14 14:03:27 msmith Exp $ +# $Id: files.i386,v 1.172 1997/08/28 12:18:08 jkh Exp $ # aic7xxx_asm optional ahc device-driver \ dependency "$S/dev/aic7xxx/*.[chyl]" \ @@ -81,6 +81,7 @@ i386/i386/sys_machdep.c standard i386/i386/trap.c standard i386/i386/userconfig.c optional userconfig i386/i386/vm_machdep.c standard +i386/i386/vm86.c optional vm86 i386/ibcs2/ibcs2_fcntl.c optional ibcs2 i386/ibcs2/ibcs2_stat.c optional ibcs2 i386/ibcs2/ibcs2_ipc.c optional ibcs2 diff --git a/sys/i386/i386/sys_machdep.c b/sys/i386/i386/sys_machdep.c index be355bb57a7a..57164846658c 100644 --- a/sys/i386/i386/sys_machdep.c +++ b/sys/i386/i386/sys_machdep.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - * $Id: sys_machdep.c,v 1.22 1997/07/20 08:37:23 bde Exp $ + * $Id: sys_machdep.c,v 1.23 1997/08/09 00:02:49 dyson Exp $ * */ @@ -51,7 +51,10 @@ #include #include +#ifdef VM86 #include +#include +#endif /* VM86 */ #include /* for kernel_map */ @@ -71,7 +74,6 @@ static int i386_set_ldt __P((struct proc *, char *, int *)); static int i386_get_ioperm __P((struct proc *, char *, int *)); static int i386_set_ioperm __P((struct proc *, char *, int *)); int i386_extend_pcb __P((struct proc *)); -int (*vm86_sysarch) __P((struct proc *, char *, int *)); #endif #ifndef _SYS_SYSPROTO_H_ @@ -107,11 +109,8 @@ sysarch(p, uap, retval) error = i386_set_ioperm(p, uap->parms, retval); break; case I386_VM86: - if (vm86_sysarch) { - error = (*vm86_sysarch)(p, uap->parms, retval); - break; - } - /* FALL THROUGH */ + error = vm86_sysarch(p, uap->parms, retval); + break; #endif default: error = EINVAL; diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 5895361a0ce9..b27583f1d985 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.107 1997/08/21 06:32:39 charnier Exp $ + * $Id: trap.c,v 1.108 1997/08/26 18:10:33 peter Exp $ */ /* @@ -85,7 +85,6 @@ extern struct i386tss common_tss; -int (*vm86_emulate) __P((struct vm86frame *)); int (*pmath_emulate) __P((struct trapframe *)); extern void trap __P((struct trapframe frame)); @@ -246,12 +245,14 @@ trap(frame) */ case T_PROTFLT: /* general protection fault */ case T_STKFLT: /* stack fault */ - if (vm86_emulate && (frame.tf_eflags & PSL_VM)) { - i = (*vm86_emulate)((struct vm86frame *)&frame); +#ifdef VM86 + if (frame.tf_eflags & PSL_VM) { + i = vm86_emulate((struct vm86frame *)&frame); if (i == 0) goto out; break; } +#endif /* VM86 */ /* FALL THROUGH */ case T_SEGNPFLT: /* segment not present fault */ diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index 58cbd755cca1..476e96c15443 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: vm86.c,v 1.1 1997/08/09 01:38:03 dyson Exp $ */ #include @@ -53,9 +53,6 @@ #include #include -extern int emulate_vm86 __P((struct vm86frame *)); -extern int i386_vm86 __P((struct proc *p, char *args, int *retval)); - extern int i386_extend_pcb __P((struct proc *)); #define CLI 0xfa @@ -121,7 +118,7 @@ POPL(struct vm86frame *vmf) } int -emulate_vm86(vmf) +vm86_emulate(vmf) struct vm86frame *vmf; { struct vm86_kernel *vm86; @@ -334,7 +331,7 @@ emulate_vm86(vmf) } int -i386_vm86(p, args, retval) +vm86_sysarch(p, args, retval) struct proc *p; char *args; int *retval; @@ -397,38 +394,3 @@ i386_vm86(p, args, retval) } return (error); } - -#ifdef VM86_MODULE - -#include -#include -#include - -MOD_MISC(vm86); - -static int -vm86_load(struct lkm_table *lkmtp, int cmd) -{ - vm86_emulate = emulate_vm86; - vm86_sysarch = i386_vm86; - uprintf("vm86 emulator installed\n"); - return 0; -} - -static int -vm86_unload(struct lkm_table *lkmtp, int cmd) -{ - vm86_emulate = 0; - vm86_sysarch = 0; - uprintf("vm86 emulator removed\n"); - return 0; -} - -int -vm86_mod(struct lkm_table *lkmtp, int cmd, int ver) -{ - MOD_DISPATCH(vm86, lkmtp, cmd, ver, - vm86_load, vm86_unload, lkm_nullcmd); -} - -#endif /* VM86_MODULE */ diff --git a/sys/i386/include/vm86.h b/sys/i386/include/vm86.h index 9c38d9434e4b..5b3eec3f4def 100644 --- a/sys/i386/include/vm86.h +++ b/sys/i386/include/vm86.h @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: vm86.h,v 1.1 1997/08/09 04:55:04 dyson Exp $ + * $Id: vm86.h,v 1.2 1997/08/20 19:57:24 jlemon Exp $ */ #ifndef _MACHINE_VM86_H_ @@ -106,7 +106,7 @@ struct vm86frame { }; struct proc; -extern int (*vm86_emulate) __P((struct vm86frame *)); -extern int (*vm86_sysarch) __P((struct proc *, char *, int *)); +extern int vm86_emulate __P((struct vm86frame *)); +extern int vm86_sysarch __P((struct proc *, char *, int *)); #endif /* _MACHINE_VM86_H_ */ diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 5895361a0ce9..b27583f1d985 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.107 1997/08/21 06:32:39 charnier Exp $ + * $Id: trap.c,v 1.108 1997/08/26 18:10:33 peter Exp $ */ /* @@ -85,7 +85,6 @@ extern struct i386tss common_tss; -int (*vm86_emulate) __P((struct vm86frame *)); int (*pmath_emulate) __P((struct trapframe *)); extern void trap __P((struct trapframe frame)); @@ -246,12 +245,14 @@ trap(frame) */ case T_PROTFLT: /* general protection fault */ case T_STKFLT: /* stack fault */ - if (vm86_emulate && (frame.tf_eflags & PSL_VM)) { - i = (*vm86_emulate)((struct vm86frame *)&frame); +#ifdef VM86 + if (frame.tf_eflags & PSL_VM) { + i = vm86_emulate((struct vm86frame *)&frame); if (i == 0) goto out; break; } +#endif /* VM86 */ /* FALL THROUGH */ case T_SEGNPFLT: /* segment not present fault */