Changeset 23684b7 in mainline for arch/amd64/include/atomic.h
- Timestamp:
- 2006-03-22T17:21:15Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d71007e
- Parents:
- 45fb65c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/include/atomic.h
r45fb65c r23684b7 33 33 #include <arch/barrier.h> 34 34 #include <preemption.h> 35 36 typedef struct { volatile __u64 count; } atomic_t; 37 38 static inline void atomic_set(atomic_t *val, __u64 i) 39 { 40 val->count = i; 41 } 42 43 static inline __u64 atomic_get(atomic_t *val) 44 { 45 return val->count; 46 } 35 #include <typedefs.h> 47 36 48 37 static inline void atomic_inc(atomic_t *val) { … … 62 51 } 63 52 64 static inline count_tatomic_postinc(atomic_t *val)53 static inline long atomic_postinc(atomic_t *val) 65 54 { 66 count_tr;55 long r; 67 56 68 57 __asm__ volatile ( … … 75 64 } 76 65 77 static inline count_tatomic_postdec(atomic_t *val)66 static inline long atomic_postdec(atomic_t *val) 78 67 { 79 count_tr;68 long r; 80 69 81 70 __asm__ volatile ( … … 104 93 105 94 106 /** AMD64 specific fast spinlock */95 /** amd64 specific fast spinlock */ 107 96 static inline void atomic_lock_arch(atomic_t *val) 108 97 { … … 117 106 "mov %0, %1;" 118 107 "testq %1, %1;" 119 "jnz 0b;" /* L eightweight looping on locked spinlock */108 "jnz 0b;" /* Lightweight looping on locked spinlock */ 120 109 121 110 "incq %1;" /* now use the atomic operation */
Note:
See TracChangeset
for help on using the changeset viewer.