summaryrefslogtreecommitdiff
path: root/stage3/thread.h
diff options
context:
space:
mode:
authorLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-19 01:54:39 +0100
committerLizzy Fleckenstein <lizzy@vlhl.dev>2023-12-19 02:11:32 +0100
commit6d263c7d4e0f4b1d34694b5d3d159ccb20b3db02 (patch)
tree41578268cf68b2d9ea1737687a0f98af979948d8 /stage3/thread.h
parent5881b4d5c1040c762599f90e091e4cc4c3abe6b1 (diff)
downloadcuddles-6d263c7d4e0f4b1d34694b5d3d159ccb20b3db02.tar.xz
keyboard driver and threads
* PS/2 keyboard driver * interactive shell * move away from \0 terminated strings to sized slices * coroutine threads and IRQ queues
Diffstat (limited to 'stage3/thread.h')
-rw-r--r--stage3/thread.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/stage3/thread.h b/stage3/thread.h
new file mode 100644
index 0000000..9f5ff2f
--- /dev/null
+++ b/stage3/thread.h
@@ -0,0 +1,40 @@
+#ifndef THREAD_H
+#define THREAD_H
+
+#include "def.h"
+
+typedef struct {
+ bool exit;
+ i64 timeout;
+} yield_arg;
+
+void *yield(void *arg);
+
+typedef struct {
+ str name;
+ void *stack_bottom;
+ void *stack;
+} thread;
+
+typedef struct {
+ u8 irq;
+ union {
+ u8 scancode;
+ } data;
+} event;
+
+typedef struct {
+ usize len;
+ usize cap;
+ event *data;
+} event_queue;
+
+extern event_queue queue_write;
+extern thread *irq_services[16];
+
+void thread_init();
+void thread_resume(void *ret, thread *t);
+thread *thread_create(str name, void *init);
+void thread_sched(yield_arg *arg, void *stack);
+
+#endif