require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_ARM_FRAME_H_)) {
    eval 'sub _ARM_FRAME_H_ () {1;}' unless defined(&_ARM_FRAME_H_);
    unless(defined(&_LOCORE)) {
	require 'sys/signal.ph';
	require 'sys/ucontext.ph';
	eval 'sub tf_ip () { &tf_r12;}' unless defined(&tf_ip);
	eval 'sub tf_r13 () { &tf_usr_sp;}' unless defined(&tf_r13);
	eval 'sub tf_r14 () { &tf_usr_lr;}' unless defined(&tf_r14);
	eval 'sub tf_r15 () { &tf_pc;}' unless defined(&tf_r15);
	eval 'sub TRAP_USERMODE {
	    my($tf) = @_;
    	    eval q(((($tf)-> &tf_spsr &  &PSR_MODE) ==  &PSR_USR32_MODE));
	}' unless defined(&TRAP_USERMODE);
	eval 'sub FB_R4 () {0;}' unless defined(&FB_R4);
	eval 'sub FB_R5 () {1;}' unless defined(&FB_R5);
	eval 'sub FB_R6 () {2;}' unless defined(&FB_R6);
	eval 'sub FB_R7 () {3;}' unless defined(&FB_R7);
	eval 'sub FB_R8 () {4;}' unless defined(&FB_R8);
	eval 'sub FB_R9 () {5;}' unless defined(&FB_R9);
	eval 'sub FB_R10 () {6;}' unless defined(&FB_R10);
	eval 'sub FB_R11 () {7;}' unless defined(&FB_R11);
	eval 'sub FB_R12 () {8;}' unless defined(&FB_R12);
	eval 'sub FB_R13 () {9;}' unless defined(&FB_R13);
	eval 'sub FB_R14 () {10;}' unless defined(&FB_R14);
	eval 'sub FB_MAX () {11;}' unless defined(&FB_MAX);
	if(defined(&COMPAT_16)) {
	}
	if(defined(&_KERNEL) || defined(&_KMEMUSER)) {
	    if(defined(&_KERNEL)) {
		eval 'sub lwp_settrapframe {
		    my($l, $tf) = @_;
    		    eval q((($l)-> ($l_md->{md_tf}) = ($tf)));
		}' unless defined(&lwp_settrapframe);
	    }
	    eval 'sub lwp_trapframe {
	        my($l) = @_;
    		eval q((($l)-> ($l_md->{md_tf})));
	    }' unless defined(&lwp_trapframe);
	}
    }
}
1;
