コード例 #1
0
ファイル: exit.cpp プロジェクト: AnnikaH/IncludeOS
static long sys_exit(int status)
{
  const std::string msg = "Service exited with status " + std::to_string(status) + "\n";
  OS::print(msg.data(), msg.size());
  __arch_poweroff();
  __builtin_unreachable();
}
コード例 #2
0
void panic_epilogue(const char* why)
{
  // Call custom on panic handler (if present).
  if (panic_handler != nullptr) {
    // Avoid recursion if the panic handler results in panic
    auto final_action = panic_handler;
    panic_handler = nullptr;
    final_action(why);
  }

#if defined(ARCH_x86)
  SMP::global_lock();
  // Signal End-Of-Transmission
  kprint("\x04");
  SMP::global_unlock();

#else
#warning "panic() handler not implemented for selected arch"
#endif

  switch (OS::panic_action())
  {
  case OS::Panic_action::halt:
    while (1) OS::halt();
  case OS::Panic_action::shutdown:
    extern void __arch_poweroff();
    __arch_poweroff();
  case OS::Panic_action::reboot:
  default:
    OS::reboot();
  }

  __builtin_unreachable();
}
コード例 #3
0
ファイル: os.cpp プロジェクト: RicoAntonioFelix/IncludeOS
void OS::event_loop()
{
  Events::get(0).process_events();
  do {
    OS::halt();
    Events::get(0).process_events();
  } while (power_);

  MYINFO("Stopping service");
  Service::stop();

  MYINFO("Powering off");
  extern void __arch_poweroff();
  __arch_poweroff();
}
コード例 #4
0
// Shutdown the machine when one of the exit functions are called
void default_exit() {
  __arch_poweroff();
  __builtin_unreachable();
}