Back to index

glibc  2.9
Defines
atomic.h File Reference

Go to the source code of this file.

Defines

#define MUTEX_HINT_ACQ
#define MUTEX_HINT_REL
#define __arch_compare_and_exchange_bool_32_acq(mem, newval, oldval)
#define __arch_compare_and_exchange_bool_32_rel(mem, newval, oldval)
#define __arch_compare_and_exchange_bool_64_acq(mem, newval, oldval)
#define __arch_compare_and_exchange_bool_64_rel(mem, newval, oldval)
#define __arch_compare_and_exchange_val_64_acq(mem, newval, oldval)
#define __arch_compare_and_exchange_val_64_rel(mem, newval, oldval)
#define __arch_atomic_exchange_64_acq(mem, value)
#define __arch_atomic_exchange_64_rel(mem, value)
#define __arch_atomic_exchange_and_add_64(mem, value)
#define __arch_atomic_increment_val_64(mem)
#define __arch_atomic_decrement_val_64(mem)
#define __arch_atomic_decrement_if_positive_64(mem)
#define atomic_read_barrier()   __asm ("lwsync" ::: "memory")
#define __ARCH_REL_INSTR   "lwsync"

Define Documentation

Value:
({ int __val, __tmp;                                                 \
     __asm __volatile ("1:  ldarx  %0,0,%3\n"                        \
                     "      cmpdi  0,%0,0\n"                         \
                     "      addi   %1,%0,-1\n"                       \
                     "      ble    2f\n"                             \
                     "      stdcx. %1,0,%3\n"                        \
                     "      bne-   1b\n"                             \
                     "2:    " __ARCH_ACQ_INSTR                       \
                     : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)            \
                     : "b" (mem), "m" (*mem)                                \
                     : "cr0", "memory");                             \
     __val;                                                          \
  })

Definition at line 213 of file atomic.h.

Value:
({                                                                   \
      __typeof (*(mem)) __val;                                              \
      __asm __volatile ("1: ldarx  %0,0,%2\n"                        \
                     "      subi   %0,%0,1\n"                        \
                     "      stdcx. %0,0,%2\n"                        \
                     "      bne-   1b"                               \
                     : "=&b" (__val), "=m" (*mem)                           \
                     : "b" (mem), "m" (*mem)                                \
                     : "cr0", "memory");                             \
      __val;                                                         \
    })

Definition at line 200 of file atomic.h.

#define __arch_atomic_exchange_64_acq (   mem,
  value 
)
Value:
({                                                                   \
      __typeof (*mem) __val;                                                \
      __asm __volatile (__ARCH_REL_INSTR "\n"                               \
                     "1:    ldarx  %0,0,%2" MUTEX_HINT_ACQ "\n"             \
                     "      stdcx. %3,0,%2\n"                        \
                     "      bne-   1b\n"                             \
                " " __ARCH_ACQ_INSTR                                        \
                     : "=&r" (__val), "=m" (*mem)                           \
                     : "b" (mem), "r" (value), "m" (*mem)                   \
                     : "cr0", "memory");                             \
      __val;                                                         \
    })

Definition at line 147 of file atomic.h.

#define __arch_atomic_exchange_64_rel (   mem,
  value 
)
Value:
({                                                                   \
      __typeof (*mem) __val;                                                \
      __asm __volatile (__ARCH_REL_INSTR "\n"                               \
                     "1:    ldarx  %0,0,%2" MUTEX_HINT_REL "\n"             \
                     "      stdcx. %3,0,%2\n"                        \
                     "      bne-   1b"                               \
                     : "=&r" (__val), "=m" (*mem)                           \
                     : "b" (mem), "r" (value), "m" (*mem)                   \
                     : "cr0", "memory");                             \
      __val;                                                         \
    })

Definition at line 161 of file atomic.h.

Value:
({                                                                   \
      __typeof (*mem) __val, __tmp;                                         \
      __asm __volatile ("1: ldarx  %0,0,%3\n"                        \
                     "      add    %1,%0,%4\n"                       \
                     "      stdcx. %1,0,%3\n"                        \
                     "      bne-   1b"                               \
                     : "=&b" (__val), "=&r" (__tmp), "=m" (*mem)            \
                     : "b" (mem), "r" (value), "m" (*mem)                   \
                     : "cr0", "memory");                             \
      __val;                                                         \
    })

Definition at line 174 of file atomic.h.

Value:
({                                                                   \
      __typeof (*(mem)) __val;                                              \
      __asm __volatile ("1: ldarx  %0,0,%2\n"                        \
                     "      addi   %0,%0,1\n"                        \
                     "      stdcx. %0,0,%2\n"                        \
                     "      bne-   1b"                               \
                     : "=&b" (__val), "=m" (*mem)                           \
                     : "b" (mem), "m" (*mem)                                \
                     : "cr0", "memory");                             \
      __val;                                                         \
    })

Definition at line 187 of file atomic.h.

#define __arch_compare_and_exchange_bool_32_acq (   mem,
  newval,
  oldval 
)
Value:
({                                                                   \
  unsigned int __tmp, __tmp2;                                               \
  __asm __volatile ("   clrldi  %1,%1,32\n"                                 \
                  "1:       lwarx  %0,0,%2" MUTEX_HINT_ACQ "\n"                    \
                  "  subf.  %0,%1,%0\n"                              \
                  "  bne    2f\n"                                    \
                  "  stwcx. %4,0,%2\n"                               \
                  "  bne-   1b\n"                                    \
                  "2:       " __ARCH_ACQ_INSTR                              \
                  : "=&r" (__tmp), "=r" (__tmp2)                     \
                  : "b" (mem), "1" (oldval), "r" (newval)                   \
                  : "cr0", "memory");                                       \
  __tmp != 0;                                                        \
})

Definition at line 43 of file atomic.h.

#define __arch_compare_and_exchange_bool_32_rel (   mem,
  newval,
  oldval 
)
Value:
({                                                                   \
  unsigned int __tmp, __tmp2;                                               \
  __asm __volatile (__ARCH_REL_INSTR "\n"                            \
                  "   clrldi  %1,%1,32\n"                            \
                  "1:       lwarx  %0,0,%2" MUTEX_HINT_REL "\n"                    \
                  "  subf.  %0,%1,%0\n"                              \
                  "  bne    2f\n"                                    \
                  "  stwcx. %4,0,%2\n"                               \
                  "  bne-   1b\n"                                    \
                  "2:       "                                               \
                  : "=&r" (__tmp), "=r" (__tmp2)                     \
                  : "b" (mem), "1" (oldval), "r" (newval)                   \
                  : "cr0", "memory");                                       \
  __tmp != 0;                                                        \
})

Definition at line 59 of file atomic.h.

#define __arch_compare_and_exchange_bool_64_acq (   mem,
  newval,
  oldval 
)
Value:
({                                                                   \
  unsigned long      __tmp;                                                 \
  __asm __volatile (                                                 \
                  "1:       ldarx  %0,0,%1" MUTEX_HINT_ACQ "\n"                    \
                  "  subf.  %0,%2,%0\n"                              \
                  "  bne    2f\n"                                    \
                  "  stdcx. %3,0,%1\n"                               \
                  "  bne-   1b\n"                                    \
                  "2:       " __ARCH_ACQ_INSTR                              \
                  : "=&r" (__tmp)                                    \
                  : "b" (mem), "r" (oldval), "r" (newval)                   \
                  : "cr0", "memory");                                       \
  __tmp != 0;                                                        \
})

Definition at line 81 of file atomic.h.

#define __arch_compare_and_exchange_bool_64_rel (   mem,
  newval,
  oldval 
)
Value:
({                                                                   \
  unsigned long      __tmp;                                                 \
  __asm __volatile (__ARCH_REL_INSTR "\n"                            \
                  "1:       ldarx  %0,0,%2" MUTEX_HINT_REL "\n"                    \
                  "  subf.  %0,%2,%0\n"                              \
                  "  bne    2f\n"                                    \
                  "  stdcx. %3,0,%1\n"                               \
                  "  bne-   1b\n"                                    \
                  "2:       "                                               \
                  : "=&r" (__tmp)                                    \
                  : "b" (mem), "r" (oldval), "r" (newval)                   \
                  : "cr0", "memory");                                       \
  __tmp != 0;                                                        \
})

Definition at line 97 of file atomic.h.

#define __arch_compare_and_exchange_val_64_acq (   mem,
  newval,
  oldval 
)
Value:
({                                                                   \
      __typeof (*(mem)) __tmp;                                              \
      __typeof (mem)  __memp = (mem);                                       \
      __asm __volatile (                                             \
                      "1:   ldarx  %0,0,%1" MUTEX_HINT_ACQ "\n"             \
                      "     cmpd   %0,%2\n"                          \
                      "     bne    2f\n"                             \
                      "     stdcx. %3,0,%1\n"                        \
                      "     bne-   1b\n"                             \
                      "2:   " __ARCH_ACQ_INSTR                       \
                      : "=&r" (__tmp)                                       \
                      : "b" (__memp), "r" (oldval), "r" (newval)            \
                      : "cr0", "memory");                            \
      __tmp;                                                         \
  })

Definition at line 113 of file atomic.h.

#define __arch_compare_and_exchange_val_64_rel (   mem,
  newval,
  oldval 
)
Value:
({                                                                   \
      __typeof (*(mem)) __tmp;                                              \
      __typeof (mem)  __memp = (mem);                                       \
      __asm __volatile (__ARCH_REL_INSTR "\n"                               \
                      "1:   ldarx  %0,0,%1" MUTEX_HINT_REL "\n"             \
                      "     cmpd   %0,%2\n"                          \
                      "     bne    2f\n"                             \
                      "     stdcx. %3,0,%1\n"                        \
                      "     bne-   1b\n"                             \
                      "2:   "                                        \
                      : "=&r" (__tmp)                                       \
                      : "b" (__memp), "r" (oldval), "r" (newval)            \
                      : "cr0", "memory");                            \
      __tmp;                                                         \
  })

Definition at line 130 of file atomic.h.

#define __ARCH_REL_INSTR   "lwsync"

Definition at line 236 of file atomic.h.

#define atomic_read_barrier ( )    __asm ("lwsync" ::: "memory")

Definition at line 231 of file atomic.h.

#define MUTEX_HINT_ACQ

Definition at line 33 of file atomic.h.

#define MUTEX_HINT_REL

Definition at line 34 of file atomic.h.