FreeBSD/sys/i386/i386/trap.c
/*
 * Double fault handler. Called when a fault occurs while writing
 * a frame for a trap/exception onto the stack. This usually occurs
 * when the stack overflows (such is the case with infinite recursion,
 * for example).
 *
 * XXX Note that the current PTD gets replaced by IdlePTD when the
 * task switch occurs. This means that the stack that was active at
 * the time of the double fault is not available at <kstack> unless
 * the machine was idle when the double fault occurred. The downside
 * of this is that "trace <ebp>" in ddb won't work.
 */
Double fault handler. Called when a fault occurs while writing
a frame for a trap/exception onto the stack. This usually occurs
when the stack overflows (such is the case with infinite recursion,
for example).

XXX Note that the current PTD gets replaced by IdlePTD when the
task switch occurs. This means that the stack that was active at
the time of the double fault is not available at  unless
the machine was idle when the double fault occurred. The downside
of this is that "trace " in ddb won't work.
Double fault handler . Called when a fault occurs while writing a frame for a trap / exception onto the stack . This usually occurs when the stack overflows ( such is the case with infinite recursion for example ) . XXX Note that the current PTD gets replaced by IdlePTD when the task switch occurs . This means that the stack that was active at the time of the double fault is not available at unless the machine was idle when the double fault occurred . The downside of this is that " trace " in ddb won ' t work .
void
dblfault_handler()
{
#ifdef KDTRACE_HOOKS
	if (dtrace_doubletrap_func != NULL)
		(*dtrace_doubletrap_func)();
#endif
	printf("\nFatal double fault:\n");
	printf("eip = 0x%x\n", PCPU_GET(common_tss.tss_eip));
	printf("esp = 0x%x\n", PCPU_GET(common_tss.tss_esp));
	printf("ebp = 0x%x\n", PCPU_GET(common_tss.tss_ebp));
#ifdef SMP
	printf("cpuid = %d; ", PCPU_GET(cpuid));
	printf("apic id = %02x\n", PCPU_GET(apic_id));
#endif
	panic("double fault");
}
void dblfault_handler ( ) { #ifdef KDTRACE_HOOKS if ( dtrace_doubletrap_func != NULL ) ( * dtrace_doubletrap_func ) ( ) ; #endif printf ( " \n \n " ) ; printf ( " \n " , PCPU_GET ( common_tss . tss_eip ) ) ; printf ( " \n " , PCPU_GET ( common_tss . tss_esp ) ) ; printf ( " \n " , PCPU_GET ( common_tss . tss_ebp ) ) ; #ifdef SMP printf ( " " , PCPU_GET ( cpuid ) ) ; printf ( " \n " , PCPU_GET ( apic_id ) ) ; #endif panic ( " " ) ; }
Double fault handler.
Double fault handler .
/* two separate prints in case of a trap on an unmapped page */