summaryrefslogtreecommitdiff
path: root/kernel/ipc.h
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-11-28 20:07:50 +0100
committerAnton Kling <anton@kling.gg>2023-11-28 20:07:50 +0100
commit636858dbbd48ed9f5073793b46740302aa202f43 (patch)
treecf976c2b5a61ba055f0877317afdaf6e871df80e /kernel/ipc.h
parent89dc5dd5ba1e9cfe7a8975086c1d5638f8fbbac5 (diff)
Kernel: Add basic IPC and move to microkernel design.
The IPC design is currently a WIP and is nowhere near complete
Diffstat (limited to 'kernel/ipc.h')
-rw-r--r--kernel/ipc.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/kernel/ipc.h b/kernel/ipc.h
new file mode 100644
index 0000000..cfa9e6d
--- /dev/null
+++ b/kernel/ipc.h
@@ -0,0 +1,26 @@
+#ifndef IPC_H
+#define IPC_H
+#include <stdbool.h>
+#include <typedefs.h>
+
+#define IPC_BUFFER_SIZE 4096
+#define IPC_NUM_DATA 32
+
+struct IpcMessage {
+ u8 is_used;
+ u32 sender_pid;
+ u32 size;
+ u8 buffer[IPC_BUFFER_SIZE];
+};
+
+struct IpcMailbox {
+ u32 read_ptr;
+ u32 write_ptr;
+ struct IpcMessage data[IPC_NUM_DATA];
+};
+
+bool ipc_register_endpoint(u32 endpoint);
+int ipc_write_to_process(int pid, u8 *buffer, u32 length);
+int ipc_write(int ipc_id, u8 *buffer, u32 length);
+int ipc_read(u8 *buffer, u32 length, u32 *sender_pid);
+#endif