Deleted Added
full compact
subr_syscall.c (163709) subr_syscall.c (164936)
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
38 */
39
40#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 1994, David Greenman
3 * Copyright (c) 1990, 1993
4 * The Regents of the University of California. All rights reserved.
5 *
6 * This code is derived from software contributed to Berkeley by
7 * the University of Utah, and William Jolitz.
8 *

--- 24 unchanged lines hidden (view full) ---

33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91
38 */
39
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/sys/kern/subr_trap.c 163709 2006-10-26 21:42:22Z jb $");
41__FBSDID("$FreeBSD: head/sys/kern/subr_trap.c 164936 2006-12-06 06:34:57Z julian $");
42
43#include "opt_ktrace.h"
44#include "opt_mac.h"
45#ifdef __i386__
46#include "opt_npx.h"
47#endif
48
49#include <sys/param.h>

--- 94 unchanged lines hidden (view full) ---

144 * This is relatively easy.
145 * This function will return with preemption disabled.
146 */
147void
148ast(struct trapframe *framep)
149{
150 struct thread *td;
151 struct proc *p;
42
43#include "opt_ktrace.h"
44#include "opt_mac.h"
45#ifdef __i386__
46#include "opt_npx.h"
47#endif
48
49#include <sys/param.h>

--- 94 unchanged lines hidden (view full) ---

144 * This is relatively easy.
145 * This function will return with preemption disabled.
146 */
147void
148ast(struct trapframe *framep)
149{
150 struct thread *td;
151 struct proc *p;
152#ifdef KSE
153 struct ksegrp *kg;
154#endif
155 struct rlimit rlim;
156 int sflag;
157 int flags;
158 int sig;
159#if defined(DEV_NPX) && !defined(SMP)
160 int ucode;
161 ksiginfo_t ksi;
162#endif
163
164 td = curthread;
165 p = td->td_proc;
152 struct rlimit rlim;
153 int sflag;
154 int flags;
155 int sig;
156#if defined(DEV_NPX) && !defined(SMP)
157 int ucode;
158 ksiginfo_t ksi;
159#endif
160
161 td = curthread;
162 p = td->td_proc;
166#ifdef KSE
167 kg = td->td_ksegrp;
168#endif
169
170 CTR3(KTR_SYSC, "ast: thread %p (pid %d, %s)", td, p->p_pid,
171 p->p_comm);
172 KASSERT(TRAPF_USERMODE(framep), ("ast in kernel mode"));
173 WITNESS_WARN(WARN_PANIC, NULL, "Returning to user mode");
174 mtx_assert(&Giant, MA_NOTOWNED);
175 mtx_assert(&sched_lock, MA_NOTOWNED);
176 td->td_frame = framep;

--- 22 unchanged lines hidden (view full) ---

199#endif
200 td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK |
201 TDF_NEEDRESCHED | TDF_INTERRUPT);
202 cnt.v_trap++;
203 mtx_unlock_spin(&sched_lock);
204
205 /*
206 * XXXKSE While the fact that we owe a user profiling
163
164 CTR3(KTR_SYSC, "ast: thread %p (pid %d, %s)", td, p->p_pid,
165 p->p_comm);
166 KASSERT(TRAPF_USERMODE(framep), ("ast in kernel mode"));
167 WITNESS_WARN(WARN_PANIC, NULL, "Returning to user mode");
168 mtx_assert(&Giant, MA_NOTOWNED);
169 mtx_assert(&sched_lock, MA_NOTOWNED);
170 td->td_frame = framep;

--- 22 unchanged lines hidden (view full) ---

193#endif
194 td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK |
195 TDF_NEEDRESCHED | TDF_INTERRUPT);
196 cnt.v_trap++;
197 mtx_unlock_spin(&sched_lock);
198
199 /*
200 * XXXKSE While the fact that we owe a user profiling
207 * tick is stored per KSE in this code, the statistics
201 * tick is stored per thread in this code, the statistics
208 * themselves are still stored per process.
209 * This should probably change, by which I mean that
210 * possibly the location of both might change.
211 */
212 if (td->td_ucred != p->p_ucred)
213 cred_update_thread(td);
214 if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) {
215 addupc_task(td, td->td_profil_addr, td->td_profil_ticks);

--- 43 unchanged lines hidden (view full) ---

259 mac_thread_userret(td);
260#endif
261 if (flags & TDF_NEEDRESCHED) {
262#ifdef KTRACE
263 if (KTRPOINT(td, KTR_CSW))
264 ktrcsw(1, 1);
265#endif
266 mtx_lock_spin(&sched_lock);
202 * themselves are still stored per process.
203 * This should probably change, by which I mean that
204 * possibly the location of both might change.
205 */
206 if (td->td_ucred != p->p_ucred)
207 cred_update_thread(td);
208 if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) {
209 addupc_task(td, td->td_profil_addr, td->td_profil_ticks);

--- 43 unchanged lines hidden (view full) ---

253 mac_thread_userret(td);
254#endif
255 if (flags & TDF_NEEDRESCHED) {
256#ifdef KTRACE
257 if (KTRPOINT(td, KTR_CSW))
258 ktrcsw(1, 1);
259#endif
260 mtx_lock_spin(&sched_lock);
267#ifdef KSE
268 sched_prio(td, kg->kg_user_pri);
269#else
270 sched_prio(td, td->td_user_pri);
261 sched_prio(td, td->td_user_pri);
271#endif
272 mi_switch(SW_INVOL, NULL);
273 mtx_unlock_spin(&sched_lock);
274#ifdef KTRACE
275 if (KTRPOINT(td, KTR_CSW))
276 ktrcsw(0, 1);
277#endif
278 }
279 if (flags & TDF_NEEDSIGCHK) {
280 PROC_LOCK(p);
281 mtx_lock(&p->p_sigacts->ps_mtx);
282 while ((sig = cursig(td)) != 0)
283 postsig(sig);
284 mtx_unlock(&p->p_sigacts->ps_mtx);
285 PROC_UNLOCK(p);
286 }
287
288 userret(td, framep);
289 mtx_assert(&Giant, MA_NOTOWNED);
290}
262 mi_switch(SW_INVOL, NULL);
263 mtx_unlock_spin(&sched_lock);
264#ifdef KTRACE
265 if (KTRPOINT(td, KTR_CSW))
266 ktrcsw(0, 1);
267#endif
268 }
269 if (flags & TDF_NEEDSIGCHK) {
270 PROC_LOCK(p);
271 mtx_lock(&p->p_sigacts->ps_mtx);
272 while ((sig = cursig(td)) != 0)
273 postsig(sig);
274 mtx_unlock(&p->p_sigacts->ps_mtx);
275 PROC_UNLOCK(p);
276 }
277
278 userret(td, framep);
279 mtx_assert(&Giant, MA_NOTOWNED);
280}