qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 46/66] linux-user: Split out do_prctl and subroutines


From: Richard Henderson
Subject: Re: [PATCH v3 46/66] linux-user: Split out do_prctl and subroutines
Date: Thu, 19 Aug 2021 09:30:58 -1000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 8/19/21 6:06 AM, Peter Maydell wrote:
On Wed, 18 Aug 2021 at 20:39, Richard Henderson
<richard.henderson@linaro.org> wrote:

Since the prctl constants are supposed to be generic, supply
any that are not provided by the host.

Split out subroutines for PR_GET_FP_MODE, PR_SET_FP_MODE,
PR_GET_VL, PR_SET_VL, PR_RESET_KEYS, PR_SET_TAGGED_ADDR_CTRL,
PR_GET_TAGGED_ADDR_CTRL.  Return EINVAL for guests that do
not support these options rather than pass them on to the host.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
  linux-user/aarch64/target_syscall.h |  23 -
  linux-user/mips/target_syscall.h    |   6 -
  linux-user/mips64/target_syscall.h  |   6 -
  linux-user/syscall.c                | 644 ++++++++++++++++------------

+static abi_long do_prctl_get_fp_mode(CPUArchState *env)
+{
+#ifdef TARGET_MIPS
+    abi_long ret = 0;
+
+    if (env->CP0_Status & (1 << CP0St_FR)) {
+        ret |= PR_FP_MODE_FR;
+    }
+    if (env->CP0_Config5 & (1 << CP0C5_FRE)) {
+        ret |= PR_FP_MODE_FRE;
+    }
+    return ret;
+#else
+    return -TARGET_EINVAL;
+#endif
+}

If we're going to refactor the prctl code, I think it would be
better to have architecture-specific prctl handling in
linux-user/$ARCH/prctl.c files rather than lots of target ifdefs
in syscall.c...

Ok, I'll give it some more thought.

r~




reply via email to

[Prev in Thread] Current Thread [Next in Thread]