MCPcopy Create free account
hub / github.com/F-Stack/f-stack / trap

Function trap

freebsd/i386/i386/trap.c:194–720  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

192 */
193
194void
195trap(struct trapframe *frame)
196{
197 ksiginfo_t ksi;
198 struct thread *td;
199 struct proc *p;
200 int pf, signo, ucode;
201 u_int type;
202 register_t addr, dr6;
203 vm_offset_t eva;
204#ifdef POWERFAIL_NMI
205 static int lastalert = 0;
206#endif
207
208 td = curthread;
209 p = td->td_proc;
210 dr6 = 0;
211
212 VM_CNT_INC(v_trap);
213 type = frame->tf_trapno;
214
215 KASSERT((read_eflags() & PSL_I) == 0,
216 ("trap: interrupts enabled, type %d frame %p", type, frame));
217
218#ifdef SMP
219 /* Handler for NMI IPIs used for stopping CPUs. */
220 if (type == T_NMI && ipi_nmi_handler() == 0)
221 return;
222#endif /* SMP */
223
224#ifdef KDB
225 if (kdb_active) {
226 kdb_reenter();
227 return;
228 }
229#endif
230
231 if (type == T_RESERVED) {
232 trap_fatal(frame, 0);
233 return;
234 }
235
236 if (type == T_NMI) {
237#ifdef HWPMC_HOOKS
238 /*
239 * CPU PMCs interrupt using an NMI so we check for that first.
240 * If the HWPMC module is active, 'pmc_hook' will point to
241 * the function to be called. A non-zero return value from the
242 * hook means that the NMI was consumed by it and that we can
243 * return immediately.
244 */
245 if (pmc_intr != NULL &&
246 (*pmc_intr)(frame) != 0)
247 return;
248#endif
249 }
250
251 if (type == T_MCHK) {

Callers

nothing calls this directly

Calls 15

read_eflagsFunction · 0.85
ipi_nmi_handlerFunction · 0.85
kdb_reenterFunction · 0.85
mca_intrFunction · 0.85
uprintfFunction · 0.85
trap_enable_intrFunction · 0.85
thread_cow_updateFunction · 0.85
npxtrap_x87Function · 0.85
vm86_emulateFunction · 0.85
sysbeepFunction · 0.85
nmi_handle_intrFunction · 0.85
npxdnaFunction · 0.85

Tested by

no test coverage detected