diff options
author | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-21 06:36:28 +0100 |
---|---|---|
committer | Lizzy Fleckenstein <lizzy@vlhl.dev> | 2023-12-21 06:36:28 +0100 |
commit | 5885cb0a19b06388222f2945d78963377e584ecc (patch) | |
tree | 5cd4cd38e4891584f80a983e48f8f4996928bc35 /stage3/shell.c | |
parent | 05c693f5305baea8915ea3882deeba65001e7a8f (diff) | |
download | cuddles-5885cb0a19b06388222f2945d78963377e584ecc.tar.xz |
add QEMU shutdown command
Diffstat (limited to 'stage3/shell.c')
-rw-r--r-- | stage3/shell.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/stage3/shell.c b/stage3/shell.c index d67ca57..0f56a04 100644 --- a/stage3/shell.c +++ b/stage3/shell.c @@ -6,6 +6,7 @@ #include "string.h" #include "pci.h" #include "memory.h" +#include "io.h" static void cmd_echo(str arg) { @@ -228,6 +229,15 @@ static void cmd_ls(str arg) free(d.data); } +void cmd_shutdown(str arg) +{ + (void) arg; + + // this only works in QEMU currently + // TODO: use ACPI to make this portable + outw(0x604, 0x2000); +} + typedef struct { str name; void (*fn)(str arg); @@ -246,6 +256,7 @@ static command registry[] = { { S("love"), &cmd_love }, { S("uname"), &cmd_uname }, { S("ls"), &cmd_ls }, + { S("shutdown"), &cmd_shutdown }, }; void shell_run_cmd(str cmd) |