require '_h2ph_pre.ph';

no warnings 'redefine';

undef(&VM86_USE_VIF) if defined(&VM86_USE_VIF);
unless(defined(&SETFLAGS)) {
    sub SETFLAGS {
	local($targ, $new, $newmask) = @_;
	eval q(($targ) = (($targ) & ~($newmask)) | (($new) & ($newmask)));
    }
}
unless(defined(&VM86_TYPE)) {
    sub VM86_TYPE {
	local($x) = @_;
	eval q((($x) & 0xff));
    }
}
unless(defined(&VM86_ARG)) {
    sub VM86_ARG {
	local($x) = @_;
	eval q(((($x) & 0xff00) >> 8));
    }
}
unless(defined(&VM86_MAKEVAL)) {
    sub VM86_MAKEVAL {
	local($type,$arg) = @_;
	eval q((($type) | ((($arg) & 0xff) << 8)));
    }
}
unless(defined(&VM86_STI)) {
    sub VM86_STI () {	0;}
}
unless(defined(&VM86_INTx)) {
    sub VM86_INTx () {	1;}
}
unless(defined(&VM86_SIGNAL)) {
    sub VM86_SIGNAL () {	2;}
}
unless(defined(&VM86_UNKNOWN)) {
    sub VM86_UNKNOWN () {	3;}
}
unless(defined(&VM86_REALFLAGS)) {
    sub VM86_REALFLAGS () {	(~ &PSL_USERSTATIC);}
}
unless(defined(&VM86_VIRTFLAGS)) {
    sub VM86_VIRTFLAGS () {	( &PSL_USERSTATIC & ~( &PSL_MBO |  &PSL_MBZ));}
}
unless(defined(&cpu_type)) {
    sub cpu_type () {	 ($substr->{ss_cpu_type});}
}
unless(defined(&VCPU_086)) {
    sub VCPU_086 () {	0;}
}
unless(defined(&VCPU_186)) {
    sub VCPU_186 () {	1;}
}
unless(defined(&VCPU_286)) {
    sub VCPU_286 () {	2;}
}
unless(defined(&VCPU_386)) {
    sub VCPU_386 () {	3;}
}
unless(defined(&VCPU_486)) {
    sub VCPU_486 () {	4;}
}
unless(defined(&VCPU_586)) {
    sub VCPU_586 () {	5;}
}
if(defined(&_KERNEL)) {
# some #ifdef were dropped here -- fill in the blanks
    eval 'sub clr_vif {
        local($p) = @_;
	    eval q(*$p; { \'struct pcb\' * &pcb =  ($p->{p_addr}->{u_pcb}); });
    }' unless defined(&clr_vif);
# some #ifdef were dropped here -- fill in the blanks
    eval 'sub set_vif {
        local($p) = @_;
	    eval q(*$p; { \'struct pcb\' * &pcb =  ($p->{p_addr}->{u_pcb});  &vm86_return($p,  &VM86_STI); });
    }' unless defined(&set_vif);
# some #ifdef were dropped here -- fill in the blanks
    eval 'sub set_vflags {
        local($p,$flags) = @_;
	    eval q(*$p; \'int\' $flags; { \'struct trapframe\' * &tf =  ($p->{p_md}->{md_regs}); \'struct pcb\' * &pcb =  ($p->{p_addr}->{u_pcb}); $flags &= ~ ($pcb->{vm86_flagmask});  &SETFLAGS( ($pcb->{vm86_eflags}), $flags,  &VM86_VIRTFLAGS);  &SETFLAGS( ($tf->{tf_eflags}), $flags,  &VM86_REALFLAGS);  &vm86_return($p,  &VM86_STI); });
    }' unless defined(&set_vflags);
    eval 'sub get_vflags {
        local($p) = @_;
	    eval q(*$p; { \'struct trapframe\' * &tf =  ($p->{p_md}->{md_regs}); \'struct pcb\' * &pcb =  ($p->{p_addr}->{u_pcb}); \'int\'  &flags =  &PSL_MBO;  &SETFLAGS( &flags,  ($pcb->{vm86_eflags}),  &VM86_VIRTFLAGS);  &SETFLAGS( &flags,  ($tf->{tf_eflags}),  &VM86_REALFLAGS); ( &flags); });
    }' unless defined(&get_vflags);
# some #ifdef were dropped here -- fill in the blanks
    eval 'sub set_vflags_short {
        local($p,$flags) = @_;
	    eval q(*$p; \'int\' $flags; { \'struct trapframe\' * &tf =  ($p->{p_md}->{md_regs}); \'struct pcb\' * &pcb =  ($p->{p_addr}->{u_pcb}); $flags &= ~ ($pcb->{vm86_flagmask});  &SETFLAGS( ($pcb->{vm86_eflags}), $flags,  &VM86_VIRTFLAGS & 0xffff);  &SETFLAGS( ($tf->{tf_eflags}), $flags,  &VM86_REALFLAGS & 0xffff); });
    }' unless defined(&set_vflags_short);
    eval 'sub get_vflags_short {
        local($p) = @_;
	    eval q(*$p; { \'struct trapframe\' * &tf =  ($p->{p_md}->{md_regs}); \'struct pcb\' * &pcb =  ($p->{p_addr}->{u_pcb}); \'int\'  &flags =  &PSL_MBO;  &SETFLAGS( &flags,  ($pcb->{vm86_eflags}),  &VM86_VIRTFLAGS & 0xffff);  &SETFLAGS( &flags,  ($tf->{tf_eflags}),  &VM86_REALFLAGS & 0xffff); ( &flags); });
    }' unless defined(&get_vflags_short);
} else {
}
1;
