NOVA
Stripped down NOVA kernel for the OSY course
Loading...
Searching...
No Matches
Atomic Class Reference

Static Public Member Functions

template<typename T>
static ALWAYS_INLINE bool cmp_swap (T &ptr, T o, T n)
template<typename T>
static ALWAYS_INLINE T add (T &ptr, T v)
template<typename T>
static ALWAYS_INLINE T sub (T &ptr, T v)
template<typename T>
static ALWAYS_INLINE void set_mask (T &ptr, T v)
template<typename T>
static ALWAYS_INLINE void clr_mask (T &ptr, T v)
template<typename T>
static ALWAYS_INLINE bool test_set_bit (T &val, unsigned long bit)
template<typename T>
static ALWAYS_INLINE bool test_clr_bit (T &val, unsigned long bit)

Member Function Documentation

◆ add()

template<typename T>
ALWAYS_INLINE T Atomic::add ( T & ptr,
T v )
inlinestatic
32{ return __sync_add_and_fetch (&ptr, v); }

◆ clr_mask()

template<typename T>
ALWAYS_INLINE void Atomic::clr_mask ( T & ptr,
T v )
inlinestatic
44{ __sync_and_and_fetch (&ptr, ~v); }

◆ cmp_swap()

template<typename T>
ALWAYS_INLINE bool Atomic::cmp_swap ( T & ptr,
T o,
T n )
inlinestatic
28{ return __sync_bool_compare_and_swap (&ptr, o, n); }

◆ set_mask()

template<typename T>
ALWAYS_INLINE void Atomic::set_mask ( T & ptr,
T v )
inlinestatic
40{ __sync_or_and_fetch (&ptr, v); }

◆ sub()

template<typename T>
ALWAYS_INLINE T Atomic::sub ( T & ptr,
T v )
inlinestatic
36{ return __sync_sub_and_fetch (&ptr, v); }

◆ test_clr_bit()

template<typename T>
ALWAYS_INLINE bool Atomic::test_clr_bit ( T & val,
unsigned long bit )
inlinestatic
58 {
59 bool ret;
60 asm volatile ("lock; btr%z1 %2, %1; setc %0" : "=q" (ret), "+m" (val) : "ir" (bit) : "cc");
61 return ret;
62 }

◆ test_set_bit()

template<typename T>
ALWAYS_INLINE bool Atomic::test_set_bit ( T & val,
unsigned long bit )
inlinestatic
49 {
50 bool ret;
51 asm volatile ("lock; bts%z1 %2, %1; setc %0" : "=q" (ret), "+m" (val) : "ir" (bit) : "cc");
52 return ret;
53 }

The documentation for this class was generated from the following file: