From c56525f264e93ab4e9ea34723e7442e87058be3b Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Fri, 22 Mar 2013 21:41:50 +0100 Subject: [PATCH] cli_monitor: Add reboot command for Fiasco.OC In addition to the new reboot command, this patch tries to reduce the artifacts caused by the interplay of the kernel debugger and terminal_mux. --- os/src/app/cli_monitor/foc/extension.cc | 41 +++++++++++++++++++------ 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/os/src/app/cli_monitor/foc/extension.cc b/os/src/app/cli_monitor/foc/extension.cc index d4758c363..e0a35faf6 100644 --- a/os/src/app/cli_monitor/foc/extension.cc +++ b/os/src/app/cli_monitor/foc/extension.cc @@ -22,26 +22,44 @@ namespace Fiasco { } +static void clear_host_terminal() +{ + using namespace Fiasco; + + outstring("\e[99S"); /* scroll up */ + outstring("\e[99T"); /* scroll down */ + outstring("\e[199A"); /* move cursor up */ +} + + struct Kdebug_command : Command { Kdebug_command() : Command("kdebug", "enter kernel debugger (via serial console)") { } void execute(Command_line &, Terminal::Session &terminal) { - tprintf(terminal, " Entering kernel debugger...\n"); - tprintf(terminal, " Press [g] to continue execution.\n"); - using namespace Fiasco; - /* - * Wait a bit to give the terminal a chance to print the usage - * information before the kernel debugger takes over. - */ - l4_ipc_sleep(l4_timeout(L4_IPC_TIMEOUT_NEVER, l4_timeout_rel(244, 11))); + /* let kernel debugger detect the screen size */ + enter_kdebug("*#JS"); - enter_kdebug(""); + clear_host_terminal(); + enter_kdebug("Entering kernel debugger... Press [?] for help"); + clear_host_terminal(); + } +}; - tprintf(terminal, "\n"); + +struct Reboot_command : Command +{ + Reboot_command() : Command("reboot", "reboot machine") { } + + void execute(Command_line &, Terminal::Session &terminal) + { + using namespace Fiasco; + + clear_host_terminal(); + enter_kdebug("*#^"); } }; @@ -50,4 +68,7 @@ void init_extension(Command_registry &commands) { static Kdebug_command kdebug_command; commands.insert(&kdebug_command); + + static Reboot_command reboot_command; + commands.insert(&reboot_command); }