From f909a5f822c5c4a4e9526b861d4171f8925f5113 Mon Sep 17 00:00:00 2001 From: Arthur Hanson Rasmusson Date: Fri, 2 Oct 2026 10:58:21 -0400 Subject: debug: green-eye wave 3 - RM harness, local simulator, device map, MCP plugin, value-validation demos, CI pipeline, toolchain docs; add host RM tools rmtool/rmtop --- debug/risc-v-gsp-rm-vm/greeneye/__init__.py | 41 ++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 4 deletions(-) (limited to 'debug/risc-v-gsp-rm-vm/greeneye/__init__.py') diff --git a/debug/risc-v-gsp-rm-vm/greeneye/__init__.py b/debug/risc-v-gsp-rm-vm/greeneye/__init__.py index 8b1c1e5..717160c 100644 --- a/debug/risc-v-gsp-rm-vm/greeneye/__init__.py +++ b/debug/risc-v-gsp-rm-vm/greeneye/__init__.py @@ -85,13 +85,46 @@ def launch( name: str = "session", load_symbols: bool = True, keep_alive: bool = False, + backend: str = "qemu", + trace=None, ) -> Session: - """Launch QEMU (paused), attach, and return a ready Session. + """Launch a target (paused), attach, and return a ready Session. - The target starts paused at its reset vector; use Session.load_image() to - load an ELF (which also sets PC), or QemuTarget.run_kernel() style helper - launch with kernel= for the fast `-kernel` path. + ``backend="qemu"`` (default) starts ``qemu-system-riscv64`` exactly as + before. ``backend="native"`` uses the in-process deterministic RV64IMAC + simulator (M1) via ``greeneye.sim_backend``; the Session contract is the + same. ``trace`` (native only) enables the R4 exec/access trace: ``True``, + a dict of ``{"exec", "start", "end", "max_events"}``, or a + ``sim.trace.Trace``; it is saved to the session as ``blobs/trace.jsonl``. + The target starts paused at its reset vector; use + Session.load_image() to load an ELF (which also sets PC), or launch with + kernel= for the fast `-kernel` path. """ + if backend in ("native", "sim"): + from .sim_backend import launch_native + + return launch_native( + kernel=kernel, + memory_mb=memory_mb, + record=record, + symbols=symbols, + name=name, + load_symbols=load_symbols, + keep_alive=keep_alive, + trace=trace, + ) + if trace is not None: + from .errors import TargetError + + raise TargetError( + "trace= is native-only; for QEMU build qemu/greeneye-trace.so and " + "pass -plugin (see qemu/README.md)" + ) + if backend != "qemu": + from .errors import TargetError + + raise TargetError(f"unknown backend {backend!r} (use 'qemu' or 'native')") + target = QemuTarget( machine=machine, memory_mb=memory_mb, -- cgit v1.2.3