- Remove TOML dependency from Makefile and compose_device.c - Implement projection support in config handler: remap device memory segments between devices via cells[] pointer reassignment - Implement intercept support: shadow_copy (write to both devices) and shadow_replace (redirect read/write to another device) modes using smartAddr handler infrastructure - Fix critical bug in hmmmm.c: freeDevMem was loaded from "freeDevSpecs" symbol instead of "freeDevMem", causing segfault on config reload - Add intercept context lifecycle management to EmulContext Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.1 KiB
C
50 lines
1.1 KiB
C
#ifndef __CONTEXT_H__
|
|
#define __CONTEXT_H__
|
|
|
|
#include <pthread.h>
|
|
|
|
#include "ptQueue/inc/ptQueue.h"
|
|
#include "wsServer/include/ws.h"
|
|
|
|
#include "linkedlist.h"
|
|
#include "sized_ptr.h"
|
|
|
|
#include "streamed.h"
|
|
#include "flatcc/flatcc_builder.h"
|
|
|
|
typedef struct {
|
|
SizedPtr* bufs;
|
|
uint8_t buffersCount;
|
|
_Atomic (uint8_t) readRequestIdx;
|
|
_Atomic (uint8_t) currWritingIdx;
|
|
} OutgoingBuffers;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
uint8_t* emulState;
|
|
uint64_t* clockCounter;
|
|
LinkedListEntry** clientsHead;
|
|
uint8_t* utilizedFlag;
|
|
OutgoingBuffers* outBufs;
|
|
DeviceSegStreamReg** deviceStreamRegs;
|
|
uint8_t** devicesMem;
|
|
size_t devicesCount;
|
|
void** deviceHandles; // device_handle_t** — dynamically loaded devices
|
|
void** interceptCtxs; // intercept_ctx_t** — heap-allocated intercept contexts
|
|
size_t interceptCtxCount;
|
|
flatcc_builder_t stream_builder;
|
|
} EmulContext;
|
|
|
|
|
|
typedef struct {
|
|
pthread_mutex_t registerMutex;
|
|
ptQueue* regQueue;
|
|
uint8_t* accessToken;
|
|
EmulContext* emulContext;
|
|
} ServerContext;
|
|
|
|
|
|
|
|
#endif //ifndef __CONTEXT_H__
|