Subversion Repositories HelenOS-historic

Compare Revisions

Regard whitespace Rev 1104 → Rev 1102

/kernel/trunk/arch/mips32/include/atomic.h
30,7 → 30,6
#define __mips32_ATOMIC_H__
 
#include <arch/types.h>
#include <typedefs.h>
 
#define atomic_inc(x) ((void) atomic_add(x, 1))
#define atomic_dec(x) ((void) atomic_add(x, -1))
41,6 → 40,8
#define atomic_preinc(x) atomic_add(x, 1)
#define atomic_predec(x) atomic_add(x, -1)
 
typedef struct { volatile __u32 count; } atomic_t;
 
/* Atomic addition of immediate value.
*
* @param val Memory location to which will be the immediate value added.
48,9 → 49,9
*
* @return Value after addition.
*/
static inline long atomic_add(atomic_t *val, int i)
static inline count_t atomic_add(atomic_t *val, int i)
{
long tmp, v;
count_t tmp, v;
 
__asm__ volatile (
"1:\n"
67,4 → 68,16
return v;
}
 
/* Reads/writes are atomic on mips for 4-bytes */
 
static inline void atomic_set(atomic_t *val, __u32 i)
{
val->count = i;
}
 
static inline __u32 atomic_get(atomic_t *val)
{
return val->count;
}
 
#endif