[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH v2 3/4] linux-user/prctl: Add dynamic memory consistency mode
From: |
Christoph Müllner |
Subject: |
[RFC PATCH v2 3/4] linux-user/prctl: Add dynamic memory consistency model prctl API |
Date: |
Fri, 9 Feb 2024 07:41:16 +0100 |
This patch implements the prctl calls to set and get the current memory
consistency model. This patch does not implement any real functionality
but just defines the relevant hooks, where target code take over.
Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
---
linux-user/syscall.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index bf0d66b8a8..cf0845a074 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6309,6 +6309,12 @@ abi_long do_arch_prctl(CPUX86State *env, int code,
abi_ulong addr)
# define PR_SME_VL_LEN_MASK 0xffff
# define PR_SME_VL_INHERIT (1 << 17)
#endif
+#ifndef PR_SET_MEMORY_CONSISTENCY_MODEL
+# define PR_SET_MEMORY_CONSISTENCY_MODEL 71
+# define PR_GET_MEMORY_CONSISTENCY_MODEL 72
+# define PR_MEMORY_CONSISTENCY_MODEL_RISCV_WMO 1
+# define PR_MEMORY_CONSISTENCY_MODEL_RISCV_TSO 2
+#endif
#include "target_prctl.h"
@@ -6355,6 +6361,12 @@ static abi_long do_prctl_inval1(CPUArchState *env,
abi_long arg2)
#ifndef do_prctl_sme_set_vl
#define do_prctl_sme_set_vl do_prctl_inval1
#endif
+#ifndef do_prctl_set_memory_consistency_model
+#define do_prctl_set_memory_consistency_model do_prctl_inval1
+#endif
+#ifndef do_prctl_get_memory_consistency_model
+#define do_prctl_get_memory_consistency_model do_prctl_inval0
+#endif
static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
abi_long arg3, abi_long arg4, abi_long arg5)
@@ -6481,6 +6493,11 @@ static abi_long do_prctl(CPUArchState *env, abi_long
option, abi_long arg2,
/* Disable to prevent the target disabling stuff we need. */
return -TARGET_EINVAL;
+ case PR_SET_MEMORY_CONSISTENCY_MODEL:
+ return do_prctl_set_memory_consistency_model(env, arg2);
+ case PR_GET_MEMORY_CONSISTENCY_MODEL:
+ return do_prctl_get_memory_consistency_model(env);
+
default:
qemu_log_mask(LOG_UNIMP, "Unsupported prctl: " TARGET_ABI_FMT_ld "\n",
option);
--
2.43.0