zircon/kernel/platform/power.cc
// Common platform halt path.  This handles some tasks we always want to make
// sure we handle before dropping into the common platform specific halt
// routine.
Common platform halt path.  This handles some tasks we always want to make
sure we handle before dropping into the common platform specific halt
routine.
Common platform halt path . This handles some tasks we always want to make sure we handle before dropping into the common platform specific halt routine .
void platform_halt(platform_halt_action suggested_action, zircon_crash_reason_t reason) {
  platform_enable_crashlog_uptime_updates(false);
  bool halt_on_panic = gCmdline.GetBool("kernel.halt-on-panic", false);
  if (ENABLE_PANIC_SHELL || halt_on_panic) {
    hw_watchdog_set_enabled(false);
  } else {
    hw_watchdog_pet();
  }
  size_t rendered_crashlog_len = 0;
  if ((reason == ZirconCrashReason::Oom) || (reason == ZirconCrashReason::Panic)) {
    memset(crashlog_render_buffer, 0, sizeof(crashlog_render_buffer));
    rendered_crashlog_len =
        crashlog_to_string(crashlog_render_buffer, sizeof(crashlog_render_buffer), reason);
  }
  platform_stow_crashlog(reason, crashlog_render_buffer, rendered_crashlog_len);
  platform_specific_halt(suggested_action, reason, halt_on_panic);
}
void platform_halt ( platform_halt_action suggested_action , zircon_crash_reason_t reason ) { platform_enable_crashlog_uptime_updates ( false ) ; bool halt_on_panic = gCmdline . GetBool ( " " , false ) ; if ( ENABLE_PANIC_SHELL || halt_on_panic ) { hw_watchdog_set_enabled ( false ) ; } else { hw_watchdog_pet ( ) ; } size_t rendered_crashlog_len = 0 ; if ( ( reason == ZirconCrashReason :: Oom ) || ( reason == ZirconCrashReason :: Panic ) ) { memset ( crashlog_render_buffer , 0 , sizeof ( crashlog_render_buffer ) ) ; rendered_crashlog_len = crashlog_to_string ( crashlog_render_buffer , sizeof ( crashlog_render_buffer ) , reason ) ; } platform_stow_crashlog ( reason , crashlog_render_buffer , rendered_crashlog_len ) ; platform_specific_halt ( suggested_action , reason , halt_on_panic ) ; }
Common platform halt path.
Common platform halt path .
// Disable the automatic uptime updating.  We are going to attempt to // deliberately halt the system, and we don't want the crashlog to indicate a // spontaneous reboot. // We are haling on purpose.  Disable the watchdog (if we have one, and if we // can) if we plan to halt instead of instigate a reboot.  If we are going to // try to actually reboot, pet the dog one last time to give ourselves the // maximum amount to arrange our graceful reboot. // Was this an OOM or Panic condition?  If so, render the payload of our // crashlog before stowing our reason.  Then, whether we have a payload or // not, stow our final crashlog. // Finally, fall into the platform specific halt handler.