Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 1 | From 780fd27ea6f7f2c446c46a7a5e26d94106c67efd Mon Sep 17 00:00:00 2001 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 2 | From: "Richard W.M. Jones" <rjones@redhat.com> |
| 3 | Date: Sun, 20 Nov 2016 15:04:52 +0000 |
| 4 | Subject: [PATCH] Add support for RISC-V. |
| 5 | |
| 6 | The architecture is sufficiently similar to aarch64 that simply |
| 7 | extending the existing aarch64 macro works. |
| 8 | --- |
| 9 | src/include/storage/s_lock.h | 5 +++-- |
| 10 | 1 file changed, 3 insertions(+), 2 deletions(-) |
| 11 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 12 | diff --git a/src/include/storage/s_lock.h b/src/include/storage/s_lock.h |
| 13 | index dccbd29..ad60429 100644 |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 14 | --- a/src/include/storage/s_lock.h |
| 15 | +++ b/src/include/storage/s_lock.h |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 16 | @@ -317,11 +317,12 @@ tas(volatile slock_t *lock) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 17 | |
| 18 | /* |
| 19 | * On ARM and ARM64, we use __sync_lock_test_and_set(int *, int) if available. |
| 20 | + * On RISC-V, the same. |
| 21 | * |
| 22 | * We use the int-width variant of the builtin because it works on more chips |
| 23 | * than other widths. |
| 24 | */ |
| 25 | -#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) |
| 26 | +#if defined(__arm__) || defined(__arm) || defined(__aarch64__) || defined(__aarch64) || defined(__riscv) |
| 27 | #ifdef HAVE_GCC__SYNC_INT32_TAS |
| 28 | #define HAS_TEST_AND_SET |
| 29 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 30 | @@ -338,7 +339,7 @@ tas(volatile slock_t *lock) |
Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 31 | #define S_UNLOCK(lock) __sync_lock_release(lock) |
| 32 | |
| 33 | #endif /* HAVE_GCC__SYNC_INT32_TAS */ |
| 34 | -#endif /* __arm__ || __arm || __aarch64__ || __aarch64 */ |
| 35 | +#endif /* __arm__ || __arm || __aarch64__ || __aarch64 || __riscv */ |
| 36 | |
| 37 | |
Andrew Geissler | 595f630 | 2022-01-24 19:11:47 +0000 | [diff] [blame] | 38 | /* |
| 39 | -- |
| 40 | 2.34.1 |
| 41 | |