1// Copyright 2016 The Fuchsia Authors 2// Copyright (c) 2012 Google, Inc. 3// 4// Use of this source code is governed by a MIT-style 5// license that can be found in the LICENSE file or at 6// https://opensource.org/licenses/MIT 7 8#include <debug.h> 9#include <err.h> 10#include <kernel/thread.h> 11#include <lib/console.h> 12#include <platform.h> 13#include <platform/debug.h> 14#include <stdio.h> 15#include <zircon/compiler.h> 16 17/* 18 * default implementations of these routines, if the platform code 19 * chooses not to implement. 20 */ 21__WEAK void platform_halt(platform_halt_action suggested_action, 22 platform_halt_reason reason) { 23 24 thread_print_current_backtrace(); 25 26#if ENABLE_PANIC_SHELL 27 if (reason == HALT_REASON_SW_PANIC) { 28 dprintf(ALWAYS, "CRASH: starting debug shell... (reason = %d)\n", reason); 29 arch_disable_ints(); 30 panic_shell_start(); 31 } 32#endif // ENABLE_PANIC_SHELL 33 34 dprintf(ALWAYS, "HALT: spinning forever... (reason = %d)\n", reason); 35 arch_disable_ints(); 36 for (;;) { 37 } 38} 39 40__WEAK void platform_halt_cpu() { 41} 42 43__WEAK void platform_halt_secondary_cpus() { 44 PANIC_UNIMPLEMENTED; 45} 46