diff options
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/greeneye/__init__.py')
| -rw-r--r-- | debug/risc-v-gsp-rm-vm/greeneye/__init__.py | 41 |
1 files changed, 37 insertions, 4 deletions
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, |
