From 1219828400bccbae5e1303138202282b3665bf20 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 5 Oct 2000 20:27:45 +0000 Subject: [PATCH] - Remove somewhat bogus handling of the Giant mutex in the vm86 code. - Add a vm86pcb_lock mutex that is used to lock the vm86pcb used when making a vm86 call. --- sys/i386/i386/vm86.c | 14 +++++++++++++- sys/i386/i386/vm86bios.s | 5 ----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/sys/i386/i386/vm86.c b/sys/i386/i386/vm86.c index a4547c81051c..5439e2336604 100644 --- a/sys/i386/i386/vm86.c +++ b/sys/i386/i386/vm86.c @@ -40,6 +40,7 @@ #include #include +#include #include /* pcb.h included via sys/user.h */ #include #include @@ -49,6 +50,8 @@ extern int i386_extend_pcb __P((struct proc *)); extern int vm86pa; extern struct pcb *vm86pcb; +static struct mtx vm86pcb_lock; + extern int vm86_bioscall(struct vm86frame *); extern void vm86_biosret(struct vm86frame *); @@ -423,6 +426,8 @@ vm86_initialize(void) pcb = &vml->vml_pcb; ext = &vml->vml_ext; + mtx_init(&vm86pcb_lock, "vm86pcb lock", MTX_DEF); + bzero(pcb, sizeof(struct pcb)); pcb->new_ptd = vm86pa | PG_V | PG_RW | PG_U; pcb->vm86_frame = vm86paddr - sizeof(struct vm86frame); @@ -565,11 +570,16 @@ vm86_trap(struct vm86frame *vmf) int vm86_intcall(int intnum, struct vm86frame *vmf) { + int retval; + if (intnum < 0 || intnum > 0xff) return (EINVAL); vmf->vmf_trapno = intnum; - return (vm86_bioscall(vmf)); + mtx_enter(&vm86pcb_lock, MTX_DEF); + retval = vm86_bioscall(vmf); + mtx_exit(&vm86pcb_lock, MTX_DEF); + return (retval); } /* @@ -596,7 +606,9 @@ vm86_datacall(intnum, vmf, vmc) } vmf->vmf_trapno = intnum; + mtx_enter(&vm86pcb_lock, MTX_DEF); retval = vm86_bioscall(vmf); + mtx_exit(&vm86pcb_lock, MTX_DEF); for (i = 0; i < vmc->npages; i++) { entry = vmc->pmap[i].pte_num; diff --git a/sys/i386/i386/vm86bios.s b/sys/i386/i386/vm86bios.s index 14b4259005bf..4b61b6c09aff 100644 --- a/sys/i386/i386/vm86bios.s +++ b/sys/i386/i386/vm86bios.s @@ -62,10 +62,6 @@ ENTRY(vm86_bioscall) pushl %edi pushl %gs - pushl %edx - call __mtx_enter_giant_def /* Get global lock */ - popl %edx - #if NNPX > 0 movl _curproc,%ecx cmpl %ecx,_npxproc /* do we need to save fp? */ @@ -135,7 +131,6 @@ ENTRY(vm86_bioscall) */ subl $4,%esp /* dummy unit */ incb _intr_nesting_level - call __mtx_exit_giant_def MEXITCOUNT jmp _doreti