aboutsummaryrefslogtreecommitdiff
path: root/common/ipi.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2022-11-09 16:27:23 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2022-11-09 17:27:11 +0200
commita3e45d5dcaf1bf3a9e684b5fcc301413ec994a9b (patch)
treeae319c8f389e7ca39bbdd4b114655f8604563305 /common/ipi.c
parent2b5533aefef026fe7bada314ebdb2651b809979a (diff)
downloadkmi-a3e45d5dcaf1bf3a9e684b5fcc301413ec994a9b.tar.gz
kmi-a3e45d5dcaf1bf3a9e684b5fcc301413ec994a9b.zip
add basic IPI structure
Diffstat (limited to 'common/ipi.c')
-rw-r--r--common/ipi.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/common/ipi.c b/common/ipi.c
new file mode 100644
index 0000000..32f1432
--- /dev/null
+++ b/common/ipi.c
@@ -0,0 +1,32 @@
+#include <apos/ipi.h>
+#include <arch/cpu.h>
+
+#include <arch/proc.h>
+
+/**
+ * @file ipi.c
+ *
+ * IPI function implementations.
+ */
+
+bool clear_ipi(struct tcb *t)
+{
+ bool r = t->ipi;
+ t->ipi = false;
+ return r;
+}
+
+void send_ipi(struct tcb *t)
+{
+ t->ipi = true;
+ cpu_send_ipi(t->cpu_id);
+}
+
+struct sys_ret handle_ipi(struct tcb *t)
+{
+ adjust_ipi(t);
+
+ /** @todo use rpc stack */
+ set_return(t, t->callback);
+ return get_args(t);
+}