diff mbox

[29/34] linux-user: Support for restarting system calls for UniCore32 targets

Message ID 1441497448-32489-30-git-send-email-T.E.Baldwin99@members.leeds.ac.uk
State New
Headers show

Commit Message

Timothy Baldwin Sept. 5, 2015, 11:57 p.m. UTC
Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
---

WARNING - NOT TESTED

 linux-user/main.c              | 7 ++++++-
 linux-user/unicore32/syscall.h | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

Comments

Peter Maydell Sept. 10, 2015, 7:05 p.m. UTC | #1
On 6 September 2015 at 00:57, Timothy E Baldwin
<T.E.Baldwin99@members.leeds.ac.uk> wrote:
> Signed-off-by: Timothy Edward Baldwin <T.E.Baldwin99@members.leeds.ac.uk>
> ---
>
> WARNING - NOT TESTED
>
>  linux-user/main.c              | 7 ++++++-
>  linux-user/unicore32/syscall.h | 2 ++
>  2 files changed, 8 insertions(+), 1 deletion(-)

Unicore32 is teetering on the brink of being a dead target,
so I don't care much.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index d86751a..9ca1c99 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -1120,7 +1120,7 @@  void cpu_loop(CPUUniCore32State *env)
                             cpu_set_tls(env, env->regs[0]);
                             env->regs[0] = 0;
                     } else {
-                        env->regs[0] = do_syscall(env,
+                        abi_long ret = do_syscall(env,
                                                   n,
                                                   env->regs[0],
                                                   env->regs[1],
@@ -1129,6 +1129,11 @@  void cpu_loop(CPUUniCore32State *env)
                                                   env->regs[4],
                                                   env->regs[5],
                                                   0, 0);
+                        if (ret == -TARGET_ERESTARTSYS) {
+                            env->regs[31] -= 4;
+                        } else if (ret != -TARGET_QEMU_ESIGRETURN) {
+                            env->regs[0] = ret;
+                        }
                     }
                 } else {
                     goto error;
diff --git a/linux-user/unicore32/syscall.h b/linux-user/unicore32/syscall.h
index 385a975..4887d06 100644
--- a/linux-user/unicore32/syscall.h
+++ b/linux-user/unicore32/syscall.h
@@ -58,3 +58,5 @@  struct target_pt_regs {
 #define TARGET_MLOCKALL_MCL_FUTURE  2
 
 #endif /* __UC32_SYSCALL_H__ */
+
+#define TARGET_USE_ERESTARTSYS 1