Ignore:
File:
1 edited

Legend:

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

    rc5429fe r133461c  
    3838#include <arch/asm.h>
    3939
    40 unsigned __atomic_fetch_add_4(volatile unsigned *mem, unsigned val, int model)
     40unsigned __atomic_fetch_add_4(volatile void *mem0, unsigned val, int model)
    4141{
     42        volatile unsigned *mem = mem0;
     43
    4244        /*
    4345         * This implementation is for UP pre-ARMv6 systems where we do not have
     
    5153}
    5254
    53 unsigned __atomic_fetch_sub_4(volatile unsigned *mem, unsigned val, int model)
     55unsigned __atomic_fetch_sub_4(volatile void *mem0, unsigned val, int model)
    5456{
     57        volatile unsigned *mem = mem0;
     58
    5559        ipl_t ipl = interrupts_disable();
    5660        unsigned ret = *mem;
     
    6771 * returns the previous value of \a *ptr.
    6872 */
    69 void *__sync_val_compare_and_swap_4(void **ptr, void *expected, void *new_val)
     73unsigned __sync_val_compare_and_swap_4(volatile void *ptr0, unsigned expected,
     74    unsigned new_val)
    7075{
     76        volatile unsigned *ptr = ptr0;
     77
    7178        /*
    7279         * Using an interrupt disabling spinlock might still lead to deadlock
     
    7885        irq_spinlock_lock(&cas_lock, true);
    7986
    80         void *cur_val = *ptr;
     87        unsigned cur_val = *ptr;
    8188
    8289        if (cur_val == expected) {
     
    96103/* Naive implementations of the newer intrinsics. */
    97104
    98 _Bool __atomic_compare_exchange_4(void **mem, void **expected, void *desired, _Bool weak, int success, int failure)
     105_Bool __atomic_compare_exchange_4(volatile void *mem, void *expected0,
     106    unsigned desired, _Bool weak, int success, int failure)
    99107{
     108        unsigned *expected = expected0;
     109
    100110        (void) weak;
    101111        (void) success;
    102112        (void) failure;
    103113
    104         void *old = *expected;
    105         void *new = __sync_val_compare_and_swap_4(mem, old, desired);
     114        unsigned old = *expected;
     115        unsigned new = __sync_val_compare_and_swap_4(mem, old, desired);
    106116        if (old == new) {
    107117                return 1;
     
    112122}
    113123
    114 void *__atomic_exchange_4(void **mem, void *val, int model)
     124unsigned __atomic_exchange_4(volatile void *mem0, unsigned val, int model)
    115125{
     126        volatile unsigned *mem = mem0;
     127
    116128        (void) model;
    117129
    118130        irq_spinlock_lock(&cas_lock, true);
    119         void *old = *mem;
     131        unsigned old = *mem;
    120132        *mem = val;
    121133        irq_spinlock_unlock(&cas_lock, true);
Note: See TracChangeset for help on using the changeset viewer.