50 lines
1.6 KiB
C
50 lines
1.6 KiB
C
#pragma once
|
|
|
|
#include "types.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* IPC Protocol Flags */
|
|
#define IPC_FLAG_FAST_REGISTERS (1 << 0) /* Message fits entirely in registers */
|
|
#define IPC_FLAG_SHM_ATTACHED (1 << 1) /* Attached shared memory buffer */
|
|
#define IPC_FLAG_CAP_TRANSFER (1 << 2) /* Delegating capability in message */
|
|
#define IPC_FLAG_NONBLOCKING (1 << 3) /* Return immediately if receiver not ready */
|
|
|
|
/* Shared Memory Descriptor for Zero-Copy Transfers */
|
|
typedef struct ipc_shm_desc {
|
|
cap_t shm_cap; /* Capability to shared memory region */
|
|
uint64_t offset; /* Offset within SHM buffer */
|
|
uint64_t length; /* Length of data payload */
|
|
uint32_t permissions; /* Read/Write flags */
|
|
uint32_t _reserved;
|
|
} __attribute__((packed)) ipc_shm_desc_t;
|
|
|
|
/* IPC Message Payload Representation */
|
|
typedef struct ipc_msg {
|
|
uint64_t badge; /* Sender authentication badge (injected by kernel) */
|
|
uint32_t opcode; /* Interface Method / Function ID */
|
|
uint32_t flags; /* IPC_FLAG_* */
|
|
|
|
/* Fast-Path Register Payload (4 x 64-bit = 32 bytes directly passed) */
|
|
uint64_t args[4];
|
|
|
|
/* Zero-Copy Extended Descriptor */
|
|
ipc_shm_desc_t shm;
|
|
} __attribute__((aligned(16))) ipc_msg_t;
|
|
|
|
/* Standard Common IPC Opcodes */
|
|
#define IPC_OP_PING 0x0001
|
|
#define IPC_OP_PONG 0x0002
|
|
#define IPC_OP_REGISTER_SERVER 0x0010
|
|
#define IPC_OP_LOOKUP_SERVER 0x0011
|
|
#define IPC_OP_NOTIFY_EVENT 0x0020
|
|
#define IPC_OP_READ 0x0100
|
|
#define IPC_OP_WRITE 0x0101
|
|
#define IPC_OP_IOCTL 0x0102
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|