summaryrefslogtreecommitdiff
path: root/linux-user/signal.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r--linux-user/signal.c129
1 files changed, 76 insertions, 53 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 2a070431b..696917790 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -26,12 +26,6 @@
#include "target_signal.h"
#include "trace.h"
-static struct target_sigaltstack target_sigaltstack_used = {
- .ss_sp = 0,
- .ss_size = 0,
- .ss_flags = TARGET_SS_DISABLE,
-};
-
static struct target_sigaction sigact_table[TARGET_NSIG];
static void host_signal_handler(int host_signum, siginfo_t *info,
@@ -84,13 +78,15 @@ static uint8_t target_to_host_signal_table[_NSIG];
static inline int on_sig_stack(unsigned long sp)
{
- return (sp - target_sigaltstack_used.ss_sp
- < target_sigaltstack_used.ss_size);
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
+ return (sp - ts->sigaltstack_used.ss_sp
+ < ts->sigaltstack_used.ss_size);
}
static inline int sas_ss_flags(unsigned long sp)
{
- return (target_sigaltstack_used.ss_size == 0 ? SS_DISABLE
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
+ return (ts->sigaltstack_used.ss_size == 0 ? SS_DISABLE
: on_sig_stack(sp) ? SS_ONSTACK : 0);
}
@@ -665,12 +661,13 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp)
{
int ret;
struct target_sigaltstack oss;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* XXX: test errors */
if(uoss_addr)
{
- __put_user(target_sigaltstack_used.ss_sp, &oss.ss_sp);
- __put_user(target_sigaltstack_used.ss_size, &oss.ss_size);
+ __put_user(ts->sigaltstack_used.ss_sp, &oss.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_size, &oss.ss_size);
__put_user(sas_ss_flags(sp), &oss.ss_flags);
}
@@ -717,8 +714,8 @@ abi_long do_sigaltstack(abi_ulong uss_addr, abi_ulong uoss_addr, abi_ulong sp)
}
}
- target_sigaltstack_used.ss_sp = ss.ss_sp;
- target_sigaltstack_used.ss_size = ss.ss_size;
+ ts->sigaltstack_used.ss_sp = ss.ss_sp;
+ ts->sigaltstack_used.ss_size = ss.ss_size;
}
if (uoss_addr) {
@@ -945,13 +942,14 @@ static inline abi_ulong
get_sigframe(struct target_sigaction *ka, CPUX86State *env, size_t frame_size)
{
unsigned long esp;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* Default to using normal stack */
esp = env->regs[R_ESP];
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa_flags & TARGET_SA_ONSTACK) {
if (sas_ss_flags(esp) == 0) {
- esp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ esp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
} else {
@@ -1035,6 +1033,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
abi_ulong frame_addr, addr;
struct rt_sigframe *frame;
int i;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
@@ -1052,10 +1051,10 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
/* Create the ucontext. */
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(get_sp_from_cpustate(env)),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
setup_sigcontext(&frame->uc.tuc_mcontext, &frame->fpstate, env,
set->sig[0], frame_addr + offsetof(struct rt_sigframe, fpstate));
@@ -1366,12 +1365,13 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, CPUARMState *env)
abi_ulong sp;
sp = env->xregs[31];
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/*
* This is the X/Open sanctioned signal stack switching.
*/
if ((ka->sa_flags & TARGET_SA_ONSTACK) && !sas_ss_flags(sp)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
sp = (sp - sizeof(struct target_rt_sigframe)) & ~15;
@@ -1385,6 +1385,7 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
{
struct target_rt_sigframe *frame;
abi_ulong frame_addr, return_addr;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env);
trace_user_setup_frame(env, frame_addr);
@@ -1395,11 +1396,11 @@ static void target_setup_frame(int usig, struct target_sigaction *ka,
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp,
+ __put_user(ts->sigaltstack_used.ss_sp,
&frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(env->xregs[31]),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
target_setup_sigframe(frame, env, set);
if (ka->sa_flags & TARGET_SA_RESTORER) {
@@ -1647,12 +1648,13 @@ static inline abi_ulong
get_sigframe(struct target_sigaction *ka, CPUARMState *regs, int framesize)
{
unsigned long sp = regs->regs[13];
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/*
* This is the X/Open sanctioned signal stack switching.
*/
if ((ka->sa_flags & TARGET_SA_ONSTACK) && !sas_ss_flags(sp)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
/*
* ATPCS B01 mandates 8-byte alignment
@@ -1740,13 +1742,14 @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc,
struct target_sigaltstack stack;
int i;
abi_ulong *regspace;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* Clear all the bits of the ucontext we don't use. */
memset(uc, 0, offsetof(struct target_ucontext_v2, tuc_mcontext));
memset(&stack, 0, sizeof(stack));
- __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp);
- __put_user(target_sigaltstack_used.ss_size, &stack.ss_size);
+ __put_user(ts->sigaltstack_used.ss_sp, &stack.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_size, &stack.ss_size);
__put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags);
memcpy(&uc->tuc_stack, &stack, sizeof(stack));
@@ -1832,6 +1835,7 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka,
struct target_sigaltstack stack;
int i;
abi_ulong info_addr, uc_addr;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
trace_user_setup_rt_frame(env, frame_addr);
if (!lock_user_struct(VERIFY_WRITE, frame, frame_addr, 0)) {
@@ -1848,8 +1852,8 @@ static void setup_rt_frame_v1(int usig, struct target_sigaction *ka,
memset(&frame->uc, 0, offsetof(struct target_ucontext_v1, tuc_mcontext));
memset(&stack, 0, sizeof(stack));
- __put_user(target_sigaltstack_used.ss_sp, &stack.ss_sp);
- __put_user(target_sigaltstack_used.ss_size, &stack.ss_size);
+ __put_user(ts->sigaltstack_used.ss_sp, &stack.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_size, &stack.ss_size);
__put_user(sas_ss_flags(get_sp_from_cpustate(env)), &stack.ss_flags);
memcpy(&frame->uc.tuc_stack, &stack, sizeof(stack));
@@ -2313,14 +2317,15 @@ static inline abi_ulong get_sigframe(struct target_sigaction *sa,
unsigned long framesize)
{
abi_ulong sp;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
sp = env->regwptr[UREG_FP];
/* This is the X/Open sanctioned signal stack switching. */
if (sa->sa_flags & TARGET_SA_ONSTACK) {
if (!on_sig_stack(sp)
- && !((target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size) & 7)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ && !((ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size) & 7)) {
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
}
return sp - framesize;
@@ -2968,6 +2973,7 @@ static inline abi_ulong
get_sigframe(struct target_sigaction *ka, CPUMIPSState *regs, size_t frame_size)
{
unsigned long sp;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* Default to using normal stack */
sp = regs->active_tc.gpr[29];
@@ -2981,7 +2987,7 @@ get_sigframe(struct target_sigaction *ka, CPUMIPSState *regs, size_t frame_size)
/* This is the X/Open sanctioned signal stack switching. */
if ((ka->sa_flags & TARGET_SA_ONSTACK) && (sas_ss_flags (sp) == 0)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
return (sp - frame_size) & ~7;
@@ -3100,6 +3106,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
int i;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
@@ -3113,8 +3120,8 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
__put_user(0, &frame->rs_uc.tuc_flags);
__put_user(0, &frame->rs_uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp, &frame->rs_uc.tuc_stack.ss_sp);
- __put_user(target_sigaltstack_used.ss_size, &frame->rs_uc.tuc_stack.ss_size);
+ __put_user(ts->sigaltstack_used.ss_sp, &frame->rs_uc.tuc_stack.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_size, &frame->rs_uc.tuc_stack.ss_size);
__put_user(sas_ss_flags(get_sp_from_cpustate(env)),
&frame->rs_uc.tuc_stack.ss_flags);
@@ -3247,8 +3254,10 @@ struct target_rt_sigframe
static abi_ulong get_sigframe(struct target_sigaction *ka,
unsigned long sp, size_t frame_size)
{
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
+
if ((ka->sa_flags & TARGET_SA_ONSTACK) && (sas_ss_flags(sp) == 0)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
return (sp - frame_size) & -8ul;
@@ -3365,6 +3374,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
struct target_rt_sigframe *frame;
abi_ulong frame_addr;
int i;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, regs->gregs[15], sizeof(*frame));
trace_user_setup_rt_frame(regs, frame_addr);
@@ -3377,11 +3387,11 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
/* Create the ucontext. */
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, (unsigned long *)&frame->uc.tuc_link);
- __put_user((unsigned long)target_sigaltstack_used.ss_sp,
+ __put_user((unsigned long)ts->sigaltstack_used.ss_sp,
&frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(regs->gregs[15]),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
setup_sigcontext(&frame->uc.tuc_mcontext,
regs, set->sig[0]);
@@ -3598,9 +3608,10 @@ static abi_ulong get_sigframe(struct target_sigaction *ka,
CPUMBState *env, int frame_size)
{
abi_ulong sp = env->regs[1];
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
if ((ka->sa_flags & TARGET_SA_ONSTACK) != 0 && !on_sig_stack(sp)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
return ((sp - frame_size) & -8UL);
@@ -3985,11 +3996,12 @@ static inline abi_ulong get_sigframe(struct target_sigaction *ka,
{
unsigned long sp = regs->gpr[1];
int onsigstack = on_sig_stack(sp);
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* redzone */
/* This is the X/Open sanctioned signal stack switching. */
if ((ka->sa_flags & TARGET_SA_ONSTACK) != 0 && !onsigstack) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
sp = align_sigframe(sp - frame_size);
@@ -4015,6 +4027,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
unsigned long return_ip;
struct target_rt_sigframe *frame;
abi_ulong info_addr, uc_addr;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
@@ -4034,10 +4047,10 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
/*err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));*/
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp,
+ __put_user(ts->sigaltstack_used.ss_sp,
&frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(env->gpr[1]), &frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
setup_sigcontext(&frame->sc, env, set->sig[0]);
@@ -4156,6 +4169,7 @@ static inline abi_ulong
get_sigframe(struct target_sigaction *ka, CPUS390XState *env, size_t frame_size)
{
abi_ulong sp;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* Default to using normal stack */
sp = env->regs[15];
@@ -4163,8 +4177,8 @@ get_sigframe(struct target_sigaction *ka, CPUS390XState *env, size_t frame_size)
/* This is the X/Open sanctioned signal stack switching. */
if (ka->sa_flags & TARGET_SA_ONSTACK) {
if (!sas_ss_flags(sp)) {
- sp = target_sigaltstack_used.ss_sp +
- target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp +
+ ts->sigaltstack_used.ss_size;
}
}
@@ -4265,6 +4279,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
int i;
rt_sigframe *frame;
abi_ulong frame_addr;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof *frame);
trace_user_setup_rt_frame(env, frame_addr);
@@ -4277,10 +4292,10 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
/* Create the ucontext. */
__put_user(0, &frame->uc.tuc_flags);
__put_user((abi_ulong)0, (abi_ulong *)&frame->uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(get_sp_from_cpustate(env)),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size);
+ __put_user(ts->sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size);
save_sigregs(env, &frame->uc.tuc_mcontext);
for (i = 0; i < TARGET_NSIG_WORDS; i++) {
__put_user((abi_ulong)set->sig[i],
@@ -4574,13 +4589,14 @@ static target_ulong get_sigframe(struct target_sigaction *ka,
int frame_size)
{
target_ulong oldsp;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
oldsp = env->gpr[1];
if ((ka->sa_flags & TARGET_SA_ONSTACK) &&
(sas_ss_flags(oldsp) == 0)) {
- oldsp = (target_sigaltstack_used.ss_sp
- + target_sigaltstack_used.ss_size);
+ oldsp = (ts->sigaltstack_used.ss_sp
+ + ts->sigaltstack_used.ss_size);
}
return (oldsp - frame_size) & ~0xFUL;
@@ -4836,6 +4852,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
#if defined(TARGET_PPC64)
struct image_info *image = ((TaskState *)thread_cpu->opaque)->info;
#endif
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
rt_sf_addr = get_sigframe(ka, env, sizeof(*rt_sf));
if (!lock_user_struct(VERIFY_WRITE, rt_sf, rt_sf_addr, 1))
@@ -4845,11 +4862,11 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
__put_user(0, &rt_sf->uc.tuc_flags);
__put_user(0, &rt_sf->uc.tuc_link);
- __put_user((target_ulong)target_sigaltstack_used.ss_sp,
+ __put_user((target_ulong)ts->sigaltstack_used.ss_sp,
&rt_sf->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(env->gpr[1]),
&rt_sf->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&rt_sf->uc.tuc_stack.ss_size);
#if !defined(TARGET_PPC64)
__put_user(h2g (&rt_sf->uc.tuc_mcontext),
@@ -5109,12 +5126,13 @@ get_sigframe(struct target_sigaction *ka, CPUM68KState *regs,
size_t frame_size)
{
unsigned long sp;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
sp = regs->aregs[7];
/* This is the X/Open sanctioned signal stack switching. */
if ((ka->sa_flags & TARGET_SA_ONSTACK) && (sas_ss_flags (sp) == 0)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
return ((sp - frame_size) & -8UL);
@@ -5244,6 +5262,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
abi_ulong uc_addr;
int err = 0;
int i;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof *frame);
trace_user_setup_rt_frame(env, frame_addr);
@@ -5265,11 +5284,11 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp,
+ __put_user(ts->sigaltstack_used.ss_sp,
&frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(env->aregs[7]),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
err |= target_rt_setup_ucontext(&frame->uc, env);
@@ -5473,10 +5492,11 @@ static inline abi_ulong get_sigframe(struct target_sigaction *sa,
unsigned long framesize)
{
abi_ulong sp = env->ir[IR_SP];
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
/* This is the X/Open sanctioned signal stack switching. */
if ((sa->sa_flags & TARGET_SA_ONSTACK) != 0 && !sas_ss_flags(sp)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
return (sp - framesize) & -32;
}
@@ -5532,6 +5552,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
abi_ulong frame_addr, r26;
struct target_rt_sigframe *frame;
int i, err = 0;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
@@ -5544,11 +5565,11 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
__put_user(set->sig[0], &frame->uc.tuc_osf_sigmask);
- __put_user(target_sigaltstack_used.ss_sp,
+ __put_user(ts->sigaltstack_used.ss_sp,
&frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(env->ir[IR_SP]),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size,
+ __put_user(ts->sigaltstack_used.ss_size,
&frame->uc.tuc_stack.ss_size);
setup_sigcontext(&frame->uc.tuc_mcontext, env, frame_addr, set);
for (i = 0; i < TARGET_NSIG_WORDS; ++i) {
@@ -5703,13 +5724,14 @@ static abi_ulong get_sigframe(struct target_sigaction *ka, CPUArchState *env,
size_t frame_size)
{
unsigned long sp = env->regs[TILEGX_R_SP];
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
if (on_sig_stack(sp) && !likely(on_sig_stack(sp - frame_size))) {
return -1UL;
}
if ((ka->sa_flags & SA_ONSTACK) && !sas_ss_flags(sp)) {
- sp = target_sigaltstack_used.ss_sp + target_sigaltstack_used.ss_size;
+ sp = ts->sigaltstack_used.ss_sp + ts->sigaltstack_used.ss_size;
}
sp -= frame_size;
@@ -5724,6 +5746,7 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
abi_ulong frame_addr;
struct target_rt_sigframe *frame;
unsigned long restorer;
+ TaskState *ts = (TaskState *)thread_cpu->opaque;
frame_addr = get_sigframe(ka, env, sizeof(*frame));
trace_user_setup_rt_frame(env, frame_addr);
@@ -5743,10 +5766,10 @@ static void setup_rt_frame(int sig, struct target_sigaction *ka,
/* Create the ucontext. */
__put_user(0, &frame->uc.tuc_flags);
__put_user(0, &frame->uc.tuc_link);
- __put_user(target_sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp);
+ __put_user(ts->sigaltstack_used.ss_sp, &frame->uc.tuc_stack.ss_sp);
__put_user(sas_ss_flags(env->regs[TILEGX_R_SP]),
&frame->uc.tuc_stack.ss_flags);
- __put_user(target_sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size);
+ __put_user(ts->sigaltstack_used.ss_size, &frame->uc.tuc_stack.ss_size);
setup_sigcontext(&frame->uc.tuc_mcontext, env, info->si_signo);
if (ka->sa_flags & TARGET_SA_RESTORER) {