summaryrefslogtreecommitdiff
path: root/kc/core/task.h
diff options
context:
space:
mode:
authorAda Christine <adachristine18@gmail.com>2022-01-17 12:23:44 +0000
committerAda Christine <adachristine18@gmail.com>2022-01-17 12:23:44 +0000
commit8c56039ca130dfef1f0bf204cc702eeb10801379 (patch)
tree5f374b6f40f87fd356780c0d88e01651d1efd1a9 /kc/core/task.h
parentc5fcdec761211ef74ba84a8b41f34f073177cfab (diff)
task.h required for building
Diffstat (limited to 'kc/core/task.h')
-rw-r--r--kc/core/task.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/kc/core/task.h b/kc/core/task.h
new file mode 100644
index 0000000..86e262f
--- /dev/null
+++ b/kc/core/task.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <stdint.h>
+
+enum kc_thread_status
+{
+ READY,
+ STARTED,
+ YIELDED,
+ BLOCKED,
+ TERMINATED
+};
+
+struct kc_thread_state
+{
+ uint64_t stack;
+ uint64_t stack_top;
+ uint64_t page_map;
+};
+
+struct kc_thread
+{
+ struct kc_thread *prev;
+ struct kc_thread *next;
+ enum kc_thread_status status;
+ struct kc_thread_state state;
+};
+
+extern void cpu_set_thread(
+ struct kc_thread_state *current,
+ struct kc_thread_state *next,
+ uint64_t *cpu_tss_rsp0);
+