subr_syscall.c (177091) | subr_syscall.c (177471) |
---|---|
1/*- 2 * Copyright (C) 1994, David Greenman 3 * Copyright (c) 1990, 1993 4 * The Regents of the University of California. All rights reserved. 5 * Copyright (c) 2007 The FreeBSD Foundation 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the University of Utah, and William Jolitz. --- 28 unchanged lines hidden (view full) --- 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 42 */ 43 44#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 * Copyright (c) 2007 The FreeBSD Foundation 6 * 7 * This code is derived from software contributed to Berkeley by 8 * the University of Utah, and William Jolitz. --- 28 unchanged lines hidden (view full) --- 37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39 * SUCH DAMAGE. 40 * 41 * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 42 */ 43 44#include <sys/cdefs.h> |
45__FBSDID("$FreeBSD: head/sys/kern/subr_trap.c 177091 2008-03-12 10:12:01Z jeff $"); | 45__FBSDID("$FreeBSD: head/sys/kern/subr_trap.c 177471 2008-03-21 08:23:25Z jeff $"); |
46 47#include "opt_hwpmc_hooks.h" 48#include "opt_ktrace.h" 49#include "opt_mac.h" 50#ifdef __i386__ 51#include "opt_npx.h" 52#endif 53#include "opt_sched.h" --- 37 unchanged lines hidden (view full) --- 91 PROC_LOCK(p); 92 thread_lock(td); 93 if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 || 94 (td->td_flags & TDF_ASTPENDING) == 0)) 95 printf("failed to set signal flags properly for ast()\n"); 96 thread_unlock(td); 97 PROC_UNLOCK(p); 98#endif | 46 47#include "opt_hwpmc_hooks.h" 48#include "opt_ktrace.h" 49#include "opt_mac.h" 50#ifdef __i386__ 51#include "opt_npx.h" 52#endif 53#include "opt_sched.h" --- 37 unchanged lines hidden (view full) --- 91 PROC_LOCK(p); 92 thread_lock(td); 93 if (SIGPENDING(td) && ((td->td_flags & TDF_NEEDSIGCHK) == 0 || 94 (td->td_flags & TDF_ASTPENDING) == 0)) 95 printf("failed to set signal flags properly for ast()\n"); 96 thread_unlock(td); 97 PROC_UNLOCK(p); 98#endif |
99 | |
100#ifdef KTRACE 101 KTRUSERRET(td); 102#endif | 99#ifdef KTRACE 100 KTRUSERRET(td); 101#endif |
103 | |
104 /* 105 * If this thread tickled GEOM, we need to wait for the giggling to 106 * stop before we return to userland 107 */ 108 if (td->td_pflags & TDP_GEOM) 109 g_waitidle(); 110 111 /* | 102 /* 103 * If this thread tickled GEOM, we need to wait for the giggling to 104 * stop before we return to userland 105 */ 106 if (td->td_pflags & TDP_GEOM) 107 g_waitidle(); 108 109 /* |
112 * We need to check to see if we have to exit or wait due to a 113 * single threading requirement or some other STOP condition. 114 * Don't bother doing all the work if the stop bits are not set 115 * at this time.. If we miss it, we miss it.. no big deal. 116 */ 117 if (P_SHOULDSTOP(p)) { 118 PROC_LOCK(p); 119 thread_suspend_check(0); /* Can suspend or kill */ 120 PROC_UNLOCK(p); 121 } 122 /* | |
123 * Charge system time if profiling. 124 */ 125 if (p->p_flag & P_PROFIL) { | 110 * Charge system time if profiling. 111 */ 112 if (p->p_flag & P_PROFIL) { |
126 | |
127 addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); 128 } 129 /* 130 * Let the scheduler adjust our priority etc. 131 */ 132 sched_userret(td); 133 KASSERT(td->td_locks == 0, 134 ("userret: Returning with %d locks held.", td->td_locks)); --- 32 unchanged lines hidden (view full) --- 167 * This updates the td_flag's for the checks below in one 168 * "atomic" operation with turning off the astpending flag. 169 * If another AST is triggered while we are handling the 170 * AST's saved in flags, the astpending flag will be set and 171 * ast() will be called again. 172 */ 173 thread_lock(td); 174 flags = td->td_flags; | 113 addupc_task(td, TRAPF_PC(frame), td->td_pticks * psratio); 114 } 115 /* 116 * Let the scheduler adjust our priority etc. 117 */ 118 sched_userret(td); 119 KASSERT(td->td_locks == 0, 120 ("userret: Returning with %d locks held.", td->td_locks)); --- 32 unchanged lines hidden (view full) --- 153 * This updates the td_flag's for the checks below in one 154 * "atomic" operation with turning off the astpending flag. 155 * If another AST is triggered while we are handling the 156 * AST's saved in flags, the astpending flag will be set and 157 * ast() will be called again. 158 */ 159 thread_lock(td); 160 flags = td->td_flags; |
175 td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK | 176 TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | 177 TDF_MACPEND); | 161 td->td_flags &= ~(TDF_ASTPENDING | TDF_NEEDSIGCHK | TDF_NEEDSUSPCHK | 162 TDF_NEEDRESCHED | TDF_ALRMPEND | TDF_PROFPEND | TDF_MACPEND); |
178 thread_unlock(td); 179 PCPU_INC(cnt.v_trap); 180 181 if (td->td_ucred != p->p_ucred) 182 cred_update_thread(td); 183 if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) { 184 addupc_task(td, td->td_profil_addr, td->td_profil_ticks); 185 td->td_profil_ticks = 0; --- 51 unchanged lines hidden (view full) --- 237 if (flags & TDF_NEEDSIGCHK) { 238 PROC_LOCK(p); 239 mtx_lock(&p->p_sigacts->ps_mtx); 240 while ((sig = cursig(td)) != 0) 241 postsig(sig); 242 mtx_unlock(&p->p_sigacts->ps_mtx); 243 PROC_UNLOCK(p); 244 } | 163 thread_unlock(td); 164 PCPU_INC(cnt.v_trap); 165 166 if (td->td_ucred != p->p_ucred) 167 cred_update_thread(td); 168 if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) { 169 addupc_task(td, td->td_profil_addr, td->td_profil_ticks); 170 td->td_profil_ticks = 0; --- 51 unchanged lines hidden (view full) --- 222 if (flags & TDF_NEEDSIGCHK) { 223 PROC_LOCK(p); 224 mtx_lock(&p->p_sigacts->ps_mtx); 225 while ((sig = cursig(td)) != 0) 226 postsig(sig); 227 mtx_unlock(&p->p_sigacts->ps_mtx); 228 PROC_UNLOCK(p); 229 } |
230 /* 231 * We need to check to see if we have to exit or wait due to a 232 * single threading requirement or some other STOP condition. 233 */ 234 if (flags & TDF_NEEDSUSPCHK) { 235 PROC_LOCK(p); 236 thread_suspend_check(0); 237 PROC_UNLOCK(p); 238 } |
|
245 246 userret(td, framep); 247 mtx_assert(&Giant, MA_NOTOWNED); 248} | 239 240 userret(td, framep); 241 mtx_assert(&Giant, MA_NOTOWNED); 242} |