Exemplo n.º 1
0
/** System shutdown thread.
 * @param _action	Action to perform once the system has been shut down.
 * @param arg2		Unused. */
static void shutdown_thread_entry(void *_action, void *arg2) {
	int action = (int)((ptr_t)_action);

	thread_wire(curr_thread);
	thread_disable_preempt();

	kprintf(LOG_NOTICE, "system: terminating all processes...\n");
	process_shutdown();
	kprintf(LOG_NOTICE, "system: unmounting filesystems...\n");
	fs_shutdown();
	#if CONFIG_SMP
	kprintf(LOG_NOTICE, "system: shutting down other CPUs...\n");
	smp_call_broadcast(shutdown_call_func, NULL, 0);
	#endif

	switch(action) {
	case SHUTDOWN_REBOOT:
		kprintf(LOG_NOTICE, "system: rebooting...\n");
		platform_reboot();
		break;
	case SHUTDOWN_POWEROFF:
		kprintf(LOG_NOTICE, "system: powering off...\n");
		platform_poweroff();
		break;
	}

	kprintf(LOG_NOTICE, "system: halted.\n");
	arch_cpu_halt();
}
Exemplo n.º 2
0
/** Power off the system. */
void platform_poweroff(void) {
	/* TODO. */
	arch_cpu_halt();
}
Exemplo n.º 3
0
/** SMP call handler to halt a CPU. */
static status_t shutdown_call_func(void *data) {
	smp_call_acknowledge(STATUS_SUCCESS);
	arch_cpu_halt();
}