require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_MACHINE_CPU_H_)) {
    eval 'sub _MACHINE_CPU_H_ () {1;}' unless defined(&_MACHINE_CPU_H_);
    eval 'sub CPU_LED_BLINK () {1;}' unless defined(&CPU_LED_BLINK);
    eval 'sub CPU_CPUTYPE () {3;}' unless defined(&CPU_CPUTYPE);
    eval 'sub CPU_V8MUL () {4;}' unless defined(&CPU_V8MUL);
    eval 'sub CPU_MAXID () {5;}' unless defined(&CPU_MAXID);
    eval 'sub CTL_MACHDEP_NAMES () {{ { 0, 0}, { "led_blink",  &CTLTYPE_INT }, { 0, 0}, { "cputype",  &CTLTYPE_INT }, { "v8mul",  &CTLTYPE_INT }, };}' unless defined(&CTL_MACHDEP_NAMES);
    if(defined(&_KERNEL)) {
	require 'machine/psl.ph';
	require 'machine/reg.ph';
	require 'machine/intr.ph';
	require 'sparc/sparc/intreg.ph';
	require 'sparc/sparc/cpuvar.ph';
	eval 'sub CLKF_USERMODE {
	    my($framep) = @_;
    	    eval q(((($framep)-> &psr &  &PSR_PS) == 0));
	}' unless defined(&CLKF_USERMODE);
	eval 'sub CLKF_PC {
	    my($framep) = @_;
    	    eval q((($framep)-> &pc));
	}' unless defined(&CLKF_PC);
	eval 'sub CLKF_INTR {
	    my($framep) = @_;
    	    eval q((-> &fp <  &eintstack));
	}' unless defined(&CLKF_INTR);
	eval 'sub need_resched {
	    my($ci) = @_;
    	    eval q(( &want_resched = 1,  &want_ast = 1));
	}' unless defined(&need_resched);
	eval 'sub clear_resched {
	    my($ci) = @_;
    	    eval q( &want_resched = 0);
	}' unless defined(&clear_resched);
	eval 'sub PROC_PC {
	    my($p) = @_;
    	    eval q((($p)-> ($p_md->{md_tf}->{tf_pc})));
	}' unless defined(&PROC_PC);
	eval 'sub need_proftick {
	    my($p) = @_;
    	    eval q( &do {  &want_ast = 1; }  &while (0));
	}' unless defined(&need_proftick);
	eval 'sub signotify {
	    my($p) = @_;
    	    eval q(( &want_ast = 1));
	}' unless defined(&signotify);
	if(defined(&KGDB)) {
	}
	if(defined(&KGDB)) {
	}
    }
}
1;
