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

Function cpu_reset

freebsd/x86/x86/cpu_machdep.c:428–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426#endif
427
428void
429cpu_reset(void)
430{
431#ifdef SMP
432 struct monitorbuf *mb;
433 cpuset_t map;
434 u_int cnt;
435
436 if (smp_started) {
437 map = all_cpus;
438 CPU_CLR(PCPU_GET(cpuid), &map);
439 CPU_ANDNOT(&map, &stopped_cpus);
440 if (!CPU_EMPTY(&map)) {
441 printf("cpu_reset: Stopping other CPUs\n");
442 stop_cpus(map);
443 }
444
445 if (PCPU_GET(cpuid) != 0) {
446 cpu_reset_proxyid = PCPU_GET(cpuid);
447 cpustop_restartfunc = cpu_reset_proxy;
448 cpu_reset_proxy_active = 0;
449 printf("cpu_reset: Restarting BSP\n");
450
451 /* Restart CPU #0. */
452 CPU_SETOF(0, &started_cpus);
453 mb = &pcpu_find(0)->pc_monitorbuf;
454 atomic_store_int(&mb->stop_state,
455 MONITOR_STOPSTATE_RUNNING);
456
457 cnt = 0;
458 while (cpu_reset_proxy_active == 0 && cnt < 10000000) {
459 ia32_pause();
460 cnt++; /* Wait for BSP to announce restart */
461 }
462 if (cpu_reset_proxy_active == 0) {
463 printf("cpu_reset: Failed to restart BSP\n");
464 } else {
465 cpu_reset_proxy_active = 2;
466 while (1)
467 ia32_pause();
468 /* NOTREACHED */
469 }
470 }
471
472 DELAY(1000000);
473 }
474#endif
475 cpu_reset_real();
476 /* NOTREACHED */
477}
478
479bool
480cpu_mwait_usable(void)

Callers

nothing calls this directly

Calls 6

stop_cpusFunction · 0.85
pcpu_findFunction · 0.85
cpu_reset_realFunction · 0.85
DELAYFunction · 0.70
printfFunction · 0.50
ia32_pauseFunction · 0.50

Tested by

no test coverage detected