From bce944d1498eaa3b6940ee234c863b3548a66b37 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sun, 24 Jan 2021 12:00:11 -0500 Subject: graphics! --- src/kernel/task.h | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src/kernel/task.h') 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 #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 -- cgit v1.2.3