diff options
author | bde <bde@FreeBSD.org> | 2001-02-19 04:15:59 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2001-02-19 04:15:59 +0000 |
commit | 49ef1aaa13c43ce23bf5d856364d1178c713f50c (patch) | |
tree | 219c776d96f8d73df01532ba4edd707494dd09e7 | |
parent | 36f2d71ceca8d0445030141a65266e670dbf66bb (diff) | |
download | FreeBSD-src-49ef1aaa13c43ce23bf5d856364d1178c713f50c.zip FreeBSD-src-49ef1aaa13c43ce23bf5d856364d1178c713f50c.tar.gz |
Changed the aston() family to operate on a specified process instead of
always on curproc. This is needed to implement signal delivery properly
(see a future log message for kern_sig.c).
Debogotified the definition of aston(). aston() was defined in terms
of signotify() (perhaps because only the latter already operated on
a specified process), but aston() is the primitive.
Similar changes are needed in the ia64 versions of cpu.h and trap.c.
I didn't make them because the ia64 is missing the prerequisite changes
to make astpending and need_resched per-process and those changes are
too large to make without testing.
-rw-r--r-- | sys/alpha/alpha/trap.c | 4 | ||||
-rw-r--r-- | sys/alpha/include/cpu.h | 2 | ||||
-rw-r--r-- | sys/amd64/amd64/trap.c | 4 | ||||
-rw-r--r-- | sys/amd64/include/cpu.h | 2 | ||||
-rw-r--r-- | sys/i386/i386/trap.c | 4 | ||||
-rw-r--r-- | sys/i386/include/cpu.h | 2 | ||||
-rw-r--r-- | sys/kern/kern_clock.c | 4 | ||||
-rw-r--r-- | sys/kern/subr_trap.c | 4 | ||||
-rw-r--r-- | sys/sys/proc.h | 18 |
9 files changed, 24 insertions, 20 deletions
diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index eb9bc06..0bc7354 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -773,7 +773,7 @@ ast(framep) * acquiring and releasing mutexes in assembly is not fun. */ mtx_lock_spin(&sched_lock); - if (!(astpending() || resched_wanted())) { + if (!(astpending(p) || resched_wanted())) { mtx_unlock_spin(&sched_lock); return; } @@ -781,7 +781,7 @@ ast(framep) sticks = p->p_sticks; p->p_md.md_tf = framep; - astoff(); + astoff(p); cnt.v_soft++; mtx_intr_enable(&sched_lock); if (p->p_sflag & PS_OWEUPC) { diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index 3e0696f..798f8dd 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -80,7 +80,7 @@ struct clockframe { #define need_proftick(p) do { \ mtx_lock_spin(&sched_lock); \ (p)->p_sflag |= PS_OWEUPC; \ - aston(); \ + aston(p); \ mtx_unlock_spin(&sched_lock); \ } while (0) diff --git a/sys/amd64/amd64/trap.c b/sys/amd64/amd64/trap.c index 4a89c39..f778666 100644 --- a/sys/amd64/amd64/trap.c +++ b/sys/amd64/amd64/trap.c @@ -1285,14 +1285,14 @@ ast(frame) * acquiring and releasing mutexes in assembly is not fun. */ mtx_lock_spin(&sched_lock); - if (!(astpending() || resched_wanted())) { + if (!(astpending(p) || resched_wanted())) { mtx_unlock_spin(&sched_lock); return; } sticks = p->p_sticks; - astoff(); + astoff(p); mtx_intr_enable(&sched_lock); atomic_add_int(&cnt.v_soft, 1); if (p->p_sflag & PS_OWEUPC) { diff --git a/sys/amd64/include/cpu.h b/sys/amd64/include/cpu.h index 9ecc87a..74f21b9 100644 --- a/sys/amd64/include/cpu.h +++ b/sys/amd64/include/cpu.h @@ -79,7 +79,7 @@ #define need_proftick(p) do { \ mtx_lock_spin(&sched_lock); \ (p)->p_sflag |= PS_OWEUPC; \ - aston(); \ + aston(p); \ mtx_unlock_spin(&sched_lock); \ } while (0) diff --git a/sys/i386/i386/trap.c b/sys/i386/i386/trap.c index 4a89c39..f778666 100644 --- a/sys/i386/i386/trap.c +++ b/sys/i386/i386/trap.c @@ -1285,14 +1285,14 @@ ast(frame) * acquiring and releasing mutexes in assembly is not fun. */ mtx_lock_spin(&sched_lock); - if (!(astpending() || resched_wanted())) { + if (!(astpending(p) || resched_wanted())) { mtx_unlock_spin(&sched_lock); return; } sticks = p->p_sticks; - astoff(); + astoff(p); mtx_intr_enable(&sched_lock); atomic_add_int(&cnt.v_soft, 1); if (p->p_sflag & PS_OWEUPC) { diff --git a/sys/i386/include/cpu.h b/sys/i386/include/cpu.h index 9ecc87a..74f21b9 100644 --- a/sys/i386/include/cpu.h +++ b/sys/i386/include/cpu.h @@ -79,7 +79,7 @@ #define need_proftick(p) do { \ mtx_lock_spin(&sched_lock); \ (p)->p_sflag |= PS_OWEUPC; \ - aston(); \ + aston(p); \ mtx_unlock_spin(&sched_lock); \ } while (0) diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c index fb4b4a6..6e99f24 100644 --- a/sys/kern/kern_clock.c +++ b/sys/kern/kern_clock.c @@ -172,14 +172,14 @@ hardclock(frame) itimerdecr(&pstats->p_timer[ITIMER_VIRTUAL], tick) == 0) { mtx_lock_spin(&sched_lock); p->p_sflag |= PS_ALRMPEND; - aston(); + aston(p); mtx_unlock_spin(&sched_lock); } if (timevalisset(&pstats->p_timer[ITIMER_PROF].it_value) && itimerdecr(&pstats->p_timer[ITIMER_PROF], tick) == 0) { mtx_lock_spin(&sched_lock); p->p_sflag |= PS_PROFPEND; - aston(); + aston(p); mtx_unlock_spin(&sched_lock); } } diff --git a/sys/kern/subr_trap.c b/sys/kern/subr_trap.c index 4a89c39..f778666 100644 --- a/sys/kern/subr_trap.c +++ b/sys/kern/subr_trap.c @@ -1285,14 +1285,14 @@ ast(frame) * acquiring and releasing mutexes in assembly is not fun. */ mtx_lock_spin(&sched_lock); - if (!(astpending() || resched_wanted())) { + if (!(astpending(p) || resched_wanted())) { mtx_unlock_spin(&sched_lock); return; } sticks = p->p_sticks; - astoff(); + astoff(p); mtx_intr_enable(&sched_lock); atomic_add_int(&cnt.v_soft, 1); if (p->p_sflag & PS_OWEUPC) { diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 4beb0bc..224c5ac 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -396,22 +396,26 @@ sigonstack(size_t sp) } while (0) /* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. + * Schedule an Asynchronous System Trap (AST) on return to user mode. */ -#define aston() signotify(CURPROC) -#define signotify(p) do { \ +#define aston(p) do { \ mtx_assert(&sched_lock, MA_OWNED); \ (p)->p_sflag |= PS_ASTPENDING; \ } while (0) -#define astpending() (curproc->p_sflag & PS_ASTPENDING) +#define astpending(p) ((p)->p_sflag & PS_ASTPENDING) -#define astoff() do { \ +#define astoff(p) do { \ mtx_assert(&sched_lock, MA_OWNED); \ - CURPROC->p_sflag &= ~PS_ASTPENDING; \ + (p)->p_sflag &= ~PS_ASTPENDING; \ } while (0) +/* + * Notify the current process (p) that it has a signal pending, + * process as soon as possible. + */ +#define signotify(p) aston(p) + /* Handy macro to determine if p1 can mangle p2. */ #define PRISON_CHECK(p1, p2) \ ((p1)->p_prison == NULL || (p1)->p_prison == (p2)->p_prison) |