From 7a1c7ed1b1c30ba4c668194a955fb414e471bade Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 1 Jun 2024 16:42:55 +0300 Subject: add sleep syscall + Sets the current core to sleep --- include/kmi/power.h | 8 ++++++++ include/kmi/syscalls.h | 3 +++ include/kmi/uapi.h | 5 +++++ 3 files changed, 16 insertions(+) (limited to 'include') diff --git a/include/kmi/power.h b/include/kmi/power.h index d11b9d1..db00999 100644 --- a/include/kmi/power.h +++ b/include/kmi/power.h @@ -35,4 +35,12 @@ enum poweroff_type { */ stat_t poweroff(enum poweroff_type type); +/** + * Set the current core to sleep. + * + * @return Nothing on success (we should be sleeping), + * \ref ERR_MISC if sleep was not successful + */ +stat_t sleep(); + #endif diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h index 1de4fb2..e503709 100644 --- a/include/kmi/syscalls.h +++ b/include/kmi/syscalls.h @@ -142,6 +142,9 @@ enum { /** Shutdown, reboot, etc. */ SYS_POWEROFF, + /** Set this core to sleep. */ + SYS_SLEEP, + /** Request to handle IRQ. */ SYS_IRQ_REQ, diff --git a/include/kmi/uapi.h b/include/kmi/uapi.h index 40cfae4..d1d3a38 100644 --- a/include/kmi/uapi.h +++ b/include/kmi/uapi.h @@ -763,6 +763,11 @@ SYSCALL_DECLARE3(clear_cap, tid, off, cap); */ SYSCALL_DECLARE1(poweroff, type); +/** + * Sets the current core to sleep. Might take parameters in the future if there + * arises a need for different levels of sleep, but for now zero params. */ +SYSCALL_DECLARE0(sleep); + /** * Request to handle IRQ. * -- cgit v1.3