[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 19/38] linux-user: Set r14 on exit from microblaze
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL v2 19/38] linux-user: Set r14 on exit from microblaze syscall |
Date: |
Fri, 27 May 2016 16:00:10 +0300 |
From: Peter Maydell <address@hidden>
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>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/main.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/linux-user/main.c b/linux-user/main.c
index 4607e48..c5da418 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2983,6 +2983,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;
--
2.1.4
- [Qemu-devel] [PULL v2 11/38] linux-user: Support for restarting system calls for SH4 targets, (continued)
- [Qemu-devel] [PULL v2 11/38] linux-user: Support for restarting system calls for SH4 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 14/38] linux-user: Support for restarting system calls for OpenRISC targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 13/38] linux-user: Support for restarting system calls for UniCore32 targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 15/38] linux-user: Support for restarting system calls for M68K targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 12/38] linux-user: Support for restarting system calls for Alpha targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 17/38] linux-user: Support for restarting system calls for CRIS targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 18/38] linux-user: Support for restarting system calls for tilegx targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 23/38] linux-user: Use safe_syscall for read and write system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 20/38] linux-user: Support for restarting system calls for Microblaze targets, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 21/38] linux-user: Add debug code to exercise restarting system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 19/38] linux-user: Set r14 on exit from microblaze syscall,
riku . voipio <=
- [Qemu-devel] [PULL v2 22/38] linux-user: Provide safe_syscall for fixing races between signals and syscalls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 24/38] linux-user: Use safe_syscall for open and openat system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 25/38] linux-user: Use safe_syscall for wait system calls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 29/38] linux-user: Handle negative values in timespec conversion, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 26/38] linux-user: Use safe_syscall for execve syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 27/38] linux-user: Use safe_syscall for pselect, select syscalls, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 28/38] linux-user: Use safe_syscall for futex syscall, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 31/38] linux-user: Use g_try_malloc() in do_msgrcv(), riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 33/38] linux-user: Use direct syscalls for setuid(), etc, riku . voipio, 2016/05/27
- [Qemu-devel] [PULL v2 34/38] linux-user: arm: Remove ARM_cpsr and similar #defines, riku . voipio, 2016/05/27