Skip to content

Commit

Permalink
i#3544 riscv64: Implemented atomic_swap and Improved atomic_add (#6065)
Browse files Browse the repository at this point in the history
This commit introduces the following changes:

- Implemented atomic_swap
- Improved atomic_add

Issue: #3544
  • Loading branch information
shiptux authored May 21, 2023
1 parent 3b8cf82 commit 3a73697
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions core/arch/riscv64/riscv64.asm
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,7 @@ GLOBAL_LABEL(cleanup_and_terminate:)
/* void atomic_add(int *adr, int val) */
DECLARE_FUNC(atomic_add)
GLOBAL_LABEL(atomic_add:)
1: lr.d a2, (a0)
add a2, a2, a1
sc.d a3, a2, (a0)
bnez a3, 1b
amoadd.d ARG2, ARG2, 0 (ARG1)
ret
END_FUNC(atomic_add)

Expand Down Expand Up @@ -448,7 +445,7 @@ GLOBAL_LABEL(dr_longjmp:)
/* int atomic_swap(int *adr, int val) */
DECLARE_FUNC(atomic_swap)
GLOBAL_LABEL(atomic_swap:)
/* FIXME i#3544: Not implemented */
amoswap.d ARG2, ARG2, 0 (ARG1)
ret
END_FUNC(atomic_swap)

Expand Down

0 comments on commit 3a73697

Please sign in to comment.