From 8287cfac6c611f4ca251cb508d0c4729a87f42a6 Mon Sep 17 00:00:00 2001 From: Shuo A Liu Date: Thu, 9 Apr 2020 15:40:25 +0800 Subject: [PATCH] hv: debug: reboot directly when issue 'reboot' shell cmd Tracked-On: #4817 Signed-off-by: Shuo A Liu Acked-by: Eddie Dong --- hypervisor/debug/shell.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index b90f31f25..c698bf37f 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -21,6 +21,7 @@ #include #include #include +#include #define TEMP_STR_SIZE 60U #define MAX_STR_SIZE 256U @@ -48,7 +49,7 @@ static int32_t shell_show_vioapic_info(int32_t argc, char **argv); static int32_t shell_show_ioapic_info(__unused int32_t argc, __unused char **argv); static int32_t shell_loglevel(int32_t argc, char **argv); static int32_t shell_cpuid(int32_t argc, char **argv); -static int32_t shell_trigger_crash(int32_t argc, char **argv); +static int32_t shell_reboot(int32_t argc, char **argv); static int32_t shell_rdmsr(int32_t argc, char **argv); static int32_t shell_wrmsr(int32_t argc, char **argv); @@ -141,7 +142,7 @@ static struct shell_cmd shell_cmds[] = { .str = SHELL_CMD_REBOOT, .cmd_param = SHELL_CMD_REBOOT_PARAM, .help_str = SHELL_CMD_REBOOT_HELP, - .fcn = shell_trigger_crash, + .fcn = shell_reboot, }, { .str = SHELL_CMD_RDMSR, @@ -1373,19 +1374,12 @@ static int32_t shell_cpuid(int32_t argc, char **argv) return 0; } -static int32_t shell_trigger_crash(int32_t argc, char **argv) +static int32_t shell_reboot(int32_t argc, char **argv) { - char str[MAX_STR_SIZE] = {0}; - (void)argc; (void)argv; - snprintf(str, MAX_STR_SIZE, "trigger crash, divide by 0 ...\r\n"); - shell_puts(str); - - asm("movl $0x1, %eax"); - asm("movl $0x0, %ecx"); - asm("idiv %ecx"); + reset_host(); return 0; }