Ignore:
Timestamp:
2010-02-20T20:54:53Z (14 years ago)
Author:
Pavel Rimsky <pavel@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
721d4e85, 95c4776
Parents:
f516bc2 (diff), b03a666 (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:

Synchronize with head.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/libc/arch/arm32/include/atomic.h

    rf516bc2 rc2efbb4  
    2727 */
    2828
    29 /** @addtogroup libcarm32       
     29/** @addtogroup libcarm32
    3030 * @{
    3131 */
     
    3838
    3939#define LIBC_ARCH_ATOMIC_H_
    40 #define CAS 
     40#define CAS
    4141
    4242#include <atomicdflt.h>
     
    4646extern uintptr_t *ras_page;
    4747
    48 static inline bool cas(atomic_t *val, long ov, long nv)
    49 {
    50         long ret = 0;
    51 
     48static inline bool cas(atomic_t *val, atomic_count_t ov, atomic_count_t nv)
     49{
     50        atomic_count_t ret = 0;
     51       
    5252        /*
    5353         * The following instructions between labels 1 and 2 constitute a
     
    7575                : "memory"
    7676        );
    77 
     77       
    7878        ras_page[0] = 0;
    79         asm volatile ("" ::: "memory");
     79        asm volatile (
     80                "" ::: "memory"
     81        );
    8082        ras_page[1] = 0xffffffff;
    81 
     83       
    8284        return (bool) ret;
    8385}
     
    8991 *
    9092 * @return Value after addition.
    91  */
    92 static inline long atomic_add(atomic_t *val, int i)
    93 {
    94         long ret = 0;
    95 
     93 *
     94 */
     95static inline atomic_count_t atomic_add(atomic_t *val, atomic_count_t i)
     96{
     97        atomic_count_t ret = 0;
     98       
    9699        /*
    97100         * The following instructions between labels 1 and 2 constitute a
     
    115118                : [imm] "r" (i)
    116119        );
    117 
     120       
    118121        ras_page[0] = 0;
    119         asm volatile ("" ::: "memory");
     122        asm volatile (
     123                "" ::: "memory"
     124        );
    120125        ras_page[1] = 0xffffffff;
    121 
     126       
    122127        return ret;
    123128}
     
    127132 *
    128133 * @param val Variable to be incremented.
     134 *
    129135 */
    130136static inline void atomic_inc(atomic_t *val)
     
    137143 *
    138144 * @param val Variable to be decremented.
     145 *
    139146 */
    140147static inline void atomic_dec(atomic_t *val)
     
    148155 * @param val Variable to be incremented.
    149156 * @return    Value after incrementation.
    150  */
    151 static inline long atomic_preinc(atomic_t *val)
     157 *
     158 */
     159static inline atomic_count_t atomic_preinc(atomic_t *val)
    152160{
    153161        return atomic_add(val, 1);
     
    159167 * @param val Variable to be decremented.
    160168 * @return    Value after decrementation.
    161  */
    162 static inline long atomic_predec(atomic_t *val)
     169 *
     170 */
     171static inline atomic_count_t atomic_predec(atomic_t *val)
    163172{
    164173        return atomic_add(val, -1);
     
    170179 * @param val Variable to be incremented.
    171180 * @return    Value before incrementation.
    172  */
    173 static inline long atomic_postinc(atomic_t *val)
     181 *
     182 */
     183static inline atomic_count_t atomic_postinc(atomic_t *val)
    174184{
    175185        return atomic_add(val, 1) - 1;
     
    181191 * @param val Variable to be decremented.
    182192 * @return    Value before decrementation.
    183  */
    184 static inline long atomic_postdec(atomic_t *val)
     193 *
     194 */
     195static inline atomic_count_t atomic_postdec(atomic_t *val)
    185196{
    186197        return atomic_add(val, -1) + 1;
Note: See TracChangeset for help on using the changeset viewer.