mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-08-04 01:36:10 -04:00
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:
parent
9a305950a2
commit
67166266c4
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user