summaryrefslogtreecommitdiffstats
path: root/debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h
blob: 8be481e2dae0630f4e70918cdd373d6a4f611230 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* risc-v-gsp-rm-debugger injected-service SDK header.
 *
 * A risc-v-gsp-rm-debugger service is position-independent RV64 code loaded into the
 * target's RAM by the debugger.  Nothing in the firmware links against it,
 * so it must not reference globals, absolute addresses or libc: every
 * function it calls must be one it brings with it (or a function whose
 * address the injector passes in).
 *
 * On the demo uproc, the injector stores the service entry in the control
 * block's handler table and the firmware dispatches commands 16..23 to it.
 * On a future GSP-RM simulator the same shape becomes an RM engine entry
 * registered with the simulated RM core.
 */
#ifndef GREENEYE_SERVICE_H
#define GREENEYE_SERVICE_H

typedef unsigned long ge_u64;
typedef long ge_i64;

#define GE_SERVICE_MAGIC 0x47455356u /* "GESV" */
#define GE_SERVICE_VERSION 1u

/* Command range the demo firmware routes to injected handlers. */
#define GE_INJECT_CMD_BASE 16

/* Dispatch prototype: cmd plus two arguments, one result. */
typedef ge_u64 (*ge_service_fn)(ge_u64 cmd, ge_u64 a0, ge_u64 a1);

/* Optional metadata block an injector can locate by symbol name. */
typedef struct {
    unsigned int magic;
    unsigned int version;
    const char *name;
    ge_u64 (*dispatch)(ge_u64, ge_u64, ge_u64);
} ge_service_t;

#endif /* GREENEYE_SERVICE_H */