summaryrefslogtreecommitdiff
path: root/src/kernel/task.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/task.h')
-rw-r--r--src/kernel/task.h34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/kernel/task.h b/src/kernel/task.h
index 50be93a..574dfa7 100644
--- a/src/kernel/task.h
+++ b/src/kernel/task.h
@@ -5,10 +5,20 @@
#include <stdint.h>
#define TASK_NAME_LEN 15
-
-enum wait_mode {
- NONE,
- PROCESS_END,
+#define MAX_WAITS 16
+
+struct wait {
+ enum {
+ NONE,
+ PROCESS_END,
+ WINDOW_ACTION,
+ IPC_RECEIVE,
+ IPC_RECEIVE_ANY,
+ IPC_SEND
+ } mode;
+ union {
+ struct task_state *task;
+ };
};
struct task_state {
@@ -23,12 +33,19 @@ struct task_state {
uint32_t ebp;
uint32_t esp;
- enum wait_mode wait_mode;
- uint32_t wait_arg;
+ uint32_t stack_bottom;
+
+ struct wait waits[MAX_WAITS];
+ bool waiting;
char name[TASK_NAME_LEN + 1];
} __attribute__ ((packed));
+void add_wait(struct wait wait);
+void unwait_any(struct wait wait);
+void unwait(struct task_state *task, struct wait wait);
+
+extern struct task_state tasks[];
extern struct task_state *active_task;
void init_tasks();
@@ -38,4 +55,9 @@ void advance_active_task();
void delete_task(struct task_state *state);
+uint32_t ipc_send(uint32_t reader_handle, uint32_t count, const void *buffer);
+uint32_t ipc_read(uint32_t sender_handle, uint32_t count, void *buffer);
+
+uint32_t find_unread_ipc();
+
#endif \ No newline at end of file