[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/7] linux-user/nios2: Adjust error return
From: |
Richard Henderson |
Subject: |
[PATCH 3/7] linux-user/nios2: Adjust error return |
Date: |
Sun, 20 Mar 2022 09:00:05 -0700 |
Follow syscall_set_return_value rather than the kernel assembly
in setting the syscall return values. Only negate ret on error.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
linux-user/nios2/cpu_loop.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c
index ac71f4ee47..2ae94f4a95 100644
--- a/linux-user/nios2/cpu_loop.c
+++ b/linux-user/nios2/cpu_loop.c
@@ -48,9 +48,18 @@ void cpu_loop(CPUNios2State *env)
env->regs[7], env->regs[8], env->regs[9],
0, 0);
- env->regs[2] = abs(ret);
- /* Return value is 0..4096 */
- env->regs[7] = ret > 0xfffff000u;
+ /*
+ * See syscall_set_return_value.
+ * Use the QEMU traditional -515 error indication in
+ * preference to the < 0 indication used in entry.S.
+ */
+ if (ret > (abi_ulong)-515) {
+ env->regs[2] = -ret;
+ env->regs[7] = 1;
+ } else {
+ env->regs[2] = ret;
+ env->regs[7] = 0;
+ }
break;
case 1:
--
2.25.1
- [PATCH 0/7] linux-user/nios2: Fix clone and sigreturn, Richard Henderson, 2022/03/20
- [PATCH 7/7] tests/tcg/nios2: Re-enable linux-user tests, Richard Henderson, 2022/03/20
- [PATCH 4/7] linux-user/nios2: Handle special qemu syscall return values, Richard Henderson, 2022/03/20
- [PATCH 5/7] linux-user/nios2: Remove do_sigreturn, Richard Henderson, 2022/03/20
- [PATCH 1/7] linux-user/nios2: Fix clone child return, Richard Henderson, 2022/03/20