Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/mips32/include/atomic.h

    r88d653c r7a0359b  
    2727 */
    2828
    29 /** @addtogroup mips32 
     29/** @addtogroup mips32
    3030 * @{
    3131 */
     
    3535#ifndef KERN_mips32_ATOMIC_H_
    3636#define KERN_mips32_ATOMIC_H_
     37
     38#include <trace.h>
    3739
    3840#define atomic_inc(x)  ((void) atomic_add(x, 1))
     
    5153 *
    5254 * @return Value after addition.
     55 *
    5356 */
    54 static inline long atomic_add(atomic_t *val, int i)
     57NO_TRACE static inline atomic_count_t atomic_add(atomic_t *val,
     58    atomic_count_t i)
    5559{
    56         long tmp, v;
     60        atomic_count_t tmp;
     61        atomic_count_t v;
    5762       
    5863        asm volatile (
     
    6469                "       beq %0, %4, 1b\n"   /* if the atomic operation failed, try again */
    6570                "       nop\n"
    66                 : "=&r" (tmp), "+m" (val->count), "=&r" (v)
    67                 : "r" (i), "i" (0)
     71                : "=&r" (tmp),
     72                  "+m" (val->count),
     73                  "=&r" (v)
     74                : "r" (i),
     75                  "i" (0)
    6876        );
    6977       
     
    7179}
    7280
    73 static inline uint32_t test_and_set(atomic_t *val) {
    74         uint32_t tmp, v;
     81NO_TRACE static inline atomic_count_t test_and_set(atomic_t *val)
     82{
     83        atomic_count_t tmp;
     84        atomic_count_t v;
    7585       
    7686        asm volatile (
     
    8292                "       beqz %0, 1b\n"
    8393                "2:\n"
    84                 : "=&r" (tmp), "+m" (val->count), "=&r" (v)
     94                : "=&r" (tmp),
     95                  "+m" (val->count),
     96                  "=&r" (v)
    8597                : "i" (1)
    8698        );
     
    89101}
    90102
    91 static inline void atomic_lock_arch(atomic_t *val) {
     103NO_TRACE static inline void atomic_lock_arch(atomic_t *val)
     104{
    92105        do {
    93                 while (val->count)
    94                         ;
     106                while (val->count);
    95107        } while (test_and_set(val));
    96108}
Note: See TracChangeset for help on using the changeset viewer.