Add HVC 6 embedder extension hook

Merged
DO
6mo ago
+35-0

Allows embedders to register a custom dispatch handler for HVC immediate 6, keeping it separate from the Linux syscall path (HVC 5).

The hook is registered via two fields on guest_t:
hvc6_handler - callback fn(call_nr, args[8], userdata) -> result
hvc6_userdata - opaque pointer passed to the callback

The hook is zero-cost when unset (NULL check). Intended for use cases such as JNI bridges, device emulation, or other guest↔host ABI extensions that need their own HVC immediate.


Summary by cubic

Adds an HVC 6 hook for custom host calls, separate from the Linux syscall path (HVC 5). Defaults to a no-op when no handler is registered.

  • New Features
    • Adds hvc6_handler(call_nr, args[8], userdata) and hvc6_userdata to guest_t.
    • On HVC 6, reads X8 (call) and X0–X7 (args), calls the handler if set, and writes the result to X0.
    • Handler must be thread-safe; the hook is process‑local and must be re‑registered after fork/posix_spawn.