[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 48/55] linux-user: Add code for PR_GET/SET_UNALIGN
From: |
Richard Henderson |
Subject: |
[PATCH v2 48/55] linux-user: Add code for PR_GET/SET_UNALIGN |
Date: |
Mon, 2 Aug 2021 18:14:36 -1000 |
This requires extra work for each target, but adds the
common syscall code, and the necessary flag in CPUState.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
include/hw/core/cpu.h | 3 +++
linux-user/syscall.c | 21 +++++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
index b7d5bc1200..088b2d1adf 100644
--- a/include/hw/core/cpu.h
+++ b/include/hw/core/cpu.h
@@ -412,6 +412,9 @@ struct CPUState {
bool ignore_memory_transaction_failures;
+ /* Used for user-only emulation of prctl(PR_SET_UNALIGN). */
+ bool prctl_unalign_sigbus;
+
struct hax_vcpu_state *hax_vcpu;
struct hvf_vcpu_state *hvf;
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index e303a9da7f..b2e3c28b41 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6640,6 +6640,25 @@ static abi_long do_prctl(CPUArchState *env, abi_long
option, abi_long arg2,
}
return do_prctl_get_tagged_addr_ctrl(env);
+ /*
+ * We only implement PR_UNALIGN_SIGBUS, and only for those targets
+ * who have had their translator updated to insert MO_ALIGN.
+ */
+#if 0
+ case PR_GET_UNALIGN:
+ {
+ CPUState *cs = env_cpu(env);
+ uint32_t res = PR_UNALIGN_NOPRINT;
+ if (cs->prctl_unalign_sigbus) {
+ res |= PR_UNALIGN_SIGBUS;
+ }
+ return put_user_u32(res, arg2);
+ }
+ case PR_SET_UNALIGN:
+ env_cpu(env)->prctl_unalign_sigbus = arg2 & PR_UNALIGN_SIGBUS;
+ return 0;
+#endif
+
case PR_GET_DUMPABLE:
case PR_SET_DUMPABLE:
case PR_GET_KEEPCAPS:
@@ -6682,8 +6701,6 @@ static abi_long do_prctl(CPUArchState *env, abi_long
option, abi_long arg2,
case PR_SET_THP_DISABLE:
case PR_GET_TSC:
case PR_SET_TSC:
- case PR_GET_UNALIGN:
- case PR_SET_UNALIGN:
default:
/* Disable to prevent the target disabling stuff we need. */
return -TARGET_EINVAL;
--
2.25.1
- [PATCH v2 32/55] target/s390x: Use MO_128 for 16 byte atomics, (continued)
- [PATCH v2 32/55] target/s390x: Use MO_128 for 16 byte atomics, Richard Henderson, 2021/08/03
- [PATCH v2 36/55] target/mips: Use cpu_*_data_ra for msa load/store, Richard Henderson, 2021/08/03
- [PATCH v2 40/55] target/arm: Use cpu_*_mmu instead of helper_*_mmu, Richard Henderson, 2021/08/03
- [PATCH v2 41/55] tcg: Move helper_*_mmu decls to tcg/tcg-ldst.h, Richard Henderson, 2021/08/03
- [PATCH v2 42/55] tcg: Add helper_unaligned_mmu for user-only sigbus, Richard Henderson, 2021/08/03
- [PATCH v2 43/55] tcg/i386: Support raising sigbus for user-only, Richard Henderson, 2021/08/03
- [PATCH v2 44/55] tests/tcg/multiarch: Add sigbus.c, Richard Henderson, 2021/08/03
- [PATCH v2 46/55] linux-user: Disable more prctl subcodes, Richard Henderson, 2021/08/03
- [PATCH v2 47/55] hw/core/cpu: Re-sort the non-pointers to the end of CPUClass, Richard Henderson, 2021/08/03
- [PATCH v2 45/55] linux-user: Split out do_prctl and subroutines, Richard Henderson, 2021/08/03
- [PATCH v2 48/55] linux-user: Add code for PR_GET/SET_UNALIGN,
Richard Henderson <=
- [PATCH v2 49/55] hw/core/cpu: Move cpu properties to cpu-sysemu.c, Richard Henderson, 2021/08/03
- [PATCH v2 50/55] hw/core/cpu: Add prctl-unalign-sigbus property for user-only, Richard Henderson, 2021/08/03
- [PATCH v2 51/55] target/alpha: Reorg fp memory operations, Richard Henderson, 2021/08/03
- [PATCH v2 52/55] target/alpha: Reorg integer memory operations, Richard Henderson, 2021/08/03
- [PATCH v2 53/55] target/alpha: Implement prctl_unalign_sigbus, Richard Henderson, 2021/08/03
- [PATCH v2 54/55] target/hppa: Implement prctl_unalign_sigbus, Richard Henderson, 2021/08/03
- [PATCH v2 55/55] target/sh4: Implement prctl_unalign_sigbus, Richard Henderson, 2021/08/03