L4Re – L4 Runtime Environment
Atomic Instructions
+ Collaboration diagram for Atomic Instructions:

Files

file  atomic.h
 atomic operations header and generic implementations
 

Functions

int l4util_cmpxchg64 (volatile l4_uint64_t *dest, l4_uint64_t cmp_val, l4_uint64_t new_val)
 Atomic compare and exchange (64 bit version) More...
 
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) More...
 
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) More...
 
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) More...
 
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) More...
 
l4_uint32_t l4util_xchg32 (volatile l4_uint32_t *dest, l4_uint32_t val)
 Atomic exchange (32 bit version) More...
 
l4_uint16_t l4util_xchg16 (volatile l4_uint16_t *dest, l4_uint16_t val)
 Atomic exchange (16 bit version) More...
 
l4_uint8_t l4util_xchg8 (volatile l4_uint8_t *dest, l4_uint8_t val)
 Atomic exchange (8 bit version) More...
 
l4_umword_t l4util_xchg (volatile l4_umword_t *dest, l4_umword_t val)
 Atomic exchange (machine wide fields) More...
 
void l4util_atomic_add (volatile long *dest, long val)
 Atomic add. More...
 
void l4util_atomic_inc (volatile long *dest)
 Atomic increment. More...
 

Atomic add/sub/and/or (8,16,32 bit version) without result

void l4util_add8 (volatile l4_uint8_t *dest, l4_uint8_t val)
 
void l4util_add16 (volatile l4_uint16_t *dest, l4_uint16_t val)
 
void l4util_add32 (volatile l4_uint32_t *dest, l4_uint32_t val)
 
void l4util_sub8 (volatile l4_uint8_t *dest, l4_uint8_t val)
 
void l4util_sub16 (volatile l4_uint16_t *dest, l4_uint16_t val)
 
void l4util_sub32 (volatile l4_uint32_t *dest, l4_uint32_t val)
 
void l4util_and8 (volatile l4_uint8_t *dest, l4_uint8_t val)
 
void l4util_and16 (volatile l4_uint16_t *dest, l4_uint16_t val)
 
void l4util_and32 (volatile l4_uint32_t *dest, l4_uint32_t val)
 
void l4util_or8 (volatile l4_uint8_t *dest, l4_uint8_t val)
 
void l4util_or16 (volatile l4_uint16_t *dest, l4_uint16_t val)
 
void l4util_or32 (volatile l4_uint32_t *dest, l4_uint32_t val)
 

Atomic add/sub/and/or operations (8,16,32 bit) with result

l4_uint8_t l4util_add8_res (volatile l4_uint8_t *dest, l4_uint8_t val)
 
l4_uint16_t l4util_add16_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_sub8_res (volatile l4_uint8_t *dest, l4_uint8_t val)
 
l4_uint16_t l4util_sub16_res (volatile l4_uint16_t *dest, l4_uint16_t val)
 
l4_uint32_t l4util_sub32_res (volatile l4_uint32_t *dest, l4_uint32_t val)
 
l4_uint8_t l4util_and8_res (volatile l4_uint8_t *dest, l4_uint8_t val)
 
l4_uint16_t l4util_and16_res (volatile l4_uint16_t *dest, l4_uint16_t val)
 
l4_uint32_t l4util_and32_res (volatile l4_uint32_t *dest, l4_uint32_t val)
 
l4_uint8_t l4util_or8_res (volatile l4_uint8_t *dest, l4_uint8_t val)
 
l4_uint16_t l4util_or16_res (volatile l4_uint16_t *dest, l4_uint16_t val)
 
l4_uint32_t l4util_or32_res (volatile l4_uint32_t *dest, l4_uint32_t val)
 

Atomic inc/dec (8,16,32 bit) without result

void l4util_inc8 (volatile l4_uint8_t *dest)
 
void l4util_inc16 (volatile l4_uint16_t *dest)
 
void l4util_inc32 (volatile l4_uint32_t *dest)
 
void l4util_dec8 (volatile l4_uint8_t *dest)
 
void l4util_dec16 (volatile l4_uint16_t *dest)
 
void l4util_dec32 (volatile l4_uint32_t *dest)
 

Atomic inc/dec (8,16,32 bit) with result

l4_uint8_t l4util_inc8_res (volatile l4_uint8_t *dest)
 
l4_uint16_t l4util_inc16_res (volatile l4_uint16_t *dest)
 
l4_uint32_t l4util_inc32_res (volatile l4_uint32_t *dest)
 
l4_uint8_t l4util_dec8_res (volatile l4_uint8_t *dest)
 
l4_uint16_t l4util_dec16_res (volatile l4_uint16_t *dest)
 
l4_uint32_t l4util_dec32_res (volatile l4_uint32_t *dest)
 

Detailed Description

Function Documentation

◆ l4util_add16()

void l4util_add16 ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 460 of file atomic.h.

◆ l4util_add16_res()

l4_uint16_t l4util_add16_res ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 512 of file atomic.h.

◆ l4util_add32()

void l4util_add32 ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 464 of file atomic.h.

◆ l4util_add32_res()

l4_uint32_t l4util_add32_res ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 516 of file atomic.h.

◆ l4util_add8()

void l4util_add8 ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline
Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 456 of file atomic.h.

◆ l4util_add8_res()

l4_uint8_t l4util_add8_res ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline
Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 508 of file atomic.h.

◆ l4util_and16()

void l4util_and16 ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 488 of file atomic.h.

◆ l4util_and16_res()

l4_uint16_t l4util_and16_res ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 536 of file atomic.h.

◆ l4util_and32()

void l4util_and32 ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 492 of file atomic.h.

◆ l4util_and32_res()

l4_uint32_t l4util_and32_res ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 540 of file atomic.h.

◆ l4util_and8()

void l4util_and8 ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 484 of file atomic.h.

◆ l4util_and8_res()

l4_uint8_t l4util_and8_res ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 532 of file atomic.h.

◆ l4util_atomic_add()

void l4util_atomic_add ( volatile long *  dest,
long  val 
)
inline

Atomic add.

Parameters
destdestination operand
valvalue to add

Definition at line 468 of file atomic.h.

◆ l4util_atomic_inc()

void l4util_atomic_inc ( volatile long *  dest)
inline

Atomic increment.

Parameters
destdestination operand

Definition at line 411 of file atomic.h.

◆ l4util_cmpxchg()

int l4util_cmpxchg ( volatile l4_umword_t dest,
l4_umword_t  cmp_val,
l4_umword_t  new_val 
)
inline

Atomic compare and exchange (machine wide fields)

Parameters
destdestination operand
cmp_valcompare value
new_valnew value for dest
Returns
0 if comparison failed, 1 otherwise

Compare the value in dest with cmp_val, if equal set dest to new_val

Definition at line 367 of file atomic.h.

Referenced by l4util_btr(), l4util_bts(), l4util_clear_bit(), and l4util_set_bit().

+ Here is the caller graph for this function:

◆ l4util_cmpxchg16()

int l4util_cmpxchg16 ( volatile l4_uint16_t dest,
l4_uint16_t  cmp_val,
l4_uint16_t  new_val 
)
inline

Atomic compare and exchange (16 bit version)

Parameters
destdestination operand
cmp_valcompare value
new_valnew value for dest
Returns
0 if comparison failed, !=0 otherwise

Compare the value in dest with cmp_val, if equal set dest to new_val

Definition at line 351 of file atomic.h.

◆ l4util_cmpxchg32()

int l4util_cmpxchg32 ( volatile l4_uint32_t dest,
l4_uint32_t  cmp_val,
l4_uint32_t  new_val 
)
inline

Atomic compare and exchange (32 bit version)

Parameters
destdestination operand
cmp_valcompare value
new_valnew value for dest
Returns
0 if comparison failed, !=0 otherwise

Compare the value in dest with cmp_val, if equal set dest to new_val

Definition at line 343 of file atomic.h.

◆ l4util_cmpxchg64()

int l4util_cmpxchg64 ( volatile l4_uint64_t dest,
l4_uint64_t  cmp_val,
l4_uint64_t  new_val 
)
inline

Atomic compare and exchange (64 bit version)

Parameters
destdestination operand
cmp_valcompare value
new_valnew value for dest
Returns
0 if comparison failed, 1 otherwise

Compare the value in dest with cmp_val, if equal set dest to new_val

Definition at line 335 of file atomic.h.

◆ l4util_cmpxchg8()

int l4util_cmpxchg8 ( volatile l4_uint8_t dest,
l4_uint8_t  cmp_val,
l4_uint8_t  new_val 
)
inline

Atomic compare and exchange (8 bit version)

Parameters
destdestination operand
cmp_valcompare value
new_valnew value for dest
Returns
0 if comparison failed, !=0 otherwise

Compare the value in dest with cmp_val, if equal set dest to new_val

Definition at line 359 of file atomic.h.

◆ l4util_dec16()

void l4util_dec16 ( volatile l4_uint16_t dest)
inline

Parameters
destdestination operand

Definition at line 419 of file atomic.h.

◆ l4util_dec16_res()

l4_uint16_t l4util_dec16_res ( volatile l4_uint16_t dest)
inline

Parameters
destdestination operand
Returns
res

Definition at line 444 of file atomic.h.

◆ l4util_dec32()

void l4util_dec32 ( volatile l4_uint32_t dest)
inline

Parameters
destdestination operand

Definition at line 423 of file atomic.h.

◆ l4util_dec32_res()

l4_uint32_t l4util_dec32_res ( volatile l4_uint32_t dest)
inline

Parameters
destdestination operand
Returns
res

Definition at line 448 of file atomic.h.

◆ l4util_dec8()

void l4util_dec8 ( volatile l4_uint8_t dest)
inline

Parameters
destdestination operand

Definition at line 415 of file atomic.h.

◆ l4util_dec8_res()

l4_uint8_t l4util_dec8_res ( volatile l4_uint8_t dest)
inline

Parameters
destdestination operand
Returns
res

Definition at line 440 of file atomic.h.

◆ l4util_inc16()

void l4util_inc16 ( volatile l4_uint16_t dest)
inline

Parameters
destdestination operand

Definition at line 403 of file atomic.h.

◆ l4util_inc16_res()

l4_uint16_t l4util_inc16_res ( volatile l4_uint16_t dest)
inline

Parameters
destdestination operand
Returns
res

Definition at line 432 of file atomic.h.

◆ l4util_inc32()

void l4util_inc32 ( volatile l4_uint32_t dest)
inline

Parameters
destdestination operand

Definition at line 407 of file atomic.h.

◆ l4util_inc32_res()

l4_uint32_t l4util_inc32_res ( volatile l4_uint32_t dest)
inline

Parameters
destdestination operand
Returns
res

Definition at line 436 of file atomic.h.

◆ l4util_inc8()

void l4util_inc8 ( volatile l4_uint8_t dest)
inline
Parameters
destdestination operand

Definition at line 399 of file atomic.h.

◆ l4util_inc8_res()

l4_uint8_t l4util_inc8_res ( volatile l4_uint8_t dest)
inline
Parameters
destdestination operand
Returns
res

Definition at line 428 of file atomic.h.

◆ l4util_or16()

void l4util_or16 ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 500 of file atomic.h.

◆ l4util_or16_res()

l4_uint16_t l4util_or16_res ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 548 of file atomic.h.

◆ l4util_or32()

void l4util_or32 ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 504 of file atomic.h.

◆ l4util_or32_res()

l4_uint32_t l4util_or32_res ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 552 of file atomic.h.

◆ l4util_or8()

void l4util_or8 ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 496 of file atomic.h.

◆ l4util_or8_res()

l4_uint8_t l4util_or8_res ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 544 of file atomic.h.

◆ l4util_sub16()

void l4util_sub16 ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 476 of file atomic.h.

◆ l4util_sub16_res()

l4_uint16_t l4util_sub16_res ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 524 of file atomic.h.

◆ l4util_sub32()

void l4util_sub32 ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 480 of file atomic.h.

◆ l4util_sub32_res()

l4_uint32_t l4util_sub32_res ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 528 of file atomic.h.

◆ l4util_sub8()

void l4util_sub8 ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or

Definition at line 472 of file atomic.h.

◆ l4util_sub8_res()

l4_uint8_t l4util_sub8_res ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Parameters
destdestination operand
valvalue to add/sub/and/or
Returns
res

Definition at line 520 of file atomic.h.

◆ l4util_xchg()

l4_umword_t l4util_xchg ( volatile l4_umword_t dest,
l4_umword_t  val 
)
inline

Atomic exchange (machine wide fields)

Parameters
destdestination operand
valnew value for dest
Returns
old value at destination

Definition at line 393 of file atomic.h.

◆ l4util_xchg16()

l4_uint16_t l4util_xchg16 ( volatile l4_uint16_t dest,
l4_uint16_t  val 
)
inline

Atomic exchange (16 bit version)

Parameters
destdestination operand
valnew value for dest
Returns
old value at destination

Definition at line 381 of file atomic.h.

◆ l4util_xchg32()

l4_uint32_t l4util_xchg32 ( volatile l4_uint32_t dest,
l4_uint32_t  val 
)
inline

Atomic exchange (32 bit version)

Parameters
destdestination operand
valnew value for dest
Returns
old value at destination

Definition at line 375 of file atomic.h.

◆ l4util_xchg8()

l4_uint8_t l4util_xchg8 ( volatile l4_uint8_t dest,
l4_uint8_t  val 
)
inline

Atomic exchange (8 bit version)

Parameters
destdestination operand
valnew value for dest
Returns
old value at destination

Definition at line 387 of file atomic.h.