Rizin
unix-like reverse engineering framework and cli tools
atomic-ops.h File Reference
#include "internal.h"

Go to the source code of this file.

Functions

 UV_UNUSED (static int cmpxchgi(int *ptr, int oldval, int newval))
 
 UV_UNUSED (static void cpu_relax(void))
 

Function Documentation

◆ UV_UNUSED() [1/2]

UV_UNUSED ( static int   cmpxchgiint *ptr, int oldval, int newval)

Definition at line 31 of file atomic-ops.h.

31  {
32 #if defined(__i386__) || defined(__x86_64__)
33  int out;
34  __asm__ __volatile__ ("lock; cmpxchg %2, %1;"
35  : "=a" (out), "+m" (*(volatile int*) ptr)
36  : "r" (newval), "0" (oldval)
37  : "memory");
38  return out;
39 #elif defined(__MVS__)
40  unsigned int op4;
41  if (__plo_CSST(ptr, (unsigned int*) &oldval, newval,
42  (unsigned int*) ptr, *ptr, &op4))
43  return oldval;
44  else
45  return op4;
46 #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
47  return atomic_cas_uint((uint_t *)ptr, (uint_t)oldval, (uint_t)newval);
48 #else
49  return __sync_val_compare_and_swap(ptr, oldval, newval);
50 #endif
51 }
const lzma_allocator const uint8_t size_t uint8_t * out
Definition: block.h:528

References out.

◆ UV_UNUSED() [2/2]

UV_UNUSED ( static void   cpu_relaxvoid)

Definition at line 53 of file atomic-ops.h.

53  {
54 #if defined(__i386__) || defined(__x86_64__)
55  __asm__ __volatile__ ("rep; nop"); /* a.k.a. PAUSE */
56 #elif (defined(__arm__) && __ARM_ARCH >= 7) || defined(__aarch64__)
57  __asm__ volatile("yield");
58 #endif
59 }