Changes in uspace/lib/c/arch/amd64/include/atomic.h [63f8966:c8f70eb] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/amd64/include/atomic.h
r63f8966 rc8f70eb 44 44 static inline void atomic_inc(atomic_t *val) 45 45 { 46 #ifdef __PCC__ 47 asm volatile ( 48 "lock incq %0\n" 49 : "+m" (val->count) 50 ); 51 #else 46 52 asm volatile ( 47 53 "lock incq %[count]\n" 48 54 : [count] "+m" (val->count) 49 55 ); 56 #endif 50 57 } 51 58 52 59 static inline void atomic_dec(atomic_t *val) 53 60 { 61 #ifdef __PCC__ 62 asm volatile ( 63 "lock decq %0\n" 64 : "+m" (val->count) 65 ); 66 #else 54 67 asm volatile ( 55 68 "lock decq %[count]\n" 56 69 : [count] "+m" (val->count) 57 70 ); 71 #endif 58 72 } 59 73 … … 62 76 atomic_count_t r = 1; 63 77 78 #ifdef __PCC__ 79 asm volatile ( 80 "lock xaddq %1, %0\n" 81 : "+m" (val->count), 82 "+r" (r) 83 ); 84 #else 64 85 asm volatile ( 65 86 "lock xaddq %[r], %[count]\n" … … 67 88 [r] "+r" (r) 68 89 ); 90 #endif 69 91 70 92 return r; … … 75 97 atomic_count_t r = -1; 76 98 99 #ifdef __PCC__ 100 asm volatile ( 101 "lock xaddq %1, %0\n" 102 : "+m" (val->count), 103 "+r" (r) 104 ); 105 #else 77 106 asm volatile ( 78 107 "lock xaddq %[r], %[count]\n" … … 80 109 [r] "+r" (r) 81 110 ); 111 #endif 82 112 83 113 return r;
Note:
See TracChangeset
for help on using the changeset viewer.