19#ifndef __L4UTIL__INCLUDE__ATOMIC_H__
20#define __L4UTIL__INCLUDE__ATOMIC_H__
22#include <l4/sys/l4int.h>
36#if __SIZEOF_LONG__ == 8
344#if __SIZEOF_LONG__ == 8
350 return __atomic_compare_exchange_n(dest, &cmp_val, new_val, 0,
351 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
360 return __atomic_compare_exchange_n(dest, &cmp_val, new_val, 0,
361 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
368 return __atomic_compare_exchange_n(dest, &cmp_val, new_val, 0,
369 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
376 return __atomic_compare_exchange_n(dest, &cmp_val, new_val, 0,
377 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
384 return __atomic_compare_exchange_n(dest, &cmp_val, new_val, 0,
385 __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
391 return __atomic_exchange_n(dest, val, __ATOMIC_SEQ_CST);
397 return __atomic_exchange_n(dest, val, __ATOMIC_SEQ_CST);
403 return __atomic_exchange_n(dest, val, __ATOMIC_SEQ_CST);
409 return __atomic_exchange_n(dest, val, __ATOMIC_SEQ_CST);
414{ __atomic_fetch_add(dest, 1, __ATOMIC_SEQ_CST); }
418{ __atomic_fetch_add(dest, 1, __ATOMIC_SEQ_CST); }
422{ __atomic_fetch_add(dest, 1, __ATOMIC_SEQ_CST); }
426{ __atomic_fetch_add(dest, 1, __ATOMIC_SEQ_CST); }
430{ __atomic_fetch_sub(dest, 1, __ATOMIC_SEQ_CST); }
434{ __atomic_fetch_sub(dest, 1, __ATOMIC_SEQ_CST); }
438{ __atomic_fetch_sub(dest, 1, __ATOMIC_SEQ_CST); }
443{
return __atomic_add_fetch(dest, 1, __ATOMIC_SEQ_CST); }
447{
return __atomic_add_fetch(dest, 1, __ATOMIC_SEQ_CST); }
451{
return __atomic_add_fetch(dest, 1, __ATOMIC_SEQ_CST); }
455{
return __atomic_sub_fetch(dest, 1, __ATOMIC_SEQ_CST); }
459{
return __atomic_sub_fetch(dest, 1, __ATOMIC_SEQ_CST); }
463{
return __atomic_sub_fetch(dest, 1, __ATOMIC_SEQ_CST); }
467{
return __atomic_sub_fetch(dest, 1, __ATOMIC_SEQ_CST); }
471{ __atomic_fetch_add(dest, val, __ATOMIC_SEQ_CST); }
475{ __atomic_fetch_add(dest, val, __ATOMIC_SEQ_CST); }
479{ __atomic_fetch_add(dest, val, __ATOMIC_SEQ_CST); }
483{ __atomic_fetch_add(dest, val, __ATOMIC_SEQ_CST); }
487{ __atomic_fetch_sub(dest, val, __ATOMIC_SEQ_CST); }
491{ __atomic_fetch_sub(dest, val, __ATOMIC_SEQ_CST); }
495{ __atomic_fetch_sub(dest, val, __ATOMIC_SEQ_CST); }
499{ __atomic_fetch_and(dest, val, __ATOMIC_SEQ_CST); }
503{ __atomic_fetch_and(dest, val, __ATOMIC_SEQ_CST); }
507{ __atomic_fetch_and(dest, val, __ATOMIC_SEQ_CST); }
511{ __atomic_fetch_or(dest, val, __ATOMIC_SEQ_CST); }
515{ __atomic_fetch_or(dest, val, __ATOMIC_SEQ_CST); }
519{ __atomic_fetch_or(dest, val, __ATOMIC_SEQ_CST); }
523{
return __atomic_add_fetch(dest, val, __ATOMIC_SEQ_CST); }
527{
return __atomic_add_fetch(dest, val, __ATOMIC_SEQ_CST); }
531{
return __atomic_add_fetch(dest, val, __ATOMIC_SEQ_CST); }
535{
return __atomic_sub_fetch(dest, val, __ATOMIC_SEQ_CST); }
539{
return __atomic_sub_fetch(dest, val, __ATOMIC_SEQ_CST); }
543{
return __atomic_sub_fetch(dest, val, __ATOMIC_SEQ_CST); }
547{
return __atomic_and_fetch(dest, val, __ATOMIC_SEQ_CST); }
551{
return __atomic_and_fetch(dest, val, __ATOMIC_SEQ_CST); }
555{
return __atomic_and_fetch(dest, val, __ATOMIC_SEQ_CST); }
559{
return __atomic_or_fetch(dest, val, __ATOMIC_SEQ_CST); }
563{
return __atomic_or_fetch(dest, val, __ATOMIC_SEQ_CST); }
567{
return __atomic_or_fetch(dest, val, __ATOMIC_SEQ_CST); }
L4 compiler related defines.
unsigned long l4_umword_t
Unsigned machine word.
unsigned char l4_uint8_t
Unsigned 8bit value.
unsigned int l4_uint32_t
Unsigned 32bit value.
unsigned short int l4_uint16_t
Unsigned 16bit value.
unsigned long long l4_uint64_t
Unsigned 64bit value.
#define L4_INLINE
L4 Inline function attribute.
#define EXTERN_C_BEGIN
Start section with C types and functions.
#define EXTERN_C_END
End section with C types and functions.
l4_uint32_t l4util_inc32_res(volatile l4_uint32_t *dest)
void l4util_inc32(volatile l4_uint32_t *dest)
void l4util_atomic_add(volatile long *dest, long val)
Atomic add.
void l4util_dec16(volatile l4_uint16_t *dest)
void l4util_and32(volatile l4_uint32_t *dest, l4_uint32_t val)
l4_uint32_t l4util_xchg32(volatile l4_uint32_t *dest, l4_uint32_t val)
Atomic exchange (32 bit version)
l4_uint16_t l4util_or16_res(volatile l4_uint16_t *dest, l4_uint16_t val)
l4_uint32_t l4util_add32_res(volatile l4_uint32_t *dest, l4_uint32_t val)
l4_uint8_t l4util_xchg8(volatile l4_uint8_t *dest, l4_uint8_t val)
Atomic exchange (8 bit version)
int l4util_cmpxchg8(volatile l4_uint8_t *dest, l4_uint8_t cmp_val, l4_uint8_t new_val)
Atomic compare and exchange (8 bit version)
int l4util_cmpxchg16(volatile l4_uint16_t *dest, l4_uint16_t cmp_val, l4_uint16_t new_val)
Atomic compare and exchange (16 bit version)
l4_uint32_t l4util_dec32_res(volatile l4_uint32_t *dest)
l4_uint32_t l4util_and32_res(volatile l4_uint32_t *dest, l4_uint32_t val)
void l4util_add8(volatile l4_uint8_t *dest, l4_uint8_t val)
l4_uint8_t l4util_add8_res(volatile l4_uint8_t *dest, l4_uint8_t val)
l4_uint8_t l4util_and8_res(volatile l4_uint8_t *dest, l4_uint8_t val)
void l4util_or32(volatile l4_uint32_t *dest, l4_uint32_t val)
void l4util_or16(volatile l4_uint16_t *dest, l4_uint16_t val)
void l4util_inc8(volatile l4_uint8_t *dest)
void l4util_sub16(volatile l4_uint16_t *dest, l4_uint16_t val)
void l4util_add32(volatile l4_uint32_t *dest, l4_uint32_t val)
l4_uint16_t l4util_xchg16(volatile l4_uint16_t *dest, l4_uint16_t val)
Atomic exchange (16 bit version)
void l4util_dec32(volatile l4_uint32_t *dest)
int l4util_cmpxchg(volatile l4_umword_t *dest, l4_umword_t cmp_val, l4_umword_t new_val)
Atomic compare and exchange (machine wide fields)
l4_umword_t l4util_xchg(volatile l4_umword_t *dest, l4_umword_t val)
Atomic exchange (machine wide fields)
l4_uint16_t l4util_and16_res(volatile l4_uint16_t *dest, l4_uint16_t val)
l4_uint16_t l4util_dec16_res(volatile l4_uint16_t *dest)
void l4util_and8(volatile l4_uint8_t *dest, l4_uint8_t val)
void l4util_or8(volatile l4_uint8_t *dest, l4_uint8_t val)
l4_uint32_t l4util_or32_res(volatile l4_uint32_t *dest, l4_uint32_t val)
void l4util_atomic_inc(volatile long *dest)
Atomic increment.
void l4util_add16(volatile l4_uint16_t *dest, l4_uint16_t val)
l4_uint8_t l4util_sub8_res(volatile l4_uint8_t *dest, l4_uint8_t val)
void l4util_sub8(volatile l4_uint8_t *dest, l4_uint8_t val)
l4_uint8_t l4util_inc8_res(volatile l4_uint8_t *dest)
int l4util_cmpxchg32(volatile l4_uint32_t *dest, l4_uint32_t cmp_val, l4_uint32_t new_val)
Atomic compare and exchange (32 bit version)
l4_uint16_t l4util_add16_res(volatile l4_uint16_t *dest, l4_uint16_t val)
l4_uint16_t l4util_inc16_res(volatile l4_uint16_t *dest)
void l4util_sub32(volatile l4_uint32_t *dest, l4_uint32_t val)
l4_uint16_t l4util_sub16_res(volatile l4_uint16_t *dest, l4_uint16_t val)
void l4util_inc16(volatile l4_uint16_t *dest)
void l4util_dec8(volatile l4_uint8_t *dest)
void l4util_and16(volatile l4_uint16_t *dest, l4_uint16_t val)
l4_uint8_t l4util_dec8_res(volatile l4_uint8_t *dest)
l4_uint8_t l4util_or8_res(volatile l4_uint8_t *dest, l4_uint8_t val)
l4_uint32_t l4util_sub32_res(volatile l4_uint32_t *dest, l4_uint32_t val)