summaryrefslogtreecommitdiffstats
path: root/debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h')
-rw-r--r--debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h b/debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h
new file mode 100644
index 0000000..d5218cc
--- /dev/null
+++ b/debug/risc-v-gsp-rm-vm/sdk/greeneye_service.h
@@ -0,0 +1,37 @@
+/* green-eye injected-service SDK header.
+ *
+ * A green-eye 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 */