FreeBSD/sys/x86/x86/mp_x86.c
/*
 * Handle an IPI_SUSPEND by saving our current context and spinning until we
 * are resumed.
 */
Handle an IPI_SUSPEND by saving our current context and spinning until we
are resumed.
Handle an IPI_SUSPEND by saving our current context and spinning until we are resumed .
void
cpususpend_handler(void)
{
	u_int cpu;
	mtx_assert(&smp_ipi_mtx, MA_NOTOWNED);
	cpu = PCPU_GET(cpuid);
	if (savectx(&susppcbs[cpu]->sp_pcb)) {
#ifdef __amd64__
		fpususpend(susppcbs[cpu]->sp_fpususpend);
#else
		npxsuspend(susppcbs[cpu]->sp_fpususpend);
#endif
		wbinvd();
		CPU_SET_ATOMIC(cpu, &suspended_cpus);
	} else {
#ifdef __amd64__
		fpuresume(susppcbs[cpu]->sp_fpususpend);
#else
		npxresume(susppcbs[cpu]->sp_fpususpend);
#endif
		pmap_init_pat();
		initializecpu();
		PCPU_SET(switchtime, 0);
		PCPU_SET(switchticks, ticks);
		CPU_CLR_ATOMIC(cpu, &suspended_cpus);
	}
	while (!CPU_ISSET(cpu, &started_cpus))
		ia32_pause();
	if (cpu_ops.cpu_resume)
		cpu_ops.cpu_resume();
#ifdef __amd64__
	if (vmm_resume_p)
		vmm_resume_p();
#endif
	lapic_xapic_mode();
	mca_resume();
	lapic_setup(0);
	CPU_CLR_ATOMIC(cpu, &suspended_cpus);
	CPU_CLR_ATOMIC(cpu, &started_cpus);
}
void cpususpend_handler ( void ) { u_int cpu ; mtx_assert ( & smp_ipi_mtx , MA_NOTOWNED ) ; cpu = PCPU_GET ( cpuid ) ; if ( savectx ( & susppcbs [ cpu ] -> sp_pcb ) ) { #ifdef __amd64__ fpususpend ( susppcbs [ cpu ] -> sp_fpususpend ) ; #else npxsuspend ( susppcbs [ cpu ] -> sp_fpususpend ) ; #endif wbinvd ( ) ; CPU_SET_ATOMIC ( cpu , & suspended_cpus ) ; } else { #ifdef __amd64__ fpuresume ( susppcbs [ cpu ] -> sp_fpususpend ) ; #else npxresume ( susppcbs [ cpu ] -> sp_fpususpend ) ; #endif pmap_init_pat ( ) ; initializecpu ( ) ; PCPU_SET ( switchtime , 0 ) ; PCPU_SET ( switchticks , ticks ) ; CPU_CLR_ATOMIC ( cpu , & suspended_cpus ) ; } while ( ! CPU_ISSET ( cpu , & started_cpus ) ) ia32_pause ( ) ; if ( cpu_ops . cpu_resume ) cpu_ops . cpu_resume ( ) ; #ifdef __amd64__ if ( vmm_resume_p ) vmm_resume_p ( ) ; #endif lapic_xapic_mode ( ) ; mca_resume ( ) ; lapic_setup ( 0 ) ; CPU_CLR_ATOMIC ( cpu , & suspended_cpus ) ; CPU_CLR_ATOMIC ( cpu , & started_cpus ) ; }
Handle an IPI_SUSPEND by saving our current context and spinning until we
 are resumed.
Handle an IPI_SUSPEND by saving our current context and spinning until we are resumed .
/* Indicate that we are resumed */ /* Wait for resume */ /* Resume MCA and local APIC */ /* Indicate that we are resumed */