require '_h2ph_pre.ph';

no warnings qw(redefine misc);

require 'arm/cdefs.ph';
if(0) {
    eval 'sub PT_STEP () {( &PT_FIRSTMACH + 0);}' unless defined(&PT_STEP);
}
eval 'sub PT_GETREGS () {( &PT_FIRSTMACH + 1);}' unless defined(&PT_GETREGS);
eval 'sub PT_SETREGS () {( &PT_FIRSTMACH + 2);}' unless defined(&PT_SETREGS);
eval 'sub PT_GETFPREGS () {( &PT_FIRSTMACH + 5);}' unless defined(&PT_GETFPREGS);
eval 'sub PT_SETFPREGS () {( &PT_FIRSTMACH + 6);}' unless defined(&PT_SETFPREGS);
if(0) {
    eval 'sub PT_SETSTEP () {( &PT_FIRSTMACH + 7);}' unless defined(&PT_SETSTEP);
    eval 'sub PT_CLEARSTEP () {( &PT_FIRSTMACH + 8);}' unless defined(&PT_CLEARSTEP);
}
eval 'sub PT_MACHDEP_STRINGS () {"n/a PT_STEP", "PT_GETREGS", "PT_SETREGS", "old PT_GETFPREGS", "old PT_SETFPREGS", "PT_GETFPREGS", "PT_SETFPREGS", "n/a PT_SETSTEP", "n/a PT_CLEARSTEP",;}' unless defined(&PT_MACHDEP_STRINGS);
require 'machine/reg.ph';
eval 'sub PTRACE_REG_PC {
    my($_r) = @_;
	eval q(($_r)-> &r_pc);
}' unless defined(&PTRACE_REG_PC);
eval 'sub PTRACE_REG_FP {
    my($_r) = @_;
	eval q(($_r)-> $r[11]);
}' unless defined(&PTRACE_REG_FP);
eval 'sub PTRACE_REG_SET_PC {
    my($_r, $_v) = @_;
	eval q(($_r)-> &r_pc = ($_v));
}' unless defined(&PTRACE_REG_SET_PC);
eval 'sub PTRACE_REG_SP {
    my($_r) = @_;
	eval q(($_r)-> &r_sp);
}' unless defined(&PTRACE_REG_SP);
eval 'sub PTRACE_REG_INTRV {
    my($_r) = @_;
	eval q(($_r)-> $r[0]);
}' unless defined(&PTRACE_REG_INTRV);
eval 'sub PTRACE_ILLEGAL_ASM () { &__asm  &__volatile ("udf #0" : : : "memory");}' unless defined(&PTRACE_ILLEGAL_ASM);
if(defined(&__ARMEL__) || defined(&_ARM_ARCH_BE8)) {
    eval 'sub PTRACE_BREAKPOINT () {(( &const  $uint8_t[]) { 0xfe, 0xde, 0xff, 0xe7 });}' unless defined(&PTRACE_BREAKPOINT);
} else {
    eval 'sub PTRACE_BREAKPOINT () {(( &const  $uint8_t[]) { 0xe7, 0xff, 0xde, 0xfe });}' unless defined(&PTRACE_BREAKPOINT);
}
if(defined(&_ARM_ARCH_BE8)) {
    eval 'sub PTRACE_BREAKPOINT_INSN () {0xfedeffe7;}' unless defined(&PTRACE_BREAKPOINT_INSN);
} else {
    eval 'sub PTRACE_BREAKPOINT_INSN () {0xe7ffdefe;}' unless defined(&PTRACE_BREAKPOINT_INSN);
}
eval 'sub PTRACE_BREAKPOINT_ASM () { &__asm  &__volatile (".word "  &___STRING( &PTRACE_BREAKPOINT_INSN) );}' unless defined(&PTRACE_BREAKPOINT_ASM);
eval 'sub PTRACE_BREAKPOINT_SIZE () {4;}' unless defined(&PTRACE_BREAKPOINT_SIZE);
1;
