FEMU  原版 master 7e238cc
FEMU: Accurate, Scalable and Extensible NVMe SSD Emulator (FAST'18)
rte_atomic_x86.h
浏览该文件的文档.
1 #ifndef RTE_ATOMIC_H
2 #define RTE_ATOMIC_H
3 
10 #define rte_compiler_barrier() do { \
11  asm volatile ("" : : : "memory"); \
12 } while(0)
13 
14 #define MPLOCKED "lock ; "
15 /*------------------------- 32 bit atomic operations -------------------------*/
16 static inline int
17 rte_atomic32_cmpset(volatile uint32_t *dst, uint32_t exp, uint32_t src)
18 {
19  uint8_t res;
20 
21  asm volatile(
22  MPLOCKED
23  "cmpxchgl %[src], %[dst];"
24  "sete %[res];"
25  : [res] "=a" (res), /* output */
26  [dst] "=m" (*dst)
27  : [src] "r" (src), /* input */
28  "a" (exp),
29  "m" (*dst)
30  : "memory"); /* no-clobber list */
31  return res;
32 }
33 
34 #define rte_smp_wmb() rte_compiler_barrier()
35 
36 #define rte_smp_rmb() rte_compiler_barrier()
37 
38 #endif
rte_atomic32_cmpset
static int rte_atomic32_cmpset(volatile uint32_t *dst, uint32_t exp, uint32_t src)
Definition: rte_atomic_x86.h:17
MPLOCKED
#define MPLOCKED
Definition: rte_atomic_x86.h:14