Changeset 73838ed in mainline for arch/amd64/include


Ignore:
Timestamp:
2005-09-01T19:21:37Z (20 years ago)
Author:
Ondrej Palkovsky <ondrap@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7df54df
Parents:
437e35a0
Message:

Cleanups so that it compiles on ia-32 & amd-64 cleanly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • arch/amd64/include/atomic.h

    r437e35a0 r73838ed  
    3030#define __amd64_ATOMIC_H__
    3131
    32 /*
    33  * TODO: these are just placeholders for real implementations of atomic_inc and atomic_dec.
    34  * WARNING: the following functions cause the code to be preemption-unsafe !!!
    35  */
    3632
    37 static inline atomic_inc(volatile int *val) {
    38         *val++;
     33/* Count_t is 32-bits on AMD-64 */
     34static inline void atomic_inc(volatile count_t *val) {
     35#ifdef __SMP__
     36        __asm__ volatile ("lock incl (%0)\n" : : "r" (val));
     37#else
     38        __asm__ volatile ("incl (%0)\n" : : "r" (val));
     39#endif /* __SMP__ */
    3940}
    4041
    41 static inline atomic_dec(volatile int *val) {
    42         *val--;
     42static inline void atomic_dec(volatile count_t *val) {
     43#ifdef __SMP__
     44        __asm__ volatile ("lock decl (%0)\n" : : "r" (val));
     45#else
     46        __asm__ volatile ("decl (%0)\n" : : "r" (val));
     47#endif /* __SMP__ */
    4348}
    4449
Note: See TracChangeset for help on using the changeset viewer.