MCPcopy Create free account
hub / github.com/F-Stack/f-stack / atomic_fetchadd_32

Function atomic_fetchadd_32

freebsd/mips/include/atomic.h:483–496  ·  view source on GitHub ↗

* Atomically add the value of v to the integer pointed to by p and return * the previous value of *p. */

Source from the content-addressed store, hash-verified

481 * the previous value of *p.
482 */
483static __inline uint32_t
484atomic_fetchadd_32(__volatile uint32_t *p, uint32_t v)
485{
486 uint32_t value, temp;
487
488 __asm __volatile (
489 "1:\tll %0, %1\n\t" /* load old value */
490 "addu %2, %3, %0\n\t" /* calculate new value */
491 "sc %2, %1\n\t" /* attempt to store */
492 "beqz %2, 1b\n\t" /* spin if failed */
493 : "=&r" (value), "=m" (*p), "=&r" (temp)
494 : "r" (v), "m" (*p));
495 return (value);
496}
497
498#if defined(__mips_n64) || defined(__mips_n32)
499/*

Callers 6

atomic_add_32_nvFunction · 0.50
ieee80211_com_vincrefFunction · 0.50
ieee80211_com_vdecrefFunction · 0.50
lagg_rr_startFunction · 0.50
export_sendFunction · 0.50
export9_sendFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected