1 #ifndef _ASM_X86_XEN_PERCPU_H
2 #define _ASM_X86_XEN_PERCPU_H
4 #include_next <asm/percpu.h>
6 #define this_vcpu_read_1 this_cpu_read_1
7 #define this_vcpu_read_2 this_cpu_read_2
8 #define this_vcpu_read_4 this_cpu_read_4
11 # define this_vcpu_read_8 this_cpu_read_8
13 # define this_vcpu_read_8(pcp) ({ \
15 __asm__ ("movl %%ebx,%%eax\n" \
16 "movl %%ecx,%%edx\n" \
17 "cmpxchg8b " __percpu_arg(1) \
18 : "=&A" (res__) : "m" (pcp)); \
22 #define this_vcpu_read(pcp) __pcpu_size_call_return(this_vcpu_read_, pcp)
24 #define percpu_exchange_op(op, var, val) \
26 typedef typeof(var) pxo_T__; \
32 switch (sizeof(var)) { \
34 asm(op "b %0,"__percpu_arg(1) \
35 : "=q" (pxo_ret__), "+m" (var) \
36 : "0" ((pxo_T__)(val))); \
39 asm(op "w %0,"__percpu_arg(1) \
40 : "=r" (pxo_ret__), "+m" (var) \
41 : "0" ((pxo_T__)(val))); \
44 asm(op "l %0,"__percpu_arg(1) \
45 : "=r" (pxo_ret__), "+m" (var) \
46 : "0" ((pxo_T__)(val))); \
49 asm(op "q %0,"__percpu_arg(1) \
50 : "=r" (pxo_ret__), "+m" (var) \
51 : "0" ((pxo_T__)(val))); \
53 default: __bad_percpu_size(); \
58 #define percpu_xchg(var, val) percpu_exchange_op("xchg", var, val)
59 #define percpu_xadd(var, val) percpu_exchange_op("xadd", var, val)
61 #endif /* _ASM_X86_XEN_PERCPU_H */