require '_h2ph_pre.ph';

unless(defined(&_SPARC_CPU_H_)) {
    eval 'sub _SPARC_CPU_H_ () {1;}' unless defined(&_SPARC_CPU_H_);
    eval 'sub CPU_LED_BLINK () {1;}' unless defined(&CPU_LED_BLINK);
    eval 'sub CPU_VSYNCBLANK () {2;}' unless defined(&CPU_VSYNCBLANK);
    eval 'sub CPU_MAXID () {3;}' unless defined(&CPU_MAXID);
    eval 'sub CTL_MACHDEP_NAMES () {{ { 0, 0}, { "led_blink",  &CTLTYPE_INT }, { "vsyncblank",  &CTLTYPE_INT }, };}' unless defined(&CTL_MACHDEP_NAMES);
    if(defined(&_KERNEL)) {
	require 'machine/psl.ph';
	require 'sparc/sparc/intreg.ph';
	eval 'sub cpu_swapin {
	    local($p) = @_;
    	    eval q();
	}' unless defined(&cpu_swapin);
	eval 'sub cpu_swapout {
	    local($p) = @_;
    	    eval q();
	}' unless defined(&cpu_swapout);
	eval 'sub cpu_wait {
	    local($p) = @_;
    	    eval q();
	}' unless defined(&cpu_wait);
	eval 'sub CLKF_USERMODE {
	    local($framep) = @_;
    	    eval q(((($framep)-> &psr &  &PSR_PS) == 0));
	}' unless defined(&CLKF_USERMODE);
	eval 'sub CLKF_BASEPRI {
	    local($framep) = @_;
    	    eval q(((($framep)-> &psr &  &PSR_PIL) == 0));
	}' unless defined(&CLKF_BASEPRI);
	eval 'sub CLKF_PC {
	    local($framep) = @_;
    	    eval q((($framep)-> &pc));
	}' unless defined(&CLKF_PC);
	eval 'sub CLKF_INTR {
	    local($framep) = @_;
    	    eval q((-> &fp <  &eintstack));
	}' unless defined(&CLKF_INTR);
	eval 'sub SIR_NET () {0;}' unless defined(&SIR_NET);
	eval 'sub SIR_CLOCK () {1;}' unless defined(&SIR_CLOCK);
	if(defined( &SUN4M)) {
	    if(!(defined( &SUN4) || defined( &SUN4C))) {
		eval 'sub setsoftint () {
		    eval q( &raise(0,1));
		}' unless defined(&setsoftint);
	    } else {
		eval 'sub setsoftint () {
		    eval q(( &cputyp ==  &CPU_SUN4M ?  &raise(0,1) :  &ienab_bis( &IE_L1)));
		}' unless defined(&setsoftint);
	    }
	} else {
	    eval 'sub setsoftint () {
	        eval q( &ienab_bis( &IE_L1));
	    }' unless defined(&setsoftint);
	}
	eval 'sub setsoftnet () {
	    eval q(( ($sir->{sir_which[&SIR_NET]}) = 1,  &setsoftint()));
	}' unless defined(&setsoftnet);
	eval 'sub setsoftclock () {
	    eval q(( ($sir->{sir_which[&SIR_CLOCK]}) = 1,  &setsoftint()));
	}' unless defined(&setsoftclock);
	eval 'sub need_resched () {
	    eval q(( &want_resched = 1,  &want_ast = 1));
	}' unless defined(&need_resched);
	eval 'sub need_proftick {
	    local($p) = @_;
    	    eval q((($p)-> &p_flag |=  &P_OWEUPC,  &want_ast = 1));
	}' unless defined(&need_proftick);
	eval 'sub signotify {
	    local($p) = @_;
    	    eval q(( &want_ast = 1));
	}' unless defined(&signotify);
	if(defined(&KGDB)) {
	}
	if(defined(&KGDB)) {
	}
    }
}
1;
