atomic: add atomic_xadd
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
b6992dc0cf
commit
bdd3915f83
2 changed files with 6 additions and 1 deletions
|
|
@ -11,3 +11,8 @@ atomic_cmpxchg:
|
||||||
mov eax, 1
|
mov eax, 1
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
.global atomic_xadd
|
||||||
|
atomic_xadd:
|
||||||
|
mov rax, rsi
|
||||||
|
lock xadd [rdi], rax
|
||||||
|
ret
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,6 @@
|
||||||
#include <kernel/types.h>
|
#include <kernel/types.h>
|
||||||
|
|
||||||
int atomic_cmpxchg(u32 *ptr, int a, int b);
|
int atomic_cmpxchg(u32 *ptr, int a, int b);
|
||||||
|
u64 atomic_xadd(u64 *ptr, u64 val); /* add val to *ptr and return old value of *ptr */
|
||||||
|
|
||||||
#endif /* _ATOMIC_H_ */
|
#endif /* _ATOMIC_H_ */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue