Rev 534 | Rev 627 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 534 | Rev 557 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | 51 | ||
52 | static inline atomic_t atomic_inc_pre(atomic_t *val) |
52 | static inline atomic_t atomic_inc_pre(atomic_t *val) |
53 | { |
53 | { |
54 | atomic_t r; |
54 | atomic_t r; |
55 | __asm__ volatile ( |
55 | __asm__ volatile ( |
56 | "movl $1,%0;" |
56 | "movl $1, %0\n" |
57 | "lock xaddl %0,%1;" |
57 | "lock xaddl %0, %1\n" |
58 | : "=r"(r), "=m" (*val) |
58 | : "=r"(r), "=m" (*val) |
59 | ); |
59 | ); |
60 | return r; |
60 | return r; |
61 | } |
61 | } |
62 | 62 | ||
Line 64... | Line 64... | ||
64 | 64 | ||
65 | static inline atomic_t atomic_dec_pre(atomic_t *val) |
65 | static inline atomic_t atomic_dec_pre(atomic_t *val) |
66 | { |
66 | { |
67 | atomic_t r; |
67 | atomic_t r; |
68 | __asm__ volatile ( |
68 | __asm__ volatile ( |
69 | "movl $-1,%0;" |
69 | "movl $-1, %0\n" |
70 | "lock xaddl %0,%1;" |
70 | "lock xaddl %0, %1\n" |
71 | : "=r"(r), "=m" (*val) |
71 | : "=r"(r), "=m" (*val) |
72 | ); |
72 | ); |
73 | return r; |
73 | return r; |
74 | } |
74 | } |
75 | 75 | ||
76 | #define atomic_inc_post(val) (atomic_inc_pre(val)+1) |
76 | #define atomic_inc_post(val) (atomic_inc_pre(val)+1) |
77 | #define atomic_dec_post(val) (atomic_dec_pre(val)-1) |
77 | #define atomic_dec_post(val) (atomic_dec_pre(val)-1) |
78 | 78 | ||
79 | - | ||
80 | - | ||
81 | static inline int test_and_set(volatile int *val) { |
79 | static inline int test_and_set(volatile int *val) { |
82 | int v; |
80 | int v; |
83 | 81 | ||
84 | __asm__ volatile ( |
82 | __asm__ volatile ( |
85 | "movl $1, %0\n" |
83 | "movl $1, %0\n" |