diff options
author | jhb <jhb@FreeBSD.org> | 2001-01-24 10:36:47 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-01-24 10:36:47 +0000 |
commit | 9455afff84569ea4a0fa701f64690572078c9b29 (patch) | |
tree | d6e41d0061ab5cb4c5b60486f3f37f8676f465d7 /sys | |
parent | 4dc0bb19d1b977171433f7da0d91a82245b211b0 (diff) | |
download | FreeBSD-src-9455afff84569ea4a0fa701f64690572078c9b29.zip FreeBSD-src-9455afff84569ea4a0fa701f64690572078c9b29.tar.gz |
- Proc locking.
- P_FOO -> PS_FOO.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/ia64/ia64/machdep.c | 11 | ||||
-rw-r--r-- | sys/ia64/ia64/procfs_machdep.c | 26 |
2 files changed, 32 insertions, 5 deletions
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c index 85bcd0b..4b7b50e 100644 --- a/sys/ia64/ia64/machdep.c +++ b/sys/ia64/ia64/machdep.c @@ -752,11 +752,13 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) { struct proc *p = curproc; struct trapframe *frame; - struct sigacts *psp = p->p_sigacts; + struct sigacts *psp; struct sigframe sf, *sfp; u_int64_t sbs = 0; int oonstack, rndfsize; + PROC_LOCK(p); + psp = p->p_sigacts; frame = p->p_md.md_tf; oonstack = sigonstack(frame->tf_r[FRAME_SP]); rndfsize = ((sizeof(sf) + 15) / 16) * 16; @@ -818,6 +820,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) #endif } else sfp = (struct sigframe *)(frame->tf_r[FRAME_SP] - rndfsize); + PROC_UNLOCK(p); (void)grow_stack(p, (u_long)sfp); #ifdef DEBUG @@ -835,10 +838,12 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) * Process has trashed its stack; give it an illegal * instruction to halt it in its tracks. */ + PROC_LOCK(p); SIGACTION(p, SIGILL) = SIG_DFL; SIGDELSET(p->p_sigignore, SIGILL); SIGDELSET(p->p_sigcatch, SIGILL); SIGDELSET(p->p_sigmask, SIGILL); + PROC_UNLOCK(p); psignal(p, SIGILL); return; } @@ -869,6 +874,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) frame->tf_cr_ipsr &= ~IA64_PSR_RI; frame->tf_cr_iip = PS_STRINGS - (esigcode - sigcode); frame->tf_r[FRAME_R1] = sig; + PROC_LOCK(p); if (SIGISMEMBER(p->p_sigacts->ps_siginfo, sig)) { frame->tf_r[FRAME_R15] = (u_int64_t)&(sfp->sf_si); @@ -879,6 +885,7 @@ sendsig(sig_t catcher, int sig, sigset_t *mask, u_long code) } else frame->tf_r[FRAME_R15] = code; + PROC_UNLOCK(p); frame->tf_r[FRAME_SP] = (u_int64_t)sfp - 16; frame->tf_r[FRAME_R14] = sig; @@ -986,6 +993,7 @@ sigreturn(struct proc *p, frame->tf_r[FRAME_SP] = mcp->mc_sp; + PROC_LOCK(p); #if defined(COMPAT_43) || defined(COMPAT_SUNOS) if (uc.uc_mcontext.mc_onstack & 1) p->p_sigstk.ss_flags |= SS_ONSTACK; @@ -995,6 +1003,7 @@ sigreturn(struct proc *p, p->p_sigmask = uc.uc_sigmask; SIG_CANTMASK(p->p_sigmask); + PROC_UNLOCK(p); /* XXX ksc.sc_ownedfp ? */ ia64_fpstate_drop(p); diff --git a/sys/ia64/ia64/procfs_machdep.c b/sys/ia64/ia64/procfs_machdep.c index 000eb02..aae8e66 100644 --- a/sys/ia64/ia64/procfs_machdep.c +++ b/sys/ia64/ia64/procfs_machdep.c @@ -85,8 +85,13 @@ procfs_read_regs(p, regs) struct proc *p; struct reg *regs; { - if ((p->p_flag & P_INMEM) == 0) + + mtx_enter(&sched_lock, MTX_SPIN); + if ((p->p_sflag & PS_INMEM) == 0) { + mtx_exit(&sched_lock, MTX_SPIN); return (EIO); + } + mtx_exit(&sched_lock, MTX_SPIN); return (fill_regs(p, regs)); } @@ -95,8 +100,13 @@ procfs_write_regs(p, regs) struct proc *p; struct reg *regs; { - if ((p->p_flag & P_INMEM) == 0) + + mtx_enter(&sched_lock, MTX_SPIN); + if ((p->p_sflag & PS_INMEM) == 0) { + mtx_exit(&sched_lock, MTX_SPIN); return (EIO); + } + mtx_exit(&sched_lock, MTX_SPIN); return (set_regs(p, regs)); } @@ -110,7 +120,10 @@ procfs_read_fpregs(p, fpregs) struct proc *p; struct fpreg *fpregs; { - if ((p->p_flag & P_INMEM) == 0) + + mtx_enter(&sched_lock, MTX_SPIN); + if ((p->p_sflag & PS_INMEM) == 0) { + mtx_exit(&sched_lock, MTX_SPIN); return (EIO); return (fill_fpregs(p, fpregs)); } @@ -120,8 +133,13 @@ procfs_write_fpregs(p, fpregs) struct proc *p; struct fpreg *fpregs; { - if ((p->p_flag & P_INMEM) == 0) + + mtx_enter(&sched_lock, MTX_SPIN); + if ((p->p_sflag & PS_INMEM) == 0) { + mtx_exit(&sched_lock, MTX_SPIN); return (EIO); + } + mtx_exit(&sched_lock, MTX_SPIN); return (set_fpregs(p, fpregs)); } |