Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/src/atomic.c

    r133461c rc5429fe  
    3838#include <arch/asm.h>
    3939
    40 unsigned __atomic_fetch_add_4(volatile void *mem0, unsigned val, int model)
     40unsigned __atomic_fetch_add_4(volatile unsigned *mem, unsigned val, int model)
    4141{
    42         volatile unsigned *mem = mem0;
    43 
    4442        /*
    4543         * This implementation is for UP pre-ARMv6 systems where we do not have
     
    5351}
    5452
    55 unsigned __atomic_fetch_sub_4(volatile void *mem0, unsigned val, int model)
     53unsigned __atomic_fetch_sub_4(volatile unsigned *mem, unsigned val, int model)
    5654{
    57         volatile unsigned *mem = mem0;
    58 
    5955        ipl_t ipl = interrupts_disable();
    6056        unsigned ret = *mem;
     
    7167 * returns the previous value of \a *ptr.
    7268 */
    73 unsigned __sync_val_compare_and_swap_4(volatile void *ptr0, unsigned expected,
    74     unsigned new_val)
     69void *__sync_val_compare_and_swap_4(void **ptr, void *expected, void *new_val)
    7570{
    76         volatile unsigned *ptr = ptr0;
    77 
    7871        /*
    7972         * Using an interrupt disabling spinlock might still lead to deadlock
     
    8578        irq_spinlock_lock(&cas_lock, true);
    8679
    87         unsigned cur_val = *ptr;
     80        void *cur_val = *ptr;
    8881
    8982        if (cur_val == expected) {
     
    10396/* Naive implementations of the newer intrinsics. */
    10497
    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)
    10799{
    108         unsigned *expected = expected0;
    109 
    110100        (void) weak;
    111101        (void) success;
    112102        (void) failure;
    113103
    114         unsigned old = *expected;
    115         unsigned new = __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);
    116106        if (old == new) {
    117107                return 1;
     
    122112}
    123113
    124 unsigned __atomic_exchange_4(volatile void *mem0, unsigned val, int model)
     114void *__atomic_exchange_4(void **mem, void *val, int model)
    125115{
    126         volatile unsigned *mem = mem0;
    127 
    128116        (void) model;
    129117
    130118        irq_spinlock_lock(&cas_lock, true);
    131         unsigned old = *mem;
     119        void *old = *mem;
    132120        *mem = val;
    133121        irq_spinlock_unlock(&cas_lock, true);
Note: See TracChangeset for help on using the changeset viewer.