Add optional parameter to syscall reboot/shutdown (#22)

* 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-17 15:27:18 -06:00 committed by GitHub
parent 9a305950a2
commit 67166266c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,7 +99,10 @@ 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) {
if (delay != 0) {
tlib::sleep_ms(1000 * delay);
}
asm volatile("mov rax, 0x50; int 50"
: //No outputs
: //No inputs
@ -108,7 +111,10 @@ void tlib::reboot(){
__builtin_unreachable();
}
void tlib::shutdown(){
void tlib::shutdown(int delay=0){
if (delay != 0) {
tlib::sleep_ms(1000 * delay);
}
asm volatile("mov rax, 0x51; int 50"
: //No outputs
: //No inputs