From f88706d6dbe4b0eb036755b014925a610f0b73b6 Mon Sep 17 00:00:00 2001 From: CodeLongAndProsper90 <50145141+CodeLongAndProsper90@users.noreply.github.com> Date: Wed, 12 Feb 2020 11:03:49 -0600 Subject: [PATCH] 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 --- tlib/src/system.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tlib/src/system.cpp b/tlib/src/system.cpp index 01ebf485..29503194 100644 --- a/tlib/src/system.cpp +++ b/tlib/src/system.cpp @@ -99,7 +99,8 @@ std::expected 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