require '_h2ph_pre.ph';

unless(defined(&_SPARC_PMAP_H_)) {
    eval 'sub _SPARC_PMAP_H_ () {1;}' unless defined(&_SPARC_PMAP_H_);
    require 'machine/pte.ph';
    eval 'sub NKREG () {(((- &KERNBASE) /  &NBPRG));}' unless defined(&NKREG);
    eval 'sub NUREG () {(256-  &NKREG);}' unless defined(&NUREG);
    eval 'sub PV_MOD () {1;}' unless defined(&PV_MOD);
    eval 'sub PV_REF () {2;}' unless defined(&PV_REF);
    eval 'sub PV_NC () {4;}' unless defined(&PV_NC);
    eval 'sub PV_REF4M () {1;}' unless defined(&PV_REF4M);
    eval 'sub PV_MOD4M () {2;}' unless defined(&PV_MOD4M);
    eval 'sub PV_C4M () {4;}' unless defined(&PV_C4M);
    eval 'sub PV_ANC () {0x10;}' unless defined(&PV_ANC);
    if(0) {
    }
    if(defined(&_KERNEL)) {
	eval 'sub PMAP_NULL () {(0);}' unless defined(&PMAP_NULL);
	eval 'sub PMAP_OBIO () {1;}' unless defined(&PMAP_OBIO);
	eval 'sub PMAP_VME16 () {2;}' unless defined(&PMAP_VME16);
	eval 'sub PMAP_VME32 () {3;}' unless defined(&PMAP_VME32);
	eval 'sub PMAP_NC () {4;}' unless defined(&PMAP_NC);
	eval 'sub PMAP_TNC_4 () {7;}' unless defined(&PMAP_TNC_4);
	eval 'sub PMAP_T2PTE_4 {
	    local($x) = @_;
    	    eval q(((($x) &  &PMAP_TNC_4) <<  &PG_TNC_SHIFT));
	}' unless defined(&PMAP_T2PTE_4);
	eval 'sub PMAP_IOENC_4 {
	    local($io) = @_;
    	    eval q(($io));
	}' unless defined(&PMAP_IOENC_4);
	eval 'sub PMAP_TYPE_SRMMU () {0x78;}' unless defined(&PMAP_TYPE_SRMMU);
	eval 'sub PMAP_PTESHFT_SRMMU () {25;}' unless defined(&PMAP_PTESHFT_SRMMU);
	eval 'sub PMAP_SHFT_SRMMU () {3;}' unless defined(&PMAP_SHFT_SRMMU);
	eval 'sub PMAP_TNC_SRMMU () {127;}' unless defined(&PMAP_TNC_SRMMU);
	eval 'sub PMAP_T2PTE_SRMMU {
	    local($x) = @_;
    	    eval q(((($x) &  &PMAP_TYPE_SRMMU) <<  &PMAP_PTESHFT_SRMMU));
	}' unless defined(&PMAP_T2PTE_SRMMU);
	eval 'sub PMAP_IOENC_SRMMU {
	    local($io) = @_;
    	    eval q((($io) <<  &PMAP_SHFT_SRMMU));
	}' unless defined(&PMAP_IOENC_SRMMU);
	eval 'sub PMAP_IOENC {
	    local($io) = @_;
    	    eval q(( &CPU_ISSUN4M ?  &PMAP_IOENC_SRMMU($io) :  &PMAP_IOENC_4($io)));
	}' unless defined(&PMAP_IOENC);
	eval 'sub pmap_kernel () {
	    eval q(( &kernel_pmap_store));
	}' unless defined(&pmap_kernel);
	eval 'sub pmap_resident_count {
	    local($pmap) = @_;
    	    eval q( &pmap_count_ptes($pmap));
	}' unless defined(&pmap_resident_count);
	eval 'sub PMAP_ACTIVATE {
	    local($pmap, $pcb, $iscurproc) = @_;
    	    eval q();
	}' unless defined(&PMAP_ACTIVATE);
	eval 'sub PMAP_DEACTIVATE {
	    local($pmap, $pcb) = @_;
    	    eval q();
	}' unless defined(&PMAP_DEACTIVATE);
	eval 'sub PMAP_PREFER {
	    local($fo, $ap) = @_;
    	    eval q( &pmap_prefer(($fo), ($ap)));
	}' unless defined(&PMAP_PREFER);
	eval 'sub PMAP_EXCLUDE_DECLS () {1;}' unless defined(&PMAP_EXCLUDE_DECLS);
	eval 'sub kvm_uncache {
	    local($addr, $npages) = @_;
    	    eval q( &kvm_setcache($addr, $npages, 0));
	}' unless defined(&kvm_uncache);
	eval 'sub kvm_recache {
	    local($addr, $npages) = @_;
    	    eval q( &kvm_setcache($addr, $npages, 1));
	}' unless defined(&kvm_recache);
	if(defined( &SUN4) || defined( &SUN4C)) {
	}
	if(defined( &SUN4M)) {
	}
	if(!defined( &SUN4M)  && (defined( &SUN4) || defined( &SUN4C))) {
	    eval 'sub pmap_clear_modify () { &pmap_clear_modify4_4c;}' unless defined(&pmap_clear_modify);
	    eval 'sub pmap_clear_reference () { &pmap_clear_reference4_4c;}' unless defined(&pmap_clear_reference);
	    eval 'sub pmap_copy_page () { &pmap_copy_page4_4c;}' unless defined(&pmap_copy_page);
	    eval 'sub pmap_enter () { &pmap_enter4_4c;}' unless defined(&pmap_enter);
	    eval 'sub pmap_extract () { &pmap_extract4_4c;}' unless defined(&pmap_extract);
	    eval 'sub pmap_is_modified () { &pmap_is_modified4_4c;}' unless defined(&pmap_is_modified);
	    eval 'sub pmap_is_referenced () { &pmap_is_referenced4_4c;}' unless defined(&pmap_is_referenced);
	    eval 'sub pmap_kenter_pa () { &pmap_kenter_pa4_4c;}' unless defined(&pmap_kenter_pa);
	    eval 'sub pmap_kenter_pgs () { &pmap_kenter_pgs4_4c;}' unless defined(&pmap_kenter_pgs);
	    eval 'sub pmap_kremove () { &pmap_kremove4_4c;}' unless defined(&pmap_kremove);
	    eval 'sub pmap_page_protect () { &pmap_page_protect4_4c;}' unless defined(&pmap_page_protect);
	    eval 'sub pmap_protect () { &pmap_protect4_4c;}' unless defined(&pmap_protect);
	    eval 'sub pmap_zero_page () { &pmap_zero_page4_4c;}' unless defined(&pmap_zero_page);
	    eval 'sub pmap_changeprot () { &pmap_changeprot4_4c;}' unless defined(&pmap_changeprot);
	}
 elsif(defined( &SUN4M)  && !(defined( &SUN4) || defined( &SUN4C))) {
	    eval 'sub pmap_clear_modify () { &pmap_clear_modify4m;}' unless defined(&pmap_clear_modify);
	    eval 'sub pmap_clear_reference () { &pmap_clear_reference4m;}' unless defined(&pmap_clear_reference);
	    eval 'sub pmap_copy_page () { &pmap_copy_page4m;}' unless defined(&pmap_copy_page);
	    eval 'sub pmap_enter () { &pmap_enter4m;}' unless defined(&pmap_enter);
	    eval 'sub pmap_extract () { &pmap_extract4m;}' unless defined(&pmap_extract);
	    eval 'sub pmap_is_modified () { &pmap_is_modified4m;}' unless defined(&pmap_is_modified);
	    eval 'sub pmap_is_referenced () { &pmap_is_referenced4m;}' unless defined(&pmap_is_referenced);
	    eval 'sub pmap_kenter_pa () { &pmap_kenter_pa4m;}' unless defined(&pmap_kenter_pa);
	    eval 'sub pmap_kenter_pgs () { &pmap_kenter_pgs4m;}' unless defined(&pmap_kenter_pgs);
	    eval 'sub pmap_kremove () { &pmap_kremove4m;}' unless defined(&pmap_kremove);
	    eval 'sub pmap_page_protect () { &pmap_page_protect4m;}' unless defined(&pmap_page_protect);
	    eval 'sub pmap_protect () { &pmap_protect4m;}' unless defined(&pmap_protect);
	    eval 'sub pmap_zero_page () { &pmap_zero_page4m;}' unless defined(&pmap_zero_page);
	    eval 'sub pmap_changeprot () { &pmap_changeprot4m;}' unless defined(&pmap_changeprot);
	} else {
	    eval 'sub pmap_clear_modify () {(* &pmap_clear_modify_p);}' unless defined(&pmap_clear_modify);
	    eval 'sub pmap_clear_reference () {(* &pmap_clear_reference_p);}' unless defined(&pmap_clear_reference);
	    eval 'sub pmap_copy_page () {(* &pmap_copy_page_p);}' unless defined(&pmap_copy_page);
	    eval 'sub pmap_enter () {(* &pmap_enter_p);}' unless defined(&pmap_enter);
	    eval 'sub pmap_extract () {(* &pmap_extract_p);}' unless defined(&pmap_extract);
	    eval 'sub pmap_is_modified () {(* &pmap_is_modified_p);}' unless defined(&pmap_is_modified);
	    eval 'sub pmap_is_referenced () {(* &pmap_is_referenced_p);}' unless defined(&pmap_is_referenced);
	    eval 'sub pmap_kenter_pa () {(* &pmap_kenter_pa_p);}' unless defined(&pmap_kenter_pa);
	    eval 'sub pmap_kenter_pgs () {(* &pmap_kenter_pgs_p);}' unless defined(&pmap_kenter_pgs);
	    eval 'sub pmap_kremove () {(* &pmap_kremove_p);}' unless defined(&pmap_kremove);
	    eval 'sub pmap_page_protect () {(* &pmap_page_protect_p);}' unless defined(&pmap_page_protect);
	    eval 'sub pmap_protect () {(* &pmap_protect_p);}' unless defined(&pmap_protect);
	    eval 'sub pmap_zero_page () {(* &pmap_zero_page_p);}' unless defined(&pmap_zero_page);
	    eval 'sub pmap_changeprot () {(* &pmap_changeprot_p);}' unless defined(&pmap_changeprot);
	}
    }
}
1;
