aboutsummaryrefslogtreecommitdiff
path: root/common/uapi/irq.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/uapi/irq.c')
-rw-r--r--common/uapi/irq.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/common/uapi/irq.c b/common/uapi/irq.c
new file mode 100644
index 0000000..3aa040e
--- /dev/null
+++ b/common/uapi/irq.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: copyleft-next-0.3.1 */
+
+/**
+ * @file irq.c
+ * IRQ request syscall handling implementation.
+ */
+
+#include <kmi/uapi.h>
+#include <kmi/irq.h>
+
+/**
+ * Actual IRQ handling request syscall handler.
+ *
+ * @param t Current tcb.
+ * @param id IRQ id to request to handle.
+ *
+ * @return OK on success, non-zero otherwise.
+ */
+SYSCALL_DEFINE1(irq_req)(struct tcb *t, sys_arg_t id)
+{
+ if (!has_cap(t->caps, CAP_IRQ))
+ return_args1(t, ERR_PERM);
+
+ if (!t->callback)
+ return_args1(t, ERR_NF);
+
+ return_args1(t, register_irq(t, id));
+}