[console][panic] slight tweak to where the panic shell define is set

Tweak the default platform_halt to idle the core if fully wedged.
This commit is contained in:
Travis Geiselbrecht
2020-05-10 20:03:31 -07:00
parent 445283fd8c
commit 95cf798c83
4 changed files with 16 additions and 10 deletions

View File

@@ -29,3 +29,9 @@ void panic_shell_start(void);
extern int lastresult;
/* enable the panic shell if we're being built */
#if !defined(ENABLE_PANIC_SHELL) && PLATFORM_SUPPORTS_PANIC_SHELL
#define ENABLE_PANIC_SHELL 1
#endif

View File

@@ -8,11 +8,11 @@
#include <lk/debug.h>
#include <lk/err.h>
#include <lk/compiler.h>
#include <lk/console_cmd.h>
#include <platform.h>
#include <platform/debug.h>
#include <kernel/thread.h>
#include <stdio.h>
#include <lk/console_cmd.h>
#if WITH_LIB_CONSOLE
#include <lib/console.h>
@@ -24,19 +24,18 @@
*/
__WEAK void platform_halt(platform_halt_action suggested_action,
platform_halt_reason reason) {
#if WITH_LIB_CONSOLE && ENABLE_PANIC_SHELL
#if ENABLE_PANIC_SHELL
if (reason == HALT_REASON_SW_PANIC) {
dprintf(ALWAYS, "CRASH: starting debug shell... (reason = %d)\n", reason);
arch_disable_ints();
panic_shell_start();
}
#endif // ENABLE_PANIC_SHELL
dprintf(ALWAYS, "HALT: spinning forever... (reason = %d)\n", reason);
arch_disable_ints();
for (;;);
for (;;)
arch_idle();
}
static int cmd_reboot(int argc, const cmd_args *argv) {

View File

@@ -8,12 +8,17 @@
#include <lk/debug.h>
#include <lk/err.h>
#include <lk/compiler.h>
#include <lk/console_cmd.h>
#include <stdio.h>
#include <platform.h>
#include <platform/debug.h>
#include <arch/ops.h>
#include <arch/arm/cm.h>
#if WITH_LIB_CONSOLE
#include <lib/console.h>
#endif
void platform_halt(platform_halt_action suggested_action,
platform_halt_reason reason) {
#if ENABLE_PANIC_SHELL

View File

@@ -47,16 +47,12 @@ typedef struct _cmd_block {
*/
#if WITH_LIB_CONSOLE
/* enable the panic shell if we're being built */
#if !defined(ENABLE_PANIC_SHELL) && PLATFORM_SUPPORTS_PANIC_SHELL
#define ENABLE_PANIC_SHELL 1
#endif
#define STATIC_COMMAND_START static const cmd _cmd_list[] = {
#define STATIC_COMMAND_END(name) }; cmd_block _cmd_block_##name __ALIGNED(sizeof(void *)) __SECTION(".commands") = \
{ NULL, sizeof(_cmd_list) / sizeof(_cmd_list[0]), _cmd_list }
/* same as above but with a suffixed name to make the list unique within the file */
#define STATIC_COMMAND_START_NAMED(name) static const cmd _cmd_list_##name[] = {
#define STATIC_COMMAND_END_NAMED(name) }; cmd_block _cmd_block_##name __ALIGNED(sizeof(void *)) __SECTION(".commands") = \