Changes in kernel/arch/arm32/src/atomic.c [133461c:c5429fe] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/atomic.c
r133461c rc5429fe 38 38 #include <arch/asm.h> 39 39 40 unsigned __atomic_fetch_add_4(volatile void *mem0, unsigned val, int model)40 unsigned __atomic_fetch_add_4(volatile unsigned *mem, unsigned val, int model) 41 41 { 42 volatile unsigned *mem = mem0;43 44 42 /* 45 43 * This implementation is for UP pre-ARMv6 systems where we do not have … … 53 51 } 54 52 55 unsigned __atomic_fetch_sub_4(volatile void *mem0, unsigned val, int model)53 unsigned __atomic_fetch_sub_4(volatile unsigned *mem, unsigned val, int model) 56 54 { 57 volatile unsigned *mem = mem0;58 59 55 ipl_t ipl = interrupts_disable(); 60 56 unsigned ret = *mem; … … 71 67 * returns the previous value of \a *ptr. 72 68 */ 73 unsigned __sync_val_compare_and_swap_4(volatile void *ptr0, unsigned expected, 74 unsigned new_val) 69 void *__sync_val_compare_and_swap_4(void **ptr, void *expected, void *new_val) 75 70 { 76 volatile unsigned *ptr = ptr0;77 78 71 /* 79 72 * Using an interrupt disabling spinlock might still lead to deadlock … … 85 78 irq_spinlock_lock(&cas_lock, true); 86 79 87 unsignedcur_val = *ptr;80 void *cur_val = *ptr; 88 81 89 82 if (cur_val == expected) { … … 103 96 /* Naive implementations of the newer intrinsics. */ 104 97 105 _Bool __atomic_compare_exchange_4(volatile void *mem, void *expected0, 106 unsigned desired, _Bool weak, int success, int failure) 98 _Bool __atomic_compare_exchange_4(void **mem, void **expected, void *desired, _Bool weak, int success, int failure) 107 99 { 108 unsigned *expected = expected0;109 110 100 (void) weak; 111 101 (void) success; 112 102 (void) failure; 113 103 114 unsignedold = *expected;115 unsignednew = __sync_val_compare_and_swap_4(mem, old, desired);104 void *old = *expected; 105 void *new = __sync_val_compare_and_swap_4(mem, old, desired); 116 106 if (old == new) { 117 107 return 1; … … 122 112 } 123 113 124 unsigned __atomic_exchange_4(volatile void *mem0, unsignedval, int model)114 void *__atomic_exchange_4(void **mem, void *val, int model) 125 115 { 126 volatile unsigned *mem = mem0;127 128 116 (void) model; 129 117 130 118 irq_spinlock_lock(&cas_lock, true); 131 unsignedold = *mem;119 void *old = *mem; 132 120 *mem = val; 133 121 irq_spinlock_unlock(&cas_lock, true);
Note:
See TracChangeset
for help on using the changeset viewer.