require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_POWERPC_ATOMIC_H_)) {
    eval 'sub _POWERPC_ATOMIC_H_ () {1;}' unless defined(&_POWERPC_ATOMIC_H_);
    if(defined(&_KERNEL)) {
	eval 'sub atomic_setbits_int {
	    my($uip,$v) = @_;
    	    eval q({ my $tmp;  &__asm  &volatile ( \\"1:	lwarx	%0, 0, %2	\\\\n\\" \\"	or	%0, %1, %0	\\\\n\\" \\"	stwcx.	%0, 0, %2	\\\\n\\" \\"	bne-	1b		\\\\n\\" \\"	sync\\" : \\"=&r\\" ( $tmp) : \\"r\\" ($v), \\"r\\" ($uip) : \\"memory\\"); });
	}' unless defined(&atomic_setbits_int);
	eval 'sub atomic_clearbits_int {
	    my($uip,$v) = @_;
    	    eval q({ my $tmp;  &__asm  &volatile ( \\"1:	lwarx	%0, 0, %2	\\\\n\\" \\"	andc	%0, %0, %1	\\\\n\\" \\"	stwcx.	%0, 0, %2	\\\\n\\" \\"	bne-	1b		\\\\n\\" \\"	sync\\" : \\"=&r\\" ( $tmp) : \\"r\\" ($v), \\"r\\" ($uip) : \\"memory\\"); });
	}' unless defined(&atomic_clearbits_int);
    }
}
1;
