aboutsummaryrefslogtreecommitdiff
path: root/linux-user/sparc
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2021-04-25 19:53:33 -0700
committerLaurent Vivier <laurent@vivier.eu>2021-05-15 21:43:23 +0200
commitbb3347f80f98df3935d7018a74a6dd777f2849fa (patch)
treea70eb10212a324865f85e7282db09d5cfdd432be /linux-user/sparc
parente76f2f847d6e09e948ccb74657567535c5dfa398 (diff)
downloadqemu-bb3347f80f98df3935d7018a74a6dd777f2849fa.zip
qemu-bb3347f80f98df3935d7018a74a6dd777f2849fa.tar.gz
qemu-bb3347f80f98df3935d7018a74a6dd777f2849fa.tar.bz2
linux-user/sparc: Implement sparc64 rt signals
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20210426025334.1168495-25-richard.henderson@linaro.org> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Diffstat (limited to 'linux-user/sparc')
-rw-r--r--linux-user/sparc/signal.c27
-rw-r--r--linux-user/sparc/target_signal.h2
2 files changed, 28 insertions, 1 deletions
diff --git a/linux-user/sparc/signal.c b/linux-user/sparc/signal.c
index 362993d..0cc3db5 100644
--- a/linux-user/sparc/signal.c
+++ b/linux-user/sparc/signal.c
@@ -61,6 +61,7 @@ struct target_siginfo_fpu {
#endif
};
+#ifdef TARGET_ARCH_HAS_SETUP_FRAME
struct target_signal_frame {
struct target_stackf ss;
struct target_pt_regs regs;
@@ -71,16 +72,23 @@ struct target_signal_frame {
abi_ulong extra_size; /* Should be 0 */
abi_ulong rwin_save;
};
+#endif
struct target_rt_signal_frame {
struct target_stackf ss;
target_siginfo_t info;
struct target_pt_regs regs;
+#if defined(TARGET_SPARC64) && !defined(TARGET_ABI32)
+ abi_ulong fpu_save;
+ target_stack_t stack;
+ target_sigset_t mask;
+#else
target_sigset_t mask;
abi_ulong fpu_save;
uint32_t insns[2];
target_stack_t stack;
abi_ulong extra_size; /* Should be 0 */
+#endif
abi_ulong rwin_save;
};
@@ -232,6 +240,7 @@ static void restore_fpu(struct target_siginfo_fpu *fpu, CPUSPARCState *env)
#endif
}
+#ifdef TARGET_ARCH_HAS_SETUP_FRAME
void setup_frame(int sig, struct target_sigaction *ka,
target_sigset_t *set, CPUSPARCState *env)
{
@@ -291,6 +300,7 @@ void setup_frame(int sig, struct target_sigaction *ka,
}
unlock_user(sf, sf_addr, sf_size);
}
+#endif /* TARGET_ARCH_HAS_SETUP_FRAME */
void setup_rt_frame(int sig, struct target_sigaction *ka,
target_siginfo_t *info,
@@ -322,21 +332,28 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
tswap_sigset(&sf->mask, set);
target_save_altstack(&sf->stack, env);
+#ifdef TARGET_ABI32
__put_user(0, &sf->extra_size);
+#endif
/* 3. signal handler back-trampoline and parameters */
- env->regwptr[WREG_SP] = sf_addr;
+ env->regwptr[WREG_SP] = sf_addr - TARGET_STACK_BIAS;
env->regwptr[WREG_O0] = sig;
env->regwptr[WREG_O1] =
sf_addr + offsetof(struct target_rt_signal_frame, info);
+#ifdef TARGET_ABI32
env->regwptr[WREG_O2] =
sf_addr + offsetof(struct target_rt_signal_frame, regs);
+#else
+ env->regwptr[WREG_O2] = env->regwptr[WREG_O1];
+#endif
/* 4. signal handler */
env->pc = ka->_sa_handler;
env->npc = env->pc + 4;
/* 5. return to kernel instructions */
+#ifdef TARGET_ABI32
if (ka->ka_restorer) {
env->regwptr[WREG_O7] = ka->ka_restorer;
} else {
@@ -348,11 +365,16 @@ void setup_rt_frame(int sig, struct target_sigaction *ka,
/* t 0x10 */
__put_user(0x91d02010u, &sf->insns[1]);
}
+#else
+ env->regwptr[WREG_O7] = ka->ka_restorer;
+#endif
+
unlock_user(sf, sf_addr, sf_size);
}
long do_sigreturn(CPUSPARCState *env)
{
+#ifdef TARGET_ARCH_HAS_SETUP_FRAME
abi_ulong sf_addr;
struct target_signal_frame *sf = NULL;
abi_ulong pc, npc, ptr;
@@ -416,6 +438,9 @@ long do_sigreturn(CPUSPARCState *env)
unlock_user_struct(sf, sf_addr, 0);
force_sig(TARGET_SIGSEGV);
return -TARGET_QEMU_ESIGRETURN;
+#else
+ return -TARGET_ENOSYS;
+#endif
}
long do_rt_sigreturn(CPUSPARCState *env)
diff --git a/linux-user/sparc/target_signal.h b/linux-user/sparc/target_signal.h
index 911a3f5..34f9a12 100644
--- a/linux-user/sparc/target_signal.h
+++ b/linux-user/sparc/target_signal.h
@@ -67,7 +67,9 @@ typedef struct target_sigaltstack {
#define TARGET_MINSIGSTKSZ 4096
#define TARGET_SIGSTKSZ 16384
+#ifdef TARGET_ABI32
#define TARGET_ARCH_HAS_SETUP_FRAME
+#endif
/* bit-flags */
#define TARGET_SS_AUTODISARM (1U << 31) /* disable sas during sighandling */