diff options
| -rw-r--r-- | arch/riscv64/kernel/sbi.h | 7 | ||||
| -rw-r--r-- | include/kmi/bits.h | 6 | ||||
| -rw-r--r-- | include/kmi/uapi.h | 12 | ||||
| -rw-r--r-- | src/uapi/conf.c | 7 |
4 files changed, 31 insertions, 1 deletions
diff --git a/arch/riscv64/kernel/sbi.h b/arch/riscv64/kernel/sbi.h index d536f58..0f3eba7 100644 --- a/arch/riscv64/kernel/sbi.h +++ b/arch/riscv64/kernel/sbi.h @@ -149,7 +149,14 @@ static inline struct sbiret sbi_hart_start(unsigned long hartid, 0, 0, 0); } +/** Hart start function ID. */ #define FID_HSM_STOP 1 + +/** + * Stop current hart. + * + * @return SBI call return. \see sbiret. + */ static inline struct sbiret sbi_hart_stop() { return sbi_ecall(EID_HSM, FID_HSM_STOP, 0, 0, 0, 0, 0, 0); diff --git a/include/kmi/bits.h b/include/kmi/bits.h index 5fe438c..fea7b9a 100644 --- a/include/kmi/bits.h +++ b/include/kmi/bits.h @@ -379,6 +379,12 @@ uint64_t __bswap64(uint64_t u); #endif +/** + * Check if value is power of 2. + * + * @param x Value to check. + * @return \ref true if power of 2, \ref false otherwise + */ #define is_powerof2(x) (((x) & ((x) - 1)) == 0) #endif /* KMI_BITS_H */ diff --git a/include/kmi/uapi.h b/include/kmi/uapi.h index d1d3a38..5e5f446 100644 --- a/include/kmi/uapi.h +++ b/include/kmi/uapi.h @@ -765,7 +765,17 @@ 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. */ + * arises a need for different levels of sleep, but for now zero params. + * + * @param t Current tcb. + * @param a Unused. + * @param b Unused. + * @param c Unused. + * @param d Unused. + * @param e Unused. + * + * Shouldn't return at all. + */ SYSCALL_DECLARE0(sleep); /** diff --git a/src/uapi/conf.c b/src/uapi/conf.c index 497aef0..7925616 100644 --- a/src/uapi/conf.c +++ b/src/uapi/conf.c @@ -114,6 +114,13 @@ SYSCALL_DEFINE1(poweroff)(struct tcb *t, sys_arg_t type) return_args1(t, ERR_INVAL); } +/** + * Sleep syscall handler. + * + * @param t Current tcb. + * @return Shouldn't, but \ref ERR_PERM if insufficient permissions, + * otherwise whatever \ref sleep() returns. + */ SYSCALL_DEFINE0(sleep)(struct tcb *t) { if (!(has_cap(t->caps, CAP_POWER))) |
