]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/jdb/jdb_exit_module.cpp
63a68350be2b83fc049823ee3bf7406da1280862
[l4.git] / kernel / fiasco / src / jdb / jdb_exit_module.cpp
1 IMPLEMENTATION:
2
3 #include <cstdio>
4 #include "simpleio.h"
5
6 #include "jdb.h"
7 #include "jdb_module.h"
8 #include "jdb_screen.h"
9 #include "kernel_console.h"
10 #include "static_init.h"
11 #include "terminate.h"
12 #include "types.h"
13
14
15 /**
16  * Private 'exit' module.
17  * 
18  * This module handles the 'exit' or '^' command that
19  * makes a call to exit() and virtually reboots the system.
20  */
21 class Jdb_exit_module : public Jdb_module
22 {
23 public:
24   Jdb_exit_module() FIASCO_INIT;
25 };
26
27 static Jdb_exit_module jdb_exit_module INIT_PRIORITY(JDB_MODULE_INIT_PRIO);
28
29 PUBLIC
30 Jdb_module::Action_code
31 Jdb_exit_module::action (int cmd, void *&, char const *&, int &)
32 {
33   if (cmd!=0)
34     return NOTHING;
35
36   // re-enable output of all consoles but GZIP and DEBUG
37   Kconsole::console()->change_state(0, Console::GZIP | Console::DEBUG,
38                                     ~0UL, Console::OUTENABLED);
39   // re-enable input of all consoles but PUSH and DEBUG
40   Kconsole::console()->change_state(0, Console::PUSH | Console::DEBUG,
41                                     ~0UL, Console::INENABLED);
42
43   Jdb::screen_scroll(1, 127);
44   Jdb::blink_cursor(Jdb_screen::height(), 1);
45   Jdb::cursor(127, 1);
46   terminate(1);
47   return LEAVE;
48 }
49
50 PUBLIC
51 int
52 Jdb_exit_module::num_cmds() const
53
54   return 1;
55 }
56
57 PUBLIC
58 Jdb_module::Cmd const *
59 Jdb_exit_module::cmds() const
60 {
61   static Cmd cs[] =
62     { { 0, "^", "exit", "", "^\treboot the system", (void*)0 } };
63
64   return cs;
65 }
66
67 IMPLEMENT
68 Jdb_exit_module::Jdb_exit_module()
69   : Jdb_module("GENERAL")
70 {}