Use the flag mask in a somewhat more sane fashion.
This commit is contained in:
parent
eb4de32615
commit
035e9c211e
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: vm86.c,v 1.8 1996/04/11 10:07:17 mycroft Exp $ */
|
/* $NetBSD: vm86.c,v 1.9 1996/04/12 05:57:43 mycroft Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
* Copyright (c) 1996 The NetBSD Foundation, Inc.
|
||||||
|
@ -382,10 +382,11 @@ i386_vm86(p, args, retval)
|
||||||
struct trapframe *tf = p->p_md.md_regs;
|
struct trapframe *tf = p->p_md.md_regs;
|
||||||
struct pcb *pcb = &p->p_addr->u_pcb;
|
struct pcb *pcb = &p->p_addr->u_pcb;
|
||||||
struct vm86_kern vm86s;
|
struct vm86_kern vm86s;
|
||||||
int err;
|
int error;
|
||||||
|
|
||||||
if (err = copyin(args, &vm86s, sizeof(vm86s)))
|
error = copyin(args, &vm86s, sizeof(vm86s));
|
||||||
return err;
|
if (error)
|
||||||
|
return (error);
|
||||||
|
|
||||||
pcb->vm86_userp = (void *)args;
|
pcb->vm86_userp = (void *)args;
|
||||||
|
|
||||||
|
@ -397,18 +398,19 @@ i386_vm86(p, args, retval)
|
||||||
case VCPU_086:
|
case VCPU_086:
|
||||||
case VCPU_186:
|
case VCPU_186:
|
||||||
case VCPU_286:
|
case VCPU_286:
|
||||||
pcb->vm86_flagmask = 0;
|
|
||||||
break;
|
|
||||||
case VCPU_386:
|
|
||||||
pcb->vm86_flagmask = PSL_NT|PSL_IOPL;
|
|
||||||
break;
|
|
||||||
case VCPU_486:
|
|
||||||
pcb->vm86_flagmask = PSL_AC|PSL_NT|PSL_IOPL;
|
|
||||||
break;
|
|
||||||
case VCPU_586:
|
|
||||||
default:
|
|
||||||
pcb->vm86_flagmask = PSL_ID|PSL_AC|PSL_NT|PSL_IOPL;
|
pcb->vm86_flagmask = PSL_ID|PSL_AC|PSL_NT|PSL_IOPL;
|
||||||
break;
|
break;
|
||||||
|
case VCPU_386:
|
||||||
|
pcb->vm86_flagmask = PSL_ID|PSL_AC;
|
||||||
|
break;
|
||||||
|
case VCPU_486:
|
||||||
|
pcb->vm86_flagmask = PSL_ID;
|
||||||
|
break;
|
||||||
|
case VCPU_586:
|
||||||
|
pcb->vm86_flagmask = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return (EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DOVREG(reg) tf->tf_vm86_##reg = (u_short) vm86s.regs.vmsc.sc_##reg
|
#define DOVREG(reg) tf->tf_vm86_##reg = (u_short) vm86s.regs.vmsc.sc_##reg
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: vm86.h,v 1.4 1996/04/11 10:07:25 mycroft Exp $ */
|
/* $NetBSD: vm86.h,v 1.5 1996/04/12 05:57:45 mycroft Exp $ */
|
||||||
|
|
||||||
#define VM86_USE_VIF
|
#define VM86_USE_VIF
|
||||||
|
|
||||||
|
@ -123,7 +123,8 @@ set_vflags(p, flags)
|
||||||
struct trapframe *tf = p->p_md.md_regs;
|
struct trapframe *tf = p->p_md.md_regs;
|
||||||
struct pcb *pcb = &p->p_addr->u_pcb;
|
struct pcb *pcb = &p->p_addr->u_pcb;
|
||||||
|
|
||||||
SETFLAGS(pcb->vm86_eflags, flags, pcb->vm86_flagmask | ~VM86_GETDIRECT);
|
flags &= ~pcb->vm86_flagmask;
|
||||||
|
SETFLAGS(pcb->vm86_eflags, flags, ~VM86_GETDIRECT);
|
||||||
SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT);
|
SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT);
|
||||||
#ifndef VM86_USE_VIF
|
#ifndef VM86_USE_VIF
|
||||||
if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
|
if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
|
||||||
|
@ -141,7 +142,7 @@ get_vflags(p)
|
||||||
struct pcb *pcb = &p->p_addr->u_pcb;
|
struct pcb *pcb = &p->p_addr->u_pcb;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
SETFLAGS(flags, pcb->vm86_eflags, pcb->vm86_flagmask | ~VM86_GETDIRECT);
|
SETFLAGS(flags, pcb->vm86_eflags, ~VM86_GETDIRECT);
|
||||||
SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT);
|
SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT);
|
||||||
return (flags);
|
return (flags);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +155,8 @@ set_vflags_short(p, flags)
|
||||||
struct trapframe *tf = p->p_md.md_regs;
|
struct trapframe *tf = p->p_md.md_regs;
|
||||||
struct pcb *pcb = &p->p_addr->u_pcb;
|
struct pcb *pcb = &p->p_addr->u_pcb;
|
||||||
|
|
||||||
SETFLAGS(pcb->vm86_eflags, flags, (pcb->vm86_flagmask | ~VM86_GETDIRECT) & 0xffff);
|
flags &= ~pcb->vm86_flagmask;
|
||||||
|
SETFLAGS(pcb->vm86_eflags, flags, ~VM86_GETDIRECT & 0xffff);
|
||||||
SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT & 0xffff);
|
SETFLAGS(tf->tf_eflags, flags, VM86_SETDIRECT & 0xffff);
|
||||||
#ifndef VM86_USE_VIF
|
#ifndef VM86_USE_VIF
|
||||||
if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
|
if ((pcb->vm86_eflags & (PSL_I|PSL_VIP)) == (PSL_I|PSL_VIP))
|
||||||
|
@ -170,7 +172,7 @@ get_vflags_short(p)
|
||||||
struct pcb *pcb = &p->p_addr->u_pcb;
|
struct pcb *pcb = &p->p_addr->u_pcb;
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
SETFLAGS(flags, pcb->vm86_eflags, (pcb->vm86_flagmask | ~VM86_GETDIRECT) & 0xffff);
|
SETFLAGS(flags, pcb->vm86_eflags, ~VM86_GETDIRECT & 0xffff);
|
||||||
SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT & 0xffff);
|
SETFLAGS(flags, tf->tf_eflags, VM86_GETDIRECT & 0xffff);
|
||||||
return (flags);
|
return (flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue