require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_ARM_LOCK_H_)) {
    eval 'sub _ARM_LOCK_H_ () {1;}' unless defined(&_ARM_LOCK_H_);
    eval 'sub __SIMPLELOCK_LOCKED_P {
        my($__ptr) = @_;
	    eval q({ *$__ptr ==  &__SIMPLELOCK_LOCKED; });
    }' unless defined(&__SIMPLELOCK_LOCKED_P);
    eval 'sub __SIMPLELOCK_UNLOCKED_P {
        my($__ptr) = @_;
	    eval q({ *$__ptr ==  &__SIMPLELOCK_UNLOCKED; });
    }' unless defined(&__SIMPLELOCK_UNLOCKED_P);
    eval 'sub __cpu_simple_lock_clear {
        my($__ptr) = @_;
	    eval q({ *$__ptr =  &__SIMPLELOCK_UNLOCKED; });
    }' unless defined(&__cpu_simple_lock_clear);
    eval 'sub __cpu_simple_lock_set {
        my($__ptr) = @_;
	    eval q({ *$__ptr =  &__SIMPLELOCK_LOCKED; });
    }' unless defined(&__cpu_simple_lock_set);
    if(defined(&_ARM_ARCH_6)) {
	eval 'sub __arm_load_exclusive {
	    my($__alp) = @_;
    	    eval q({ my $__rv;  &if ( $sizeof{$__alp} == 1) {  &__asm  &__volatile(\\"ldrexb\\\\t%0,[%1]\\" : \\"=r\\"( $__rv) : \\"r\\"($__alp)); }  &else {  &__asm  &__volatile(\\"ldrex\\\\t%0,[%1]\\" : \\"=r\\"( $__rv) : \\"r\\"($__alp)); }  $__rv; });
	}' unless defined(&__arm_load_exclusive);
    }
 elsif(defined(&_KERNEL)) {
	eval 'sub __swp {
	    my($__val,$__ptr) = @_;
    	    eval q({  &uint32_t  &__val32;  &__asm  &volatile(\\"swpb	%0, %1, [%2]\\" : \\"=&r\\" ( &__val32) : \\"r\\" ($__val), \\"r\\" ($__ptr) : \\"memory\\");  &__val32; });
	}' unless defined(&__swp);
    } else {
	if(1) {
	} else {
	}
    }
    if(defined(&_ARM_ARCH_7)) {
    }
 elsif(defined(&_ARM_ARCH_6)) {
    }
    if(defined(&_ARM_ARCH_7)) {
    }
 elsif(defined(&_ARM_ARCH_6)) {
    }
    eval 'sub __cpu_simple_lock_init {
        my($__alp) = @_;
	    eval q({ *$__alp =  &__SIMPLELOCK_UNLOCKED; });
    }' unless defined(&__cpu_simple_lock_init);
    if(!defined(&__thumb__) || defined(&_ARM_ARCH_T2)) {
# some #ifdef were dropped here -- fill in the blanks
	eval 'sub __cpu_simple_lock {
	    my($__alp) = @_;
    	    eval q({ });
	}' unless defined(&__cpu_simple_lock);
    } else {
    }
    if(!defined(&__thumb__) || defined(&_ARM_ARCH_T2)) {
# some #ifdef were dropped here -- fill in the blanks
	eval 'sub __cpu_simple_lock_try {
	    my($__alp) = @_;
    	    eval q({ });
	}' unless defined(&__cpu_simple_lock_try);
    } else {
    }
# some #ifdef were dropped here -- fill in the blanks
    eval 'sub __cpu_simple_unlock {
        my($__alp) = @_;
	    eval q({ });
    }' unless defined(&__cpu_simple_unlock);
}
1;
