From 39175324e152b6b1e905cd45ecec31e4b667ebea Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 14 Jul 2024 12:46:02 +0300 Subject: add some missing docs --- include/kmi/caps.h | 1 - include/kmi/syscalls.h | 1 + include/kmi/types.h | 2 +- include/kmi/uapi.h | 16 ++++++++++++++-- src/uapi/cap.c | 2 -- src/uapi/irq.c | 9 ++++++++- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/include/kmi/caps.h b/include/kmi/caps.h index cc54dbe..df81ef2 100644 --- a/include/kmi/caps.h +++ b/include/kmi/caps.h @@ -28,7 +28,6 @@ * Clear capabilities. * * @param x Capabilities to modify. - * @param o Offset. * @param c Capabilities to set. */ #define clear_caps(x, c) clear_bits(x, c) diff --git a/include/kmi/syscalls.h b/include/kmi/syscalls.h index 1ca2113..5079d74 100644 --- a/include/kmi/syscalls.h +++ b/include/kmi/syscalls.h @@ -260,6 +260,7 @@ enum conf_param { CONF_PAGE_SIZE, }; +/** Capabilities of process. */ enum sys_cap { /** Thread is allowed to set capabilities of other threads. */ CAP_CAPS = (1 << 0), diff --git a/include/kmi/types.h b/include/kmi/types.h index 040d3c6..709ca02 100644 --- a/include/kmi/types.h +++ b/include/kmi/types.h @@ -446,7 +446,7 @@ typedef union { #define NULL 0 /* some common types used throughout the kernel */ -/** Status, used with codes in \ref status_codes. */ +/** Status, used with codes in \ref sys_status. */ typedef int_fast8_t stat_t; /** ID of something. @todo should this be signed? Linux etc seems to assume it diff --git a/include/kmi/uapi.h b/include/kmi/uapi.h index 3f03879..2805a04 100644 --- a/include/kmi/uapi.h +++ b/include/kmi/uapi.h @@ -741,7 +741,7 @@ SYSCALL_DECLARE2(set_cap, tid, caps); * * Returns \ref OK, capabilities. */ -SYSCALL_DECLARE1(cap_get, tid); +SYSCALL_DECLARE1(get_cap, tid); /** * Clear capabilities. @@ -808,7 +808,7 @@ SYSCALL_DECLARE0(sleep); * Request to handle IRQ. * * @param t Current tcb. - * @param id ID if IRQ to handle. + * @param id ID of IRQ to handle. * @param b Unused. * @param c Unused. * @param d Unused. @@ -819,6 +819,18 @@ SYSCALL_DECLARE0(sleep); */ SYSCALL_DECLARE1(irq_req, id); +/** + * Remove handled IRQ. + * + * @param t Current tcb. + * @param id ID of IRQ to stop handling. + * @param b Unused. + * @param c Unused. + * @param d Unused. + * @param e Unused. + */ +SYSCALL_DECLARE1(free_irq, id); + /** * Request that a thread exits, i.e. removes itself from the thread list and * frees all kernel data associated with thread. diff --git a/src/uapi/cap.c b/src/uapi/cap.c index 050d181..7003ed3 100644 --- a/src/uapi/cap.c +++ b/src/uapi/cap.c @@ -15,7 +15,6 @@ * * @param t Current tcb. * @param tid Thread ID whose capabilities to set. - * @param off Offset of capability, multiple of \c bits(cap). * @param caps Mask of capabilities to set. * @return \ref OK on success, \ref ERR_INVAL on invalid input. */ @@ -37,7 +36,6 @@ SYSCALL_DEFINE2(set_cap)(struct tcb *t, sys_arg_t tid, sys_arg_t caps) * * @param t Current tcb. * @param tid Thread ID whose capabilities to get. - * @param off Offset of capability, multiple of \c bits(cap). * @return \ref OK, capabilities. */ SYSCALL_DEFINE1(get_cap)(struct tcb *t, sys_arg_t tid) diff --git a/src/uapi/irq.c b/src/uapi/irq.c index 69602af..c109533 100644 --- a/src/uapi/irq.c +++ b/src/uapi/irq.c @@ -15,7 +15,7 @@ * @param t Current tcb. * @param id Which IRQ number to register. * - * @return OK on success, non-zero otherwise. + * @return \ref OK on success, non-zero otherwise. */ SYSCALL_DEFINE1(irq_req)(struct tcb *t, sys_arg_t id) { @@ -28,6 +28,13 @@ SYSCALL_DEFINE1(irq_req)(struct tcb *t, sys_arg_t id) return_args1(t, register_irq(t, id)); } +/** + * Actual IRQ freeing syscall handler. + * + * @param t Current tcb. + * @param id ID of IRQ to free. + * @return \ref OK on success, non-zero otherwise. + */ SYSCALL_DEFINE1(free_irq)(struct tcb *t, sys_arg_t id) { if (!has_cap(t->caps, CAP_IRQ)) -- cgit v1.3