| * Copyright (C) Igor Sysoev |
| * Copyright (C) Nginx, Inc. |
| #define NGX_SMP_LOCK "lock;" |
| * The "r" is any register, %rax (%r0) - %r16. |
| * The "=a" and "a" are the %rax register. |
| * Although we can return result in any register, we use "a" because it is |
| * used in cmpxchgq anyway. The result is actually in %al but not in $rax, |
| * however as the code is inlined gcc can test %al as well as %rax. |
| * The "cc" means that flags were changed. |
| static ngx_inline ngx_atomic_uint_t |
| ngx_atomic_cmp_set(ngx_atomic_t *lock, ngx_atomic_uint_t old, |
| : "=a" (res) : "m" (*lock), "a" (old), "r" (set) : "cc", "memory"); |
| * The "+r" is any register, %rax (%r0) - %r16. |
| * The "cc" means that flags were changed. |
| static ngx_inline ngx_atomic_int_t |
| ngx_atomic_fetch_add(ngx_atomic_t *value, ngx_atomic_int_t add) |
| : "+r" (add) : "m" (*value) : "cc", "memory"); |
| #define ngx_memory_barrier() __asm__ volatile ("" ::: "memory") |
| #define ngx_cpu_pause() __asm__ ("pause") |