Add: reboot utility
This commit is contained in:
@@ -106,6 +106,7 @@ void shell_install()
|
|||||||
register_command("cowsay", program_cowsay);
|
register_command("cowsay", program_cowsay);
|
||||||
register_command("time", program_time);
|
register_command("time", program_time);
|
||||||
register_command("read", program_read);
|
register_command("read", program_read);
|
||||||
|
register_command("reboot", program_reboot);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "../drivers/framebuffer.h"
|
#include "../drivers/framebuffer.h"
|
||||||
#include "../drivers/ata.h"
|
#include "../drivers/ata.h"
|
||||||
#include "../drivers/rtc.h"
|
#include "../drivers/rtc.h"
|
||||||
|
#include "../kernel/io.h"
|
||||||
|
|
||||||
// Print a rainbow colorful text for testing
|
// Print a rainbow colorful text for testing
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ void program_uptime()
|
|||||||
|
|
||||||
void program_help()
|
void program_help()
|
||||||
{
|
{
|
||||||
printf("help\tpanic\twords\tprimes\trainbow\tclear\nmath\tbf\t uptime echo\t sysinfo\tconway\nrot13 morse\tcowsay time\t read\n");
|
printf("help\tpanic\twords\tprimes\trainbow\tclear\nmath\tbf\t uptime echo\t sysinfo\tconway\nrot13 morse\tcowsay time\t read\t reboot\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panic
|
// Panic
|
||||||
@@ -109,3 +110,15 @@ void program_read(int argc, char* argv[])
|
|||||||
puts("Invalid argument number\n");
|
puts("Invalid argument number\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reboots the machine (might just shutdown)
|
||||||
|
|
||||||
|
void program_reboot()
|
||||||
|
{
|
||||||
|
puts("Rebooting...\n");
|
||||||
|
|
||||||
|
while(inb(0x64) & 0x02);
|
||||||
|
outb(0x64, 0xFE);
|
||||||
|
|
||||||
|
while (1) asm volatile("hlt");
|
||||||
|
}
|
||||||
|
|||||||
@@ -31,5 +31,6 @@ void program_help();
|
|||||||
void program_echo();
|
void program_echo();
|
||||||
void program_time();
|
void program_time();
|
||||||
void program_read();
|
void program_read();
|
||||||
|
void program_reboot();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user