Ignore:
Timestamp:
2011-03-21T22:00:17Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e3
Parents:
b50b5af2 (diff), 7308e84 (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.
Message:

Merge mainline changes (needs fixes).

File:
1 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/mips32/include/atomic.h

    rb50b5af2 r04803bf  
    2727 */
    2828
    29 /** @addtogroup libcmips32     
     29/** @addtogroup libcmips32
    3030 * @{
    3131 */
    3232/** @file
    33  * @ingroup libcmips32eb       
     33 * @ingroup libcmips32eb
    3434 */
    3535
     
    3737#define LIBC_mips32_ATOMIC_H_
    3838
    39 #define atomic_inc(x)   ((void) atomic_add(x, 1))
    40 #define atomic_dec(x)   ((void) atomic_add(x, -1))
     39#define LIBC_ARCH_ATOMIC_H_
    4140
    42 #define atomic_postinc(x) (atomic_add(x, 1) - 1)
    43 #define atomic_postdec(x) (atomic_add(x, -1) + 1)
     41#include <atomicdflt.h>
    4442
    45 #define atomic_preinc(x) atomic_add(x, 1)
    46 #define atomic_predec(x) atomic_add(x, -1)
     43#define atomic_inc(x)  ((void) atomic_add(x, 1))
     44#define atomic_dec(x)  ((void) atomic_add(x, -1))
     45
     46#define atomic_postinc(x)  (atomic_add(x, 1) - 1)
     47#define atomic_postdec(x)  (atomic_add(x, -1) + 1)
     48
     49#define atomic_preinc(x)  atomic_add(x, 1)
     50#define atomic_predec(x)  atomic_add(x, -1)
    4751
    4852/* Atomic addition of immediate value.
    4953 *
    5054 * @param val Memory location to which will be the immediate value added.
    51  * @param i Signed immediate that will be added to *val.
     55 * @param i   Signed immediate that will be added to *val.
    5256 *
    5357 * @return Value after addition.
     58 *
    5459 */
    55 static inline long atomic_add(atomic_t *val, int i)
     60static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i)
    5661{
    57         long tmp, v;
    58 
     62        atomic_count_t tmp;
     63        atomic_count_t v;
     64       
    5965        asm volatile (
    6066                "1:\n"
     
    6672                /*      nop     */              /* nop is inserted automatically by compiler */
    6773                "       nop\n"
    68                 : "=&r" (tmp), "+m" (val->count), "=&r" (v)
    69                 : "r" (i), "i" (0)
    70                 );
    71 
     74                : "=&r" (tmp),
     75                  "+m" (val->count),
     76                  "=&r" (v)
     77                : "r" (i),
     78                  "i" (0)
     79        );
     80       
    7281        return v;
    7382}
Note: See TracChangeset for help on using the changeset viewer.