Add: reboot utility

This commit is contained in:
xamidev
2024-08-25 11:33:09 +02:00
parent b1e4ef8ad2
commit deafe2439b
3 changed files with 16 additions and 1 deletions

View File

@@ -9,6 +9,7 @@
#include "../drivers/framebuffer.h"
#include "../drivers/ata.h"
#include "../drivers/rtc.h"
#include "../kernel/io.h"
// Print a rainbow colorful text for testing
@@ -51,7 +52,7 @@ void program_uptime()
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
@@ -109,3 +110,15 @@ void program_read(int argc, char* argv[])
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");
}

View File

@@ -31,5 +31,6 @@ void program_help();
void program_echo();
void program_time();
void program_read();
void program_reboot();
#endif