summaryrefslogtreecommitdiff
path: root/user-exec.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2016-07-26 06:09:16 +0530
committerRichard Henderson <rth@twiddle.net>2016-09-16 08:12:11 -0700
commit01ecaf438b1eb46abe23392c8ce5b7628b0c8cf5 (patch)
tree8d5d6d640cb0994345a508213f716b08708b171e /user-exec.c
parent85aa80813dd9f5c1f581c743e45678a3bee220f8 (diff)
downloadqemu-01ecaf438b1eb46abe23392c8ce5b7628b0c8cf5.zip
tcg: Merge GETPC and GETRA
The return address argument to the softmmu template helpers was confused. In the legacy case, we wanted to indicate that there is no return address, and so passed in NULL. However, we then immediately subtracted GETPC_ADJ from NULL, resulting in a non-zero value, indicating the presence of an (invalid) return address. Push the GETPC_ADJ subtraction down to the only point it's required: immediately before use within cpu_restore_state_from_tb, after all NULL pointer checks have been completed. This makes GETPC and GETRA identical. Remove GETRA as the lesser used macro, replacing all uses with GETPC. Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'user-exec.c')
-rw-r--r--user-exec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/user-exec.c b/user-exec.c
index 95f9f97c5c..6db075884d 100644
--- a/user-exec.c
+++ b/user-exec.c
@@ -105,8 +105,11 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
if (ret == 0) {
return 1; /* the MMU fault was handled without causing real CPU fault */
}
- /* now we have a real cpu fault */
- cpu_restore_state(cpu, pc);
+
+ /* Now we have a real cpu fault. Since this is the exact location of
+ * the exception, we must undo the adjustment done by cpu_restore_state
+ * for handling call return addresses. */
+ cpu_restore_state(cpu, pc + GETPC_ADJ);
sigprocmask(SIG_SETMASK, old_set, NULL);
cpu_loop_exit(cpu);