Add shutdown command
This commit is contained in:
parent
0435e46fc8
commit
9cef3e7732
12
src/shell.rs
12
src/shell.rs
|
@ -13,6 +13,7 @@ pub fn evaluate(command: &str) {
|
|||
"help" => help,
|
||||
"info" => info,
|
||||
"echo" => echo,
|
||||
"shutdown" => shutdown,
|
||||
_ => default
|
||||
};
|
||||
selected(&parts[..]);
|
||||
|
@ -31,6 +32,7 @@ fn help(_arguments: &[&str]) {
|
|||
println!("[help] This message");
|
||||
println!("[info] Info about KarxOS");
|
||||
println!("[echo <arguments>] Echoes whatever arguments you pass in");
|
||||
println!("[shutdown] Shuts off the system (QEMU only)");
|
||||
change_color(Color::White, Color::Black);
|
||||
}
|
||||
|
||||
|
@ -55,3 +57,13 @@ fn echo(arguments: &[&str]) {
|
|||
|
||||
println!("{}", new);
|
||||
}
|
||||
|
||||
fn shutdown(_arguments: &[&str]) {
|
||||
use x86_64::instructions::port::Port;
|
||||
|
||||
println!("KarxOS shutting down!");
|
||||
let mut shutdown_port: Port<u16> = Port::new(0x604);
|
||||
unsafe {
|
||||
shutdown_port.write(0x2000);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue