require '_h2ph_pre.ph';

unless(defined(&_PPC_DB_MACHDEP_H_)) {
    eval 'sub _PPC_DB_MACHDEP_H_ () {1;}' unless defined(&_PPC_DB_MACHDEP_H_);
    require 'sys/types.ph';
    require 'uvm/uvm_param.ph';
    require 'machine/trap.ph';
    eval 'sub DB_ELF_SYMBOLS () {1;}' unless defined(&DB_ELF_SYMBOLS);
    eval 'sub DB_ELFSIZE () {32;}' unless defined(&DB_ELFSIZE);
    eval 'sub DDB_REGS () {( &ddb_regs);}' unless defined(&DDB_REGS);
    eval 'sub PC_REGS {
        local($regs) = @_;
	    eval q((($regs)-> ($tf->{srr0})));
    }' unless defined(&PC_REGS);
    eval 'sub BKPT_INST () {0x7c810808;}' unless defined(&BKPT_INST);
    eval 'sub BKPT_SIZE () {(4);}' unless defined(&BKPT_SIZE);
    eval 'sub BKPT_SET {
        local($inst) = @_;
	    eval q(( &BKPT_INST));
    }' unless defined(&BKPT_SET);
    eval 'sub FIXUP_PC_AFTER_BREAK {
        local($regs) = @_;
	    eval q((($regs)-> ($tf->{srr0}) -= 4));
    }' unless defined(&FIXUP_PC_AFTER_BREAK);
    eval 'sub SR_SINGLESTEP () {0x8000;}' unless defined(&SR_SINGLESTEP);
    eval 'sub db_clear_single_step {
        local($regs) = @_;
	    eval q((($regs)-> ($tf->{srr1}) &= ~ &SR_SINGLESTEP));
    }' unless defined(&db_clear_single_step);
    eval 'sub db_set_single_step {
        local($regs) = @_;
	    eval q((($regs)-> ($tf->{srr1}) |=  &SR_SINGLESTEP));
    }' unless defined(&db_set_single_step);
    eval 'sub T_BREAKPOINT () {0xffff;}' unless defined(&T_BREAKPOINT);
    eval 'sub IS_BREAKPOINT_TRAP {
        local($type, $code) = @_;
	    eval q((($type) ==  &T_BREAKPOINT));
    }' unless defined(&IS_BREAKPOINT_TRAP);
    if(defined(&T_WATCHPOINT)) {
	eval 'sub IS_WATCHPOINT_TRAP {
	    local($type, $code) = @_;
    	    eval q((($type) ==  &T_WATCHPOINT));
	}' unless defined(&IS_WATCHPOINT_TRAP);
    } else {
	eval 'sub IS_WATCHPOINT_TRAP {
	    local($type, $code) = @_;
    	    eval q(0);
	}' unless defined(&IS_WATCHPOINT_TRAP);
    }
    eval 'sub M_RTS () {0xfc0007fe;}' unless defined(&M_RTS);
    eval 'sub I_RTS () {0x4c000020;}' unless defined(&I_RTS);
    eval 'sub M_BC () {0xfc000000;}' unless defined(&M_BC);
    eval 'sub I_BC () {0x40000000;}' unless defined(&I_BC);
    eval 'sub M_B () {0xfc000000;}' unless defined(&M_B);
    eval 'sub I_B () {0x50000000;}' unless defined(&I_B);
    eval 'sub M_RFI () {0xfc0007fe;}' unless defined(&M_RFI);
    eval 'sub I_RFI () {0x4c000064;}' unless defined(&I_RFI);
    eval 'sub inst_trap_return {
        local($ins) = @_;
	    eval q(((($ins) &M_RFI) ==  &I_RFI));
    }' unless defined(&inst_trap_return);
    eval 'sub inst_return {
        local($ins) = @_;
	    eval q(((($ins) &M_RTS) ==  &I_RTS));
    }' unless defined(&inst_return);
    eval 'sub inst_call {
        local($ins) = @_;
	    eval q(((($ins) &M_BC ) ==  &I_BC || (($ins) &M_B ) ==  &I_B ));
    }' unless defined(&inst_call);
    eval 'sub inst_load {
        local($ins) = @_;
	    eval q(0);
    }' unless defined(&inst_load);
    eval 'sub inst_store {
        local($ins) = @_;
	    eval q(0);
    }' unless defined(&inst_store);
    if(defined(&_KERNEL)) {
    }
}
1;
