From d179f1846f9372920ef02f08cfb4d3abe99b383f Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Wed, 14 Dec 2022 18:26:49 +0100 Subject: first commit --- lib/sys/reboot.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 lib/sys/reboot.h (limited to 'lib/sys/reboot.h') diff --git a/lib/sys/reboot.h b/lib/sys/reboot.h new file mode 100644 index 0000000..fd119c5 --- /dev/null +++ b/lib/sys/reboot.h @@ -0,0 +1,21 @@ +#ifndef SHUTDOWN_H +#define SHUTDOWN_H + +#include "syscalls.h" + +#define REBOOT_HALT_SYSTEM 0xcdef0123 +#define REBOOT_HARD_RESET 0x01234567 +#define REBOOT_ENABLE_CAD 0x89abcdef +#define REBOOT_DISABLE_CAD 0 +#define REBOOT_POWEROFF 0x4321fedc +#define REBOOT_SUSPEND 0xd000fce2 +#define REBOOT_NEW_KERNEL 0x45584543 + +static int reboot(int cmd) { + const int magic1 = 0xfee1dead; + const int magic2 = 537993216; + + return syscall((void*)REBOOT, magic1, magic2, cmd, 0); +} + +#endif -- cgit v1.2.3-70-g09d2