7 #include "jdb_module.h"
8 #include "jdb_screen.h"
9 #include "kernel_console.h"
10 #include "static_init.h"
11 #include "terminate.h"
15 * Private 'exit' module.
17 * This module handles the 'exit' or '^' command that
18 * makes a call to exit() and virtually reboots the system.
20 class Jdb_exit_module : public Jdb_module
23 Jdb_exit_module() FIASCO_INIT;
26 static Jdb_exit_module jdb_exit_module INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
29 Jdb_module::Action_code
30 Jdb_exit_module::action (int cmd, void *&, char const *&, int &)
35 // re-enable output of all consoles but GZIP and DEBUG
36 Kconsole::console()->change_state(0, Console::GZIP | Console::DEBUG,
37 ~0UL, Console::OUTENABLED);
38 // re-enable input of all consoles but PUSH and DEBUG
39 Kconsole::console()->change_state(0, Console::PUSH | Console::DEBUG,
40 ~0UL, Console::INENABLED);
42 Jdb::screen_scroll(1, 127);
43 Jdb::blink_cursor(Jdb_screen::height(), 1);
52 Jdb_exit_module::num_cmds() const
58 Jdb_module::Cmd const *
59 Jdb_exit_module::cmds() const
62 { { 0, "^", "exit", "", "^\treboot the system", 0 } };
68 Jdb_exit_module::Jdb_exit_module()
69 : Jdb_module("GENERAL")
72 // ------------------------------------------------------------------------
75 // VT might need some special treatment, switching VT off seems to be
76 // necessary to do a (keyboard) reset
82 Jdb_exit_module::do_vmxoff(Cpu_number, void *)
84 asm volatile("vmxoff");
89 Jdb_exit_module::remote_vmxoff(Cpu_number cpu)
91 Jdb::remote_work(cpu, do_vmxoff, 0);
96 Jdb_exit_module::vmx_off() const
98 if (Cpu::boot_cpu()->vmx())
99 Jdb::foreach_cpu(&remote_vmxoff);
102 // ------------------------------------------------------------------------
103 IMPLEMENTATION [!vmx]:
107 Jdb_exit_module::vmx_off() const {}