summaryrefslogtreecommitdiffstats
path: root/sys/amd64/ia32/ia32_signal.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2004-01-03 02:02:26 +0000
committerdavidxu <davidxu@FreeBSD.org>2004-01-03 02:02:26 +0000
commitf39653dda8a5ba30d080c073e76f4065a6bf4b48 (patch)
tree14d49d69e2829a6224271d42946d9bec5a5f9ada /sys/amd64/ia32/ia32_signal.c
parent5b9bbee08a34c013ab6b7b6432dd37835012f868 (diff)
downloadFreeBSD-src-f39653dda8a5ba30d080c073e76f4065a6bf4b48.zip
FreeBSD-src-f39653dda8a5ba30d080c073e76f4065a6bf4b48.tar.gz
Make sigaltstack as per-threaded, because per-process sigaltstack state
is useless for threaded programs, multiple threads can not share same stack. The alternative signal stack is private for thread, no lock is needed, the orignal P_ALTSTACK is now moved into td_pflags and renamed to TDP_ALTSTACK. For single thread or Linux clone() based threaded program, there is no semantic changed, because those programs only have one kernel thread in every process. Reviewed by: deischen, dfr
Diffstat (limited to 'sys/amd64/ia32/ia32_signal.c')
-rw-r--r--sys/amd64/ia32/ia32_signal.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/sys/amd64/ia32/ia32_signal.c b/sys/amd64/ia32/ia32_signal.c
index 0792309..966b826 100644
--- a/sys/amd64/ia32/ia32_signal.c
+++ b/sys/amd64/ia32/ia32_signal.c
@@ -194,9 +194,9 @@ freebsd4_ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
/* Save user context. */
bzero(&sf, sizeof(sf));
sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack.ss_sp = (uintptr_t)p->p_sigstk.ss_sp;
- sf.sf_uc.uc_stack.ss_size = p->p_sigstk.ss_size;
- sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
+ sf.sf_uc.uc_stack.ss_sp = (uintptr_t)td->td_sigstk.ss_sp;
+ sf.sf_uc.uc_stack.ss_size = td->td_sigstk.ss_size;
+ sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
@@ -220,10 +220,10 @@ freebsd4_ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
sf.sf_uc.uc_mcontext.mc_ss = regs->tf_ss;
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sfp = (struct ia32_sigframe4 *)(p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(sf));
+ sfp = (struct ia32_sigframe4 *)(td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(sf));
} else
sfp = (struct ia32_sigframe4 *)regs->tf_rsp - 1;
PROC_UNLOCK(p);
@@ -308,9 +308,9 @@ ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
/* Save user context. */
bzero(&sf, sizeof(sf));
sf.sf_uc.uc_sigmask = *mask;
- sf.sf_uc.uc_stack.ss_sp = (uintptr_t)p->p_sigstk.ss_sp;
- sf.sf_uc.uc_stack.ss_size = p->p_sigstk.ss_size;
- sf.sf_uc.uc_stack.ss_flags = (p->p_flag & P_ALTSTACK)
+ sf.sf_uc.uc_stack.ss_sp = (uintptr_t)td->td_sigstk.ss_sp;
+ sf.sf_uc.uc_stack.ss_size = td->td_sigstk.ss_size;
+ sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE;
sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0;
sf.sf_uc.uc_mcontext.mc_gs = rgs();
@@ -337,10 +337,10 @@ ia32_sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code)
fpstate_drop(td);
/* Allocate space for the signal handler context. */
- if ((p->p_flag & P_ALTSTACK) != 0 && !oonstack &&
+ if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack &&
SIGISMEMBER(psp->ps_sigonstack, sig)) {
- sp = p->p_sigstk.ss_sp +
- p->p_sigstk.ss_size - sizeof(sf);
+ sp = td->td_sigstk.ss_sp +
+ td->td_sigstk.ss_size - sizeof(sf);
} else
sp = (char *)regs->tf_rsp - sizeof(sf);
/* Align to 16 bytes. */
OpenPOWER on IntegriCloud