#include <pthread.h>
#include <signal.h>
#include <assert.h>
-#include <urcu/uatomic_arch.h>
+#include <urcu/uatomic.h>
/*
* It does not really matter if the constructor is called before using
* generate an illegal instruction. Cannot catch this with
* linker tricks when optimizations are disabled.
*/
+ result = 0;
__asm__ __volatile__("ud2");
}
mutex_lock_signal_restore(&compat_mutex, &mask);
- return _new;
+ return result;
}
unsigned long _compat_uatomic_xchg(void *addr, unsigned long _new, int len)
* generate an illegal instruction. Cannot catch this with
* linker tricks when optimizations are disabled.
*/
+ retval = 0; /* silence gcc warnings */
__asm__ __volatile__("ud2");
}
mutex_lock_signal_restore(&compat_mutex, &mask);
* generate an illegal instruction. Cannot catch this with
* linker tricks when optimizations are disabled.
*/
+ retval = 0; /* silence gcc warnings */
__asm__ __volatile__("ud2");
}
mutex_lock_signal_restore(&compat_mutex, &mask);
return retval;
}
+void _compat_uatomic_or(void *addr, unsigned long v, int len)
+{
+ sigset_t mask;
+
+ mutex_lock_signal_save(&compat_mutex, &mask);
+ switch (len) {
+ case 1:
+ *(unsigned char *)addr |= (unsigned char)v;
+ break;
+ case 2:
+ *(unsigned short *)addr |= (unsigned short)v;
+ break;
+ case 4:
+ *(unsigned int *)addr |= (unsigned int)v;
+ break;
+ default:
+ /*
+ * generate an illegal instruction. Cannot catch this with
+ * linker tricks when optimizations are disabled.
+ */
+ __asm__ __volatile__("ud2");
+ }
+ mutex_lock_signal_restore(&compat_mutex, &mask);
+}
+
+void _compat_uatomic_and(void *addr, unsigned long v, int len)
+{
+ sigset_t mask;
+
+ mutex_lock_signal_save(&compat_mutex, &mask);
+ switch (len) {
+ case 1:
+ *(unsigned char *)addr &= (unsigned char)v;
+ break;
+ case 2:
+ *(unsigned short *)addr &= (unsigned short)v;
+ break;
+ case 4:
+ *(unsigned int *)addr &= (unsigned int)v;
+ break;
+ default:
+ /*
+ * generate an illegal instruction. Cannot catch this with
+ * linker tricks when optimizations are disabled.
+ */
+ __asm__ __volatile__("ud2");
+ }
+ mutex_lock_signal_restore(&compat_mutex, &mask);
+}
+
unsigned long _compat_uatomic_add_return(void *addr, unsigned long v, int len)
{
sigset_t mask;
* generate an illegal instruction. Cannot catch this with
* linker tricks when optimizations are disabled.
*/
+ result = 0; /* silence gcc warnings */
__asm__ __volatile__("ud2");
}
mutex_lock_signal_restore(&compat_mutex, &mask);