- 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.
This commit is contained in:
parent
bd57768e0f
commit
1219828400
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=66691
@ -40,6 +40,7 @@
|
|||||||
#include <sys/user.h>
|
#include <sys/user.h>
|
||||||
|
|
||||||
#include <machine/md_var.h>
|
#include <machine/md_var.h>
|
||||||
|
#include <machine/mutex.h>
|
||||||
#include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */
|
#include <machine/pcb_ext.h> /* pcb.h included via sys/user.h */
|
||||||
#include <machine/psl.h>
|
#include <machine/psl.h>
|
||||||
#include <machine/specialreg.h>
|
#include <machine/specialreg.h>
|
||||||
@ -49,6 +50,8 @@ extern int i386_extend_pcb __P((struct proc *));
|
|||||||
extern int vm86pa;
|
extern int vm86pa;
|
||||||
extern struct pcb *vm86pcb;
|
extern struct pcb *vm86pcb;
|
||||||
|
|
||||||
|
static struct mtx vm86pcb_lock;
|
||||||
|
|
||||||
extern int vm86_bioscall(struct vm86frame *);
|
extern int vm86_bioscall(struct vm86frame *);
|
||||||
extern void vm86_biosret(struct vm86frame *);
|
extern void vm86_biosret(struct vm86frame *);
|
||||||
|
|
||||||
@ -423,6 +426,8 @@ vm86_initialize(void)
|
|||||||
pcb = &vml->vml_pcb;
|
pcb = &vml->vml_pcb;
|
||||||
ext = &vml->vml_ext;
|
ext = &vml->vml_ext;
|
||||||
|
|
||||||
|
mtx_init(&vm86pcb_lock, "vm86pcb lock", MTX_DEF);
|
||||||
|
|
||||||
bzero(pcb, sizeof(struct pcb));
|
bzero(pcb, sizeof(struct pcb));
|
||||||
pcb->new_ptd = vm86pa | PG_V | PG_RW | PG_U;
|
pcb->new_ptd = vm86pa | PG_V | PG_RW | PG_U;
|
||||||
pcb->vm86_frame = vm86paddr - sizeof(struct vm86frame);
|
pcb->vm86_frame = vm86paddr - sizeof(struct vm86frame);
|
||||||
@ -565,11 +570,16 @@ vm86_trap(struct vm86frame *vmf)
|
|||||||
int
|
int
|
||||||
vm86_intcall(int intnum, struct vm86frame *vmf)
|
vm86_intcall(int intnum, struct vm86frame *vmf)
|
||||||
{
|
{
|
||||||
|
int retval;
|
||||||
|
|
||||||
if (intnum < 0 || intnum > 0xff)
|
if (intnum < 0 || intnum > 0xff)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
vmf->vmf_trapno = intnum;
|
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;
|
vmf->vmf_trapno = intnum;
|
||||||
|
mtx_enter(&vm86pcb_lock, MTX_DEF);
|
||||||
retval = vm86_bioscall(vmf);
|
retval = vm86_bioscall(vmf);
|
||||||
|
mtx_exit(&vm86pcb_lock, MTX_DEF);
|
||||||
|
|
||||||
for (i = 0; i < vmc->npages; i++) {
|
for (i = 0; i < vmc->npages; i++) {
|
||||||
entry = vmc->pmap[i].pte_num;
|
entry = vmc->pmap[i].pte_num;
|
||||||
|
@ -62,10 +62,6 @@ ENTRY(vm86_bioscall)
|
|||||||
pushl %edi
|
pushl %edi
|
||||||
pushl %gs
|
pushl %gs
|
||||||
|
|
||||||
pushl %edx
|
|
||||||
call __mtx_enter_giant_def /* Get global lock */
|
|
||||||
popl %edx
|
|
||||||
|
|
||||||
#if NNPX > 0
|
#if NNPX > 0
|
||||||
movl _curproc,%ecx
|
movl _curproc,%ecx
|
||||||
cmpl %ecx,_npxproc /* do we need to save fp? */
|
cmpl %ecx,_npxproc /* do we need to save fp? */
|
||||||
@ -135,7 +131,6 @@ ENTRY(vm86_bioscall)
|
|||||||
*/
|
*/
|
||||||
subl $4,%esp /* dummy unit */
|
subl $4,%esp /* dummy unit */
|
||||||
incb _intr_nesting_level
|
incb _intr_nesting_level
|
||||||
call __mtx_exit_giant_def
|
|
||||||
MEXITCOUNT
|
MEXITCOUNT
|
||||||
jmp _doreti
|
jmp _doreti
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user