Changeset 925a21e in mainline for uspace/lib/c/arch/ia32/include/atomic.h
- Timestamp:
- 2011-09-24T14:20:29Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5bf76c1
- Parents:
- 867e2555 (diff), 1ab4aca (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/ia32/include/atomic.h
r867e2555 r925a21e 42 42 static inline void atomic_inc(atomic_t *val) 43 43 { 44 #ifdef __PCC__ 45 asm volatile ( 46 "lock incl %0\n" 47 : "+m" (val->count) 48 ); 49 #else 44 50 asm volatile ( 45 51 "lock incl %[count]\n" 46 52 : [count] "+m" (val->count) 47 53 ); 54 #endif 48 55 } 49 56 50 57 static inline void atomic_dec(atomic_t *val) 51 58 { 59 #ifdef __PCC__ 60 asm volatile ( 61 "lock decl %0\n" 62 : "+m" (val->count) 63 ); 64 #else 52 65 asm volatile ( 53 66 "lock decl %[count]\n" 54 67 : [count] "+m" (val->count) 55 68 ); 69 #endif 56 70 } 57 71 … … 60 74 atomic_count_t r = 1; 61 75 76 #ifdef __PCC__ 77 asm volatile ( 78 "lock xaddl %1, %0\n" 79 : "+m" (val->count), 80 "+r" (r) 81 ); 82 #else 62 83 asm volatile ( 63 84 "lock xaddl %[r], %[count]\n" … … 65 86 [r] "+r" (r) 66 87 ); 88 #endif 67 89 68 90 return r; … … 73 95 atomic_count_t r = -1; 74 96 97 #ifdef __PCC__ 98 asm volatile ( 99 "lock xaddl %1, %0\n" 100 : "+m" (val->count), 101 "+r" (r) 102 ); 103 #else 75 104 asm volatile ( 76 105 "lock xaddl %[r], %[count]\n" … … 78 107 [r] "+r" (r) 79 108 ); 109 #endif 80 110 81 111 return r;
Note:
See TracChangeset
for help on using the changeset viewer.