#pragma once // ke_queue.h - fixed-depth message queue // Processes share an address space, so a pointer in Param[] is valid // on both sides. The queue is only a synchronisation and ordering tool. #include #include #include #include #include #include #define QUEUE_MESSAGE_SIZE 64 /* bytes, fixed */ #define QUEUE_DEPTH 256 typedef struct QUEUE_MESSAGE { uint32_t Type; uint32_t Flags; uint64_t Param[6]; /* 48 bytes of payload */ } QUEUE_MESSAGE; /* total: 64 bytes */ typedef struct QUEUE { OBJECT Header; SPINLOCK Lock; QUEUE_MESSAGE Ring[QUEUE_DEPTH]; uint32_t Head, Tail, Count; LIST_ENTRY SendWaiters; LIST_ENTRY RecvWaiters; } QUEUE; KSTATUS KeQueueCreate(QUEUE **out); KSTATUS KeSendMessage(QUEUE* queue, const QUEUE_MESSAGE* msg, bool blocking); KSTATUS KeReceiveMessage(QUEUE* queue, QUEUE_MESSAGE* msg, bool blocking);