diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-03-12 14:42:15 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-03-12 14:42:15 +0100 |
| commit | 55edf30ecf0bfa127554b14a0c8149d0b1f70ded (patch) | |
| tree | e002b5b67cddf7c912e6ea163529efa9a8454cc2 /src | |
| parent | d231539504818e6b725062eb851e1d8e0ed1e600 (diff) | |
| download | box64-55edf30ecf0bfa127554b14a0c8149d0b1f70ded.tar.gz box64-55edf30ecf0bfa127554b14a0c8149d0b1f70ded.zip | |
[ARM64_DYNAREC] Fixed build
Diffstat (limited to 'src')
| -rwxr-xr-x | src/dynarec/arm64/arm64_lock.S | 24 | ||||
| -rwxr-xr-x | src/dynarec/arm64/arm64_lock.h | 6 | ||||
| -rwxr-xr-x | src/dynarec/arm64/dynarec_arm64_helper.c | 1 | ||||
| -rwxr-xr-x | src/dynarec/native_lock.h | 2 |
4 files changed, 32 insertions, 1 deletions
diff --git a/src/dynarec/arm64/arm64_lock.S b/src/dynarec/arm64/arm64_lock.S index f2a33055..b091101a 100755 --- a/src/dynarec/arm64/arm64_lock.S +++ b/src/dynarec/arm64/arm64_lock.S @@ -15,8 +15,10 @@ .global arm64_lock_write_dd .global arm64_lock_read_dq .global arm64_lock_write_dq -.global arm64_lock_xchg +.global arm64_lock_xchg_dd .global arm64_lock_xchg_d +.global arm64_lock_xchg_h +.global arm64_lock_xchg_b .global arm64_lock_storeifnull .global arm64_lock_storeifnull_d .global arm64_lock_storeifref @@ -117,6 +119,26 @@ arm64_lock_xchg_d_0: mov w0, w2 ret +arm64_lock_xchg_h: + dmb ish +arm64_lock_xchg_h_0: + // address is x0, value is x1, return old value in x0 + ldaxrh w2, [x0] + stlxrh w3, w1, [x0] + cbnz w3, arm64_lock_xchg_h_0 + mov w0, w2 + ret + +arm64_lock_xchg_b: + dmb ish +arm64_lock_xchg_b_0: + // address is x0, value is x1, return old value in x0 + ldaxrb w2, [x0] + stlxrb w3, w1, [x0] + cbnz w3, arm64_lock_xchg_b_0 + mov w0, w2 + ret + arm64_lock_storeifnull: dmb ish 1: diff --git a/src/dynarec/arm64/arm64_lock.h b/src/dynarec/arm64/arm64_lock.h index 78030447..44eb5fa4 100755 --- a/src/dynarec/arm64/arm64_lock.h +++ b/src/dynarec/arm64/arm64_lock.h @@ -33,6 +33,12 @@ extern uintptr_t arm64_lock_xchg_dd(void* p, uintptr_t val); // Atomicaly exchange value at [p] with val, return old p extern uint32_t arm64_lock_xchg_d(void* p, uint32_t val); +// Atomicaly exchange value at [p] with val, return old p +extern uint32_t arm64_lock_xchg_h(void* p, uint32_t val); + +// Atomicaly exchange value at [p] with val, return old p +extern uint32_t arm64_lock_xchg_b(void* p, uint32_t val); + // Atomicaly store value to [p] only if [p] is NULL. Return old [p] value extern uint32_t arm64_lock_storeifnull_d(void*p, uint32_t val); diff --git a/src/dynarec/arm64/dynarec_arm64_helper.c b/src/dynarec/arm64/dynarec_arm64_helper.c index 4d5d875f..81a4e637 100755 --- a/src/dynarec/arm64/dynarec_arm64_helper.c +++ b/src/dynarec/arm64/dynarec_arm64_helper.c @@ -4,6 +4,7 @@ #include <pthread.h> #include <errno.h> #include <assert.h> +#include <string.h> #include "debug.h" #include "box64context.h" diff --git a/src/dynarec/native_lock.h b/src/dynarec/native_lock.h index e0d17403..dd2f3b6f 100755 --- a/src/dynarec/native_lock.h +++ b/src/dynarec/native_lock.h @@ -16,6 +16,8 @@ #define native_lock_write_dq(A, B, C) arm64_lock_write_dq(A, B, C) #define native_lock_xchg_dd(A, B) arm64_lock_xchg_dd(A, B) #define native_lock_xchg_d(A, B) arm64_lock_xchg_d(A, B) +#define native_lock_xchg_h(A, B) arm64_lock_xchg_h(A, B) +#define native_lock_xchg_b(A, B) arm64_lock_xchg_b(A, B) #define native_lock_storeifref(A, B, C) arm64_lock_storeifref(A, B, C) #define native_lock_storeifref_d(A, B, C) arm64_lock_storeifref_d(A, B, C) #define native_lock_storeifref2_d(A, B, C) arm64_lock_storeifref2_d(A, B, C) |