require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_MACHINE_ATOMIC_H_)) {
    eval 'sub _MACHINE_ATOMIC_H_ () {1;}' unless defined(&_MACHINE_ATOMIC_H_);
    if(defined(&_KERNEL)) {
	require 'machine/psl.ph';
	eval 'sub atomic_setbits_int {
	    my($uip,$v) = @_;
    	    eval q({ \'int\'  &psr;  &psr =  &getpsr();  &setpsr( &psr |  &PSR_PIL); *$uip |= $v;  &setpsr( &psr); });
	}' unless defined(&atomic_setbits_int);
	eval 'sub atomic_clearbits_int {
	    my($uip,$v) = @_;
    	    eval q({ \'int\'  &psr;  &psr =  &getpsr();  &setpsr( &psr |  &PSR_PIL); *$uip &= ~$v;  &setpsr( &psr); });
	}' unless defined(&atomic_clearbits_int);
    }
}
1;
