aboutsummaryrefslogtreecommitdiff
path: root/linux-user/m68k/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/m68k/signal.c')
-rw-r--r--linux-user/m68k/signal.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/linux-user/m68k/signal.c b/linux-user/m68k/signal.c
index 4f8eb6f727..77555781aa 100644
--- a/linux-user/m68k/signal.c
+++ b/linux-user/m68k/signal.c
@@ -39,7 +39,6 @@ struct target_sigframe
int sig;
int code;
abi_ulong psc;
- char retcode[8];
abi_ulong extramask[TARGET_NSIG_WORDS-1];
struct target_sigcontext sc;
};
@@ -76,7 +75,6 @@ struct target_rt_sigframe
int sig;
abi_ulong pinfo;
abi_ulong puc;
- char retcode[8];
struct target_siginfo info;
struct target_ucontext uc;
};
@@ -130,7 +128,6 @@ void setup_frame(int sig, struct target_sigaction *ka,
{
struct target_sigframe *frame;
abi_ulong frame_addr;
- abi_ulong retcode_addr;
abi_ulong sc_addr;
int i;
@@ -152,16 +149,7 @@ void setup_frame(int sig, struct target_sigaction *ka,
}
/* Set up to return from userspace. */
-
- retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode);
- __put_user(retcode_addr, &frame->pretcode);
-
- /* moveq #,d0; trap #0 */
-
- __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16),
- (uint32_t *)(frame->retcode));
-
- /* Set up to return from userspace */
+ __put_user(default_sigreturn, &frame->pretcode);
env->aregs[7] = frame_addr;
env->pc = ka->_sa_handler;
@@ -288,7 +276,6 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
{
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
- abi_ulong retcode_addr;
abi_ulong info_addr;
abi_ulong uc_addr;
int err = 0;
@@ -308,7 +295,7 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
uc_addr = frame_addr + offsetof(struct target_rt_sigframe, uc);
__put_user(uc_addr, &frame->puc);
- tswap_siginfo(&frame->info, info);
+ frame->info = *info;
/* Create the ucontext */
@@ -320,22 +307,12 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
if (err)
goto give_sigsegv;
- for(i = 0; i < TARGET_NSIG_WORDS; i++) {
+ for (i = 0; i < TARGET_NSIG_WORDS; i++) {
__put_user(set->sig[i], &frame->uc.tuc_sigmask.sig[i]);
}
/* Set up to return from userspace. */
-
- retcode_addr = frame_addr + offsetof(struct target_sigframe, retcode);
- __put_user(retcode_addr, &frame->pretcode);
-
- /* moveq #,d0; notb d0; trap #0 */
-
- __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16),
- (uint32_t *)(frame->retcode + 0));
- __put_user(0x4e40, (uint16_t *)(frame->retcode + 4));
-
- /* Set up to return from userspace */
+ __put_user(default_rt_sigreturn, &frame->pretcode);
env->aregs[7] = frame_addr;
env->pc = ka->_sa_handler;
@@ -376,11 +353,11 @@ long do_sigreturn(CPUM68KState *env)
restore_sigcontext(env, &frame->sc);
unlock_user_struct(frame, frame_addr, 0);
- return -TARGET_QEMU_ESIGRETURN;
+ return -QEMU_ESIGRETURN;
badframe:
force_sig(TARGET_SIGSEGV);
- return -TARGET_QEMU_ESIGRETURN;
+ return -QEMU_ESIGRETURN;
}
long do_rt_sigreturn(CPUM68KState *env)
@@ -404,10 +381,30 @@ long do_rt_sigreturn(CPUM68KState *env)
target_restore_altstack(&frame->uc.tuc_stack, env);
unlock_user_struct(frame, frame_addr, 0);
- return -TARGET_QEMU_ESIGRETURN;
+ return -QEMU_ESIGRETURN;
badframe:
unlock_user_struct(frame, frame_addr, 0);
force_sig(TARGET_SIGSEGV);
- return -TARGET_QEMU_ESIGRETURN;
+ return -QEMU_ESIGRETURN;
+}
+
+void setup_sigtramp(abi_ulong sigtramp_page)
+{
+ void *tramp = lock_user(VERIFY_WRITE, sigtramp_page, 4 + 6, 0);
+ assert(tramp != NULL);
+
+ default_sigreturn = sigtramp_page;
+
+ /* moveq #,d0; trap #0 */
+ __put_user(0x70004e40 + (TARGET_NR_sigreturn << 16), (uint32_t *)tramp);
+
+ default_rt_sigreturn = sigtramp_page + 4;
+
+ /* moveq #,d0; notb d0; trap #0 */
+ __put_user(0x70004600 + ((TARGET_NR_rt_sigreturn ^ 0xff) << 16),
+ (uint32_t *)(tramp + 4));
+ __put_user(0x4e40, (uint16_t *)(tramp + 8));
+
+ unlock_user(tramp, sigtramp_page, 4 + 6);
}