require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_M88K_DB_MACHDEP_H_)) {
    eval 'sub _M88K_DB_MACHDEP_H_ () {1;}' unless defined(&_M88K_DB_MACHDEP_H_);
    eval 'sub DDB_ENTRY_BKPT_NO () {130;}' unless defined(&DDB_ENTRY_BKPT_NO);
    eval 'sub DDB_ENTRY_TRACE_NO () {131;}' unless defined(&DDB_ENTRY_TRACE_NO);
    eval 'sub DDB_ENTRY_TRAP_NO () {132;}' unless defined(&DDB_ENTRY_TRAP_NO);
    unless(defined(&_LOCORE)) {
	require 'machine/reg.ph';
	require 'machine/trap.ph';
	require 'uvm/uvm_param.ph';
	eval 'sub SET_PC_REGS {
	    my($regs, $value) = @_;
    	    eval q( &do { ($regs)-> &sxip = ($value); ($regs)-> &snip = ($value) + 4; }  &while (0));
	}' unless defined(&SET_PC_REGS);
	if(defined(&DDB)) {
	    eval 'sub BKPT_SIZE () {(4);}' unless defined(&BKPT_SIZE);
	    eval 'sub BKPT_INST () {(0xf000d000 |  &DDB_ENTRY_BKPT_NO);}' unless defined(&BKPT_INST);
	    eval 'sub BKPT_SET {
	        my($inst) = @_;
    		eval q(( &BKPT_INST));
	    }' unless defined(&BKPT_SET);
	    eval 'sub ENTRY_ASM () {"tb0 0, r0, 132";}' unless defined(&ENTRY_ASM);
	    eval 'sub DDB_REGS () {( &ddb_regs);}' unless defined(&DDB_REGS);
	    eval 'sub inst_call {
	        my($I) = @_;
    		eval q(((($I) & 0xf8000000) == 0xc8000000 || (($I) & 0xfffffbe0) == 0xf400c800 ));
	    }' unless defined(&inst_call);
	    eval 'sub inst_return {
	        my($I) = @_;
    		eval q(((($I) & 0xfffffbff) == 0xf400c001));
	    }' unless defined(&inst_return);
	    eval 'sub inst_trap_return {
	        my($I) = @_;
    		eval q((($I) == 0xf400c000));
	    }' unless defined(&inst_trap_return);
	    eval 'sub IS_BREAKPOINT_TRAP {
	        my($type,$code) = @_;
    		eval q((($type)== &T_KDB_BREAK));
	    }' unless defined(&IS_BREAKPOINT_TRAP);
	    eval 'sub IS_WATCHPOINT_TRAP {
	        my($type,$code) = @_;
    		eval q(0);
	    }' unless defined(&IS_WATCHPOINT_TRAP);
	    eval 'sub DB_MACHINE_COMMANDS () {1;}' unless defined(&DB_MACHINE_COMMANDS);
	    eval 'sub DB_AOUT_SYMBOLS () {1;}' unless defined(&DB_AOUT_SYMBOLS);
	}
    }
}
1;
