Add optional parameter to syscall reboot/shutdown

Added a optional parameter to tlib::shutdown and tlib::reboot that waits the number of seconds, to enable timed shutdowns/reboots
This commit is contained in:
CodeLongAndProsper90 2020-02-12 11:03:49 -06:00 committed by GitHub
parent 9a305950a2
commit f88706d6db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,8 @@ std::expected<size_t> tlib::exec_and_wait(const char* executable, const std::vec
return std::move(result);
}
void tlib::reboot(){
void tlib::reboot(int delay=0) {
tlib::sleep_ms(1000*delay);
asm volatile("mov rax, 0x50; int 50"
: //No outputs
: //No inputs
@ -108,7 +109,8 @@ void tlib::reboot(){
__builtin_unreachable();
}
void tlib::shutdown(){
void tlib::shutdown(int delay=0){
tlib::sleep_ms(1000* delay);
asm volatile("mov rax, 0x51; int 50"
: //No outputs
: //No inputs