aboutsummaryrefslogtreecommitdiff
path: root/linux-user/xtensa/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/xtensa/signal.c')
-rw-r--r--linux-user/xtensa/signal.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/linux-user/xtensa/signal.c b/linux-user/xtensa/signal.c
index 8d54ef3ae3..590f0313ff 100644
--- a/linux-user/xtensa/signal.c
+++ b/linux-user/xtensa/signal.c
@@ -134,6 +134,8 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
abi_ulong frame_addr;
struct target_rt_sigframe *frame;
uint32_t ra;
+ bool abi_call0;
+ unsigned base;
int i;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
@@ -182,20 +184,27 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
__put_user(0x00, &frame->retcode[5]);
#endif
}
- env->sregs[PS] = PS_UM | (3 << PS_RING_SHIFT);
- if (xtensa_option_enabled(env->config, XTENSA_OPTION_WINDOWED_REGISTER)) {
- env->sregs[PS] |= PS_WOE | (1 << PS_CALLINC_SHIFT);
- }
memset(env->regs, 0, sizeof(env->regs));
env->pc = ka->_sa_handler;
env->regs[1] = frame_addr;
env->sregs[WINDOW_BASE] = 0;
env->sregs[WINDOW_START] = 1;
- env->regs[4] = (ra & 0x3fffffff) | 0x40000000;
- env->regs[6] = sig;
- env->regs[7] = frame_addr + offsetof(struct target_rt_sigframe, info);
- env->regs[8] = frame_addr + offsetof(struct target_rt_sigframe, uc);
+ abi_call0 = (env->sregs[PS] & PS_WOE) == 0;
+ env->sregs[PS] = PS_UM | (3 << PS_RING_SHIFT);
+
+ if (abi_call0) {
+ base = 0;
+ env->regs[base] = ra;
+ } else {
+ env->sregs[PS] |= PS_WOE | (1 << PS_CALLINC_SHIFT);
+ base = 4;
+ env->regs[base] = (ra & 0x3fffffff) | 0x40000000;
+ }
+ env->regs[base + 2] = sig;
+ env->regs[base + 3] = frame_addr + offsetof(struct target_rt_sigframe,
+ info);
+ env->regs[base + 4] = frame_addr + offsetof(struct target_rt_sigframe, uc);
unlock_user_struct(frame, frame_addr, 1);
return;