require '_h2ph_pre.ph';

unless(defined(&_MACHINE_PMAP_H_)) {
    eval 'sub _MACHINE_PMAP_H_ () {1;}' unless defined(&_MACHINE_PMAP_H_);
    eval 'sub MAXKL2SIZE () {32;}' unless defined(&MAXKL2SIZE);
    eval 'sub MAXUL2SIZE () {16;}' unless defined(&MAXUL2SIZE);
    eval 'sub l2tobm {
        local($n) = @_;
	    eval q((1<< ($n)));
    }' unless defined(&l2tobm);
    eval 'sub bmtol2 {
        local($n) = @_;
	    eval q(( &ffs($n) - 1));
    }' unless defined(&bmtol2);
    eval 'sub PMAP_ACTIVATE {
        local($pmap, $loadhw) = @_;
	    eval q({  &if (($loadhw))  &loadustp( &m68k_btop(($pmap)-> &pm_stpa)); });
    }' unless defined(&PMAP_ACTIVATE);
    eval 'sub PV_CI () {0x01;}' unless defined(&PV_CI);
    eval 'sub PV_PTPAGE () {0x02;}' unless defined(&PV_PTPAGE);
    eval 'sub NPVPPG () {340;}' unless defined(&NPVPPG);
    if(defined(&_KERNEL)) {
	eval 'sub pmap_kernel () {
	    eval q(( &kernel_pmap_store));
	}' unless defined(&pmap_kernel);
	eval 'sub active_pmap {
	    local($pm) = @_;
    	    eval q((($pm) ==  &pmap_kernel() || ($pm) ==  ($curproc->{p_vmspace}->{vm_map}->{pmap})));
	}' unless defined(&active_pmap);
	eval 'sub active_user_pmap {
	    local($pm) = @_;
    	    eval q(( &curproc  && ($pm) !=  &pmap_kernel()  && ($pm) ==  ($curproc->{p_vmspace}->{vm_map}->{pmap})));
	}' unless defined(&active_user_pmap);
	eval 'sub pmap_resident_count {
	    local($pmap) = @_;
    	    eval q((($pmap)-> ($pm_stats->{resident_count})));
	}' unless defined(&pmap_resident_count);
	eval 'sub pmap_wired_count {
	    local($pmap) = @_;
    	    eval q((($pmap)-> ($pm_stats->{wired_count})));
	}' unless defined(&pmap_wired_count);
    }
}
1;
