Subversion Repositories HelenOS-historic

Rev

Rev 534 | Rev 627 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 534 Rev 625
Line 29... Line 29...
29
#ifndef __sparc64_ATOMIC_H__
29
#ifndef __sparc64_ATOMIC_H__
30
#define __sparc64_ATOMIC_H__
30
#define __sparc64_ATOMIC_H__
31
 
31
 
32
#include <arch/types.h>
32
#include <arch/types.h>
33
 
33
 
34
typedef volatile __u64 atomic_t;
34
typedef struct { volatile __u64 count; } atomic_t;
35
 
35
 
36
/*
36
/*
37
 * TODO: these are just placeholders for real implementations of atomic_inc and atomic_dec.
37
 * TODO: these are just placeholders for real implementations of atomic_inc and atomic_dec.
38
 * WARNING: the following functions cause the code to be preemption-unsafe !!!
38
 * WARNING: the following functions cause the code to be preemption-unsafe !!!
39
 */
39
 */
40
 
40
 
41
static inline void atomic_inc(atomic_t *val) {
41
static inline void atomic_inc(atomic_t *val) {
42
    *val++;
42
    val->count++;
43
}
43
}
44
 
44
 
45
static inline void atomic_dec(atomic_t *val) {
45
static inline void atomic_dec(atomic_t *val) {
46
    *val--;
46
    val->count--;
47
}
47
}
48
 
48
 
49
#endif
49
#endif