qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH v2 19/28] linux-user: Set r14 on exit from microblaz


From: Peter Maydell
Subject: [Qemu-devel] [PATCH v2 19/28] linux-user: Set r14 on exit from microblaze syscall
Date: Thu, 12 May 2016 18:47:43 +0100

All syscall exits on microblaze result in r14 being equal to the
PC we return to, because the kernel syscall exit instruction "rtbd"
does this. (This is true even for sigreturn(); note that r14 is
not a userspace-usable register as the kernel may clobber it at
any point.)

Emulate the setting of r14 on exit; this isn't really a guest
visible change for valid guest code because r14 isn't reliably
observable anyway. However having the code and the comment helps
to explain why it's ok for the ERESTARTSYS handling not to undo
the changes to r14 that happen on syscall entry.

Signed-off-by: Peter Maydell <address@hidden>
---
I think this is clearer, anyway, but the counterargument is that
the guest can't reliably examine r14 anyway and so setting it
is unnecessary.
---
 linux-user/main.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/linux-user/main.c b/linux-user/main.c
index 59b8fd5..54db9bb 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2982,6 +2982,13 @@ void cpu_loop(CPUMBState *env)
                              env->regs[10],
                              0, 0);
             env->regs[3] = ret;
+            /* All syscall exits result in guest r14 being equal to the
+             * PC we return to, because the kernel syscall exit "rtbd" does
+             * this. (This is true even for sigreturn(); note that r14 is
+             * not a userspace-usable register, as the kernel may clobber it
+             * at any point.)
+             */
+            env->regs[14] = env->sregs[SR_PC];
             break;
         case EXCP_HW_EXCP:
             env->regs[17] = env->sregs[SR_PC] + 4;
-- 
1.9.1




reply via email to

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