Changeset 04803bf in mainline for kernel/arch/ia32/include/atomic.h


Ignore:
Timestamp:
2011-03-21T22:00:17Z (14 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 edited

Legend:

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

    rb50b5af2 r04803bf  
    3636#define KERN_ia32_ATOMIC_H_
    3737
    38 #include <arch/types.h>
     38#include <typedefs.h>
    3939#include <arch/barrier.h>
    4040#include <preemption.h>
     41#include <trace.h>
    4142
    42 static inline void atomic_inc(atomic_t *val) {
     43NO_TRACE static inline void atomic_inc(atomic_t *val)
     44{
    4345#ifdef CONFIG_SMP
    4446        asm volatile (
     
    5456}
    5557
    56 static inline void atomic_dec(atomic_t *val) {
     58NO_TRACE static inline void atomic_dec(atomic_t *val)
     59{
    5760#ifdef CONFIG_SMP
    5861        asm volatile (
     
    6871}
    6972
    70 static inline long atomic_postinc(atomic_t *val)
     73NO_TRACE static inline atomic_count_t atomic_postinc(atomic_t *val)
    7174{
    72         long r = 1;
     75        atomic_count_t r = 1;
    7376       
    7477        asm volatile (
    7578                "lock xaddl %[r], %[count]\n"
    76                 : [count] "+m" (val->count), [r] "+r" (r)
     79                : [count] "+m" (val->count),
     80                  [r] "+r" (r)
    7781        );
    7882       
     
    8084}
    8185
    82 static inline long atomic_postdec(atomic_t *val)
     86NO_TRACE static inline atomic_count_t atomic_postdec(atomic_t *val)
    8387{
    84         long r = -1;
     88        atomic_count_t r = -1;
    8589       
    8690        asm volatile (
    8791                "lock xaddl %[r], %[count]\n"
    88                 : [count] "+m" (val->count), [r] "+r"(r)
     92                : [count] "+m" (val->count),
     93                  [r] "+r" (r)
    8994        );
    9095       
     
    95100#define atomic_predec(val)  (atomic_postdec(val) - 1)
    96101
    97 static inline uint32_t test_and_set(atomic_t *val) {
    98         uint32_t v;
     102NO_TRACE static inline atomic_count_t test_and_set(atomic_t *val)
     103{
     104        atomic_count_t v = 1;
    99105       
    100106        asm volatile (
    101                 "movl $1, %[v]\n"
    102107                "xchgl %[v], %[count]\n"
    103                 : [v] "=r" (v), [count] "+m" (val->count)
     108                : [v] "+r" (v),
     109                  [count] "+m" (val->count)
    104110        );
    105111       
     
    108114
    109115/** ia32 specific fast spinlock */
    110 static inline void atomic_lock_arch(atomic_t *val)
     116NO_TRACE static inline void atomic_lock_arch(atomic_t *val)
    111117{
    112         uint32_t tmp;
     118        atomic_count_t tmp;
    113119       
    114120        preemption_disable();
     
    124130                "testl %[tmp], %[tmp]\n"
    125131                "jnz 0b\n"
    126                 : [count] "+m" (val->count), [tmp] "=&r" (tmp)
     132                : [count] "+m" (val->count),
     133                  [tmp] "=&r" (tmp)
    127134        );
     135       
    128136        /*
    129137         * Prevent critical section code from bleeding out this way up.
Note: See TracChangeset for help on using the changeset viewer.