Skip to content

Commit

Permalink
adding reboot command
Browse files Browse the repository at this point in the history
  • Loading branch information
Kbz-8 committed Jul 21, 2024
1 parent 8fa0366 commit 46027f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sources/drivers/power/power.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ pub fn shutdown() void

pub fn reboot() void
{
var good: u8 = 0x02;
while(good & 0x02 != 0)
good = kernel.arch.ports.in(u8, 0x64);
kernel.arch.ports.out(u8, 0x64, 0xFE);
kernel.arch.halt();
}
2 changes: 2 additions & 0 deletions sources/kernel/shell/dumb_shell.zig
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ pub const DumbShell = struct
break
else if(libk.str.streqlnt(&self.buffer, "exit"))
break
else if(libk.str.streqlnt(&self.buffer, "reboot"))
drivers.power.reboot()
else if(libk.str.streqlnt(&self.buffer, "stack"))
stk.stackTrace(8)
else if(libk.str.streqlnt(&self.buffer, "panic"))
Expand Down

0 comments on commit 46027f0

Please sign in to comment.