Rev 1107 | Rev 1964 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1107 | Rev 1267 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | 31 | ||
32 | static inline void atomic_inc(atomic_t *val) |
32 | static inline void atomic_inc(atomic_t *val) |
33 | { |
33 | { |
34 | long tmp; |
34 | long tmp; |
35 | 35 | ||
36 | asm __volatile__ ( |
36 | asm volatile ( |
37 | "1:\n" |
37 | "1:\n" |
38 | "lwarx %0, 0, %2\n" |
38 | "lwarx %0, 0, %2\n" |
39 | "addic %0, %0, 1\n" |
39 | "addic %0, %0, 1\n" |
40 | "stwcx. %0, 0, %2\n" |
40 | "stwcx. %0, 0, %2\n" |
41 | "bne- 1b" |
41 | "bne- 1b" |
42 | : "=&r" (tmp), "=m" (val->count) |
42 | : "=&r" (tmp), "=m" (val->count) |
43 | : "r" (&val->count), "m" (val->count) |
43 | : "r" (&val->count), "m" (val->count) |
44 | : "cc"); |
44 | : "cc" |
- | 45 | ); |
|
45 | } |
46 | } |
46 | 47 | ||
47 | static inline void atomic_dec(atomic_t *val) |
48 | static inline void atomic_dec(atomic_t *val) |
48 | { |
49 | { |
49 | long tmp; |
50 | long tmp; |
50 | 51 | ||
51 | asm __volatile__( |
52 | asm volatile ( |
52 | "1:\n" |
53 | "1:\n" |
53 | "lwarx %0, 0, %2\n" |
54 | "lwarx %0, 0, %2\n" |
54 | "addic %0, %0, -1\n" |
55 | "addic %0, %0, -1\n" |
55 | "stwcx. %0, 0, %2\n" |
56 | "stwcx. %0, 0, %2\n" |
56 | "bne- 1b" |
57 | "bne- 1b" |
57 | : "=&r" (tmp), "=m" (val->count) |
58 | : "=&r" (tmp), "=m" (val->count) |
58 | : "r" (&val->count), "m" (val->count) |
59 | : "r" (&val->count), "m" (val->count) |
59 | : "cc"); |
60 | : "cc" |
- | 61 | ); |
|
60 | } |
62 | } |
61 | 63 | ||
62 | static inline long atomic_postinc(atomic_t *val) |
64 | static inline long atomic_postinc(atomic_t *val) |
63 | { |
65 | { |
64 | atomic_inc(val); |
66 | atomic_inc(val); |