diff options
Diffstat (limited to 'debug/risc-v-gsp-rm-vm/harness')
18 files changed, 91 insertions, 55 deletions
diff --git a/debug/risc-v-gsp-rm-vm/harness/__init__.py b/debug/risc-v-gsp-rm-vm/harness/__init__.py index d99d547..0f644dd 100644 --- a/debug/risc-v-gsp-rm-vm/harness/__init__.py +++ b/debug/risc-v-gsp-rm-vm/harness/__init__.py @@ -1,4 +1,4 @@ -"""green-eye automation harness. +"""risc-v-gsp-rm-debugger automation harness. Two stdlib-only orchestration tools: diff --git a/debug/risc-v-gsp-rm-vm/harness/ci_release.py b/debug/risc-v-gsp-rm-vm/harness/ci_release.py index dbc1f6f..ca1ab2c 100644 --- a/debug/risc-v-gsp-rm-vm/harness/ci_release.py +++ b/debug/risc-v-gsp-rm-vm/harness/ci_release.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Release triage orchestration for green-eye (planned docs/21). +"""Release triage orchestration for risc-v-gsp-rm-debugger (planned docs/21). Given an old and a new firmware target it runs, in order: @@ -345,8 +345,8 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--new-label", help="report label for the new target") parser.add_argument("--release", help="release label; an rm610 release is gated by docs/23") parser.add_argument("--approval-token", help=f"explicit RM610 token ({RM610_TOKEN})") - parser.add_argument("--old-symbols", help="green-eye symbol DB JSON for the old target") - parser.add_argument("--new-symbols", help="green-eye symbol DB JSON for the new target") + parser.add_argument("--old-symbols", help="risc-v-gsp-rm-debugger symbol DB JSON for the old target") + parser.add_argument("--new-symbols", help="risc-v-gsp-rm-debugger symbol DB JSON for the new target") parser.add_argument("--matrix-symbols", help="one symbol DB JSON applied to both matrix targets") parser.add_argument("--old-ghidra-names", help="Ghidra names.tsv for the old target") parser.add_argument("--new-ghidra-names", help="Ghidra names.tsv for the new target") @@ -359,7 +359,7 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--corpus-diff", nargs=2, metavar=("OLD_TSV", "NEW_TSV"), help="diff two decompiled_index.tsv corpus exports") parser.add_argument("--corpus-report", help="attach a previously produced corpus diff report") - parser.add_argument("--stimulus", help="green-eye script replacing the builtin demo scenario") + parser.add_argument("--stimulus", help="risc-v-gsp-rm-debugger script replacing the builtin demo scenario") parser.add_argument("--probe-instructions", type=int, default=2000) parser.add_argument("--behavior-duration", type=float, default=0.4) parser.add_argument("--max-rows", type=int, default=40) diff --git a/debug/risc-v-gsp-rm-vm/harness/common.py b/debug/risc-v-gsp-rm-vm/harness/common.py index 74dabe0..849f208 100644 --- a/debug/risc-v-gsp-rm-vm/harness/common.py +++ b/debug/risc-v-gsp-rm-vm/harness/common.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Shared helpers for the green-eye automation harness. +"""Shared helpers for the risc-v-gsp-rm-debugger automation harness. The harness scripts run from the tool root without installation, so this module bootstraps the tool root onto ``sys.path`` before importing greeneye. diff --git a/debug/risc-v-gsp-rm-vm/harness/control_discovery.py b/debug/risc-v-gsp-rm-vm/harness/control_discovery.py index b44636a..ca671d2 100644 --- a/debug/risc-v-gsp-rm-vm/harness/control_discovery.py +++ b/debug/risc-v-gsp-rm-vm/harness/control_discovery.py @@ -804,7 +804,7 @@ def render_markdown(report: dict, options: "DiscoveryOptions") -> str: for row in per_id.values(): grouped.setdefault(primary_class(row), []).append(row["id"]) lines = [ - "# green-eye control discovery report", + "# risc-v-gsp-rm-debugger control discovery report", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/control_discovery.py`.", "", diff --git a/debug/risc-v-gsp-rm-vm/harness/mutation_harness.py b/debug/risc-v-gsp-rm-vm/harness/mutation_harness.py index 7b558bd..9b4d102 100644 --- a/debug/risc-v-gsp-rm-vm/harness/mutation_harness.py +++ b/debug/risc-v-gsp-rm-vm/harness/mutation_harness.py @@ -7,7 +7,7 @@ region), runs it for a bounded budget, and classifies the outcome: normal, trap (ebreak / control transfer to an invalid PC), fault (first new QEMU exception, parsed from the guest_errors/int log), no-progress, or unexpected-result against a small demo oracle. Every attempt is recorded as a -green-eye session and a compact finding. +risc-v-gsp-rm-debugger session and a compact finding. Strategies: invalid command IDs, boundary values, single bit flips of valid inputs, and buffer length boundaries for the ECHO/FILL/SUM commands. @@ -437,7 +437,7 @@ def write_summary(options: HarnessOptions, findings: list[dict]) -> str: classes = Counter(finding["outcome"] for finding in findings) strategies = Counter(finding["strategy"] for finding in findings) lines = [ - "# green-eye mutation findings", + "# risc-v-gsp-rm-debugger mutation findings", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/mutation_harness.py`.", "", diff --git a/debug/risc-v-gsp-rm-vm/harness/package_sim.py b/debug/risc-v-gsp-rm-vm/harness/package_sim.py index 28f54c4..98484c3 100644 --- a/debug/risc-v-gsp-rm-vm/harness/package_sim.py +++ b/debug/risc-v-gsp-rm-vm/harness/package_sim.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -"""Package the native green-eye simulator together with injected code. +"""Package the native risc-v-gsp-rm-debugger simulator together with injected code. Builds a self-contained trial directory (or deterministic ``.tar.gz``): @@ -240,7 +240,7 @@ def write_deterministic_tar(out_dir: str, tar_path: str) -> str: # -- request/build ---------------------------------------------------------- RUN_SH = """#!/bin/sh -# green-eye trial runner (generated by harness/package_sim.py; inspect before use). +# risc-v-gsp-rm-debugger trial runner (generated by harness/package_sim.py; inspect before use). # Usage: ./run.sh [scenario args] Environment: GREENEYE_HOME overrides the tool root. set -eu here=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) @@ -252,7 +252,7 @@ else root=$(dirname "$root") done if [ ! -f "$root/greeneye/__init__.py" ]; then - echo "run.sh: green-eye tool root not found; set GREENEYE_HOME" >&2 + echo "run.sh: risc-v-gsp-rm-debugger tool root not found; set GREENEYE_HOME" >&2 exit 3 fi fi @@ -286,11 +286,11 @@ def _readme_text( preinject: dict | None, ) -> str: lines = [ - "# green-eye trial package", + "# risc-v-gsp-rm-debugger trial package", "", "Generated by `harness/package_sim.py` (`greeneye-trial/1`). This package", "bundles a target, an injected service blob and a pre-scripted scenario", - "that runs on the deterministic native RV64 simulator in the green-eye", + "that runs on the deterministic native RV64 simulator in the risc-v-gsp-rm-debugger", "tool tree. It needs no QEMU, no GPU and no guest.", "", "## Contents", @@ -309,7 +309,7 @@ def _readme_text( "./run.sh --budget 200000", "```", "", - "Requires Python 3.10+ and the green-eye tool tree. `run.sh` finds the", + "Requires Python 3.10+ and the risc-v-gsp-rm-debugger tool tree. `run.sh` finds the", "tree by walking up from this directory; set `GREENEYE_HOME=/path/to/risc-v-gsp-rm-vm`", "if the package was moved. Exit code 0 means the assertions passed (or an", "image package produced its documented blocked status), 1 means an", @@ -651,7 +651,7 @@ def run_package(out: str, *, timeout: float = DEFAULT_RUN_TIMEOUT, args: list[st def main(argv: list[str] | None = None) -> int: parser = argparse.ArgumentParser( prog="python3 harness/package_sim.py", - description="Build a self-contained green-eye trial package (simulator + injected service).", + description="Build a self-contained risc-v-gsp-rm-debugger trial package (simulator + injected service).", ) parser.add_argument("--target", choices=("demo", "image"), default="demo", help="demo uproc (default) or a real .fwimage") @@ -702,7 +702,7 @@ def main(argv: list[str] | None = None) -> int: # -- generated scenario ----------------------------------------------------- BUILTIN_SCENARIO = r'''#!/usr/bin/env python3 -"""Pre-scripted green-eye trial scenario (generated by harness/package_sim.py). +"""Pre-scripted risc-v-gsp-rm-debugger trial scenario (generated by harness/package_sim.py). Boots the packaged target on the native simulator, loads and registers the injected service, invokes it directly and through the firmware mailbox, runs @@ -725,7 +725,7 @@ SUM_A0 = 0x10 SUM_A1 = 0x20 EXPECTED_PING = PING_ARG ^ 0xBEEF EXPECTED_SUM = SUM_A0 + SUM_A1 -UART_BANNER = "GREEN-EYE UPROC DEMO v1" +UART_BANNER = "RISC-V GSP-RM DEBUGGER UPROC DEMO v1" UART_SELFTEST = "SELFTEST DONE" @@ -790,7 +790,7 @@ def hexv(value): def render_md(manifest, data): target = data.get("target", {}) - lines = ["# green-eye trial results", ""] + lines = ["# risc-v-gsp-rm-debugger trial results", ""] lines.append(f"- status: **{data.get('status')}**") lines.append(f"- target: `{target.get('file', '?')}` ({target.get('kind', '?')})") service = data.get("service") @@ -1117,7 +1117,7 @@ def run_image(pkg, manifest, budget=None): def main(argv=None): - parser = argparse.ArgumentParser(description="Run a packaged green-eye trial.") + parser = argparse.ArgumentParser(description="Run a packaged risc-v-gsp-rm-debugger trial.") parser.add_argument("--package", default=os.path.dirname(os.path.abspath(__file__))) parser.add_argument("--budget", type=int, default=None, help="image probe budget in instructions (default from manifest)") diff --git a/debug/risc-v-gsp-rm-vm/harness/port_driver_versions.py b/debug/risc-v-gsp-rm-vm/harness/port_driver_versions.py index e751d42..f12b8e9 100644 --- a/debug/risc-v-gsp-rm-vm/harness/port_driver_versions.py +++ b/debug/risc-v-gsp-rm-vm/harness/port_driver_versions.py @@ -873,7 +873,7 @@ def _table(headers: list[str], rows: list[list]) -> list[str]: def render_version_markdown(entry: dict) -> str: lines = [ - f"# green-eye port version {entry['version']}", + f"# risc-v-gsp-rm-debugger port version {entry['version']}", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/port_driver_versions.py`.", "", @@ -904,7 +904,7 @@ def render_version_markdown(entry: dict) -> str: def render_sweep_markdown(report: dict) -> str: lines = [ - "# green-eye driver-version port sweep", + "# risc-v-gsp-rm-debugger driver-version port sweep", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/port_driver_versions.py`.", "", @@ -1027,7 +1027,7 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--target", action="append", default=[], metavar="VERSION=PATH", help="explicit local target for a version (repeatable; skips discovery)") parser.add_argument("--symbols", action="append", default=[], metavar="VERSION=PATH", - help="green-eye symbol DB JSON for a version (repeatable)") + help="risc-v-gsp-rm-debugger symbol DB JSON for a version (repeatable)") parser.add_argument("--ghidra-exports", action="append", default=[], metavar="VERSION=PATH", help="Ghidra exports TSV for a version (repeatable)") parser.add_argument("--out", help="sweep output directory (required for --run)") diff --git a/debug/risc-v-gsp-rm-vm/harness/port_new_device.py b/debug/risc-v-gsp-rm-vm/harness/port_new_device.py index 56522ec..8ed1a0c 100644 --- a/debug/risc-v-gsp-rm-vm/harness/port_new_device.py +++ b/debug/risc-v-gsp-rm-vm/harness/port_new_device.py @@ -6,7 +6,7 @@ device facts (PCI IDs, BARs, FB geometry, engine inventory, interrupt topology, ROM/VBIOS notes) and then drives, on the local QEMU backend only: 1. probe-first-touch on the device's firmware (first unmapped access, bounded); -2. a symbol inventory (ELF .symtab + optional Ghidra/green-eye DB sources); +2. a symbol inventory (ELF .symtab + optional Ghidra/risc-v-gsp-rm-debugger DB sources); 3. a portability matrix run of the device against a reference firmware; 4. a port checklist report against the docs/07 evidence checklist. @@ -466,7 +466,7 @@ def build_checklist(profile: dict, firmware: str, reference: str | None, results def render_checklist_markdown(checklist: dict) -> str: lines = [ - f"# green-eye port checklist: {checklist['device']}", + f"# risc-v-gsp-rm-debugger port checklist: {checklist['device']}", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/port_new_device.py`.", "", @@ -585,7 +585,7 @@ def run_device_port(options: DeviceOptions) -> dict: def render_report_markdown(report: dict) -> str: lines = [ - f"# green-eye device port: {report['device']}", + f"# risc-v-gsp-rm-debugger device port: {report['device']}", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/port_new_device.py`.", "", @@ -643,7 +643,7 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--profile", help="profile JSON path (default: <out>/profiles/<device>.json)") parser.add_argument("--firmware", help="device GSP firmware image or re-hosted ELF (overrides profile)") parser.add_argument("--reference", help="reference firmware for the portability matrix") - parser.add_argument("--symbols", help="green-eye symbol DB JSON for the device firmware") + parser.add_argument("--symbols", help="risc-v-gsp-rm-debugger symbol DB JSON for the device firmware") parser.add_argument("--ghidra-exports", help="Ghidra exports TSV for the device firmware") parser.add_argument("--ghidra-bias", type=lambda value: int(value, 0), default=0) parser.add_argument("--out", help="evidence bundle directory (required for --run)") diff --git a/debug/risc-v-gsp-rm-vm/harness/portability_matrix.py b/debug/risc-v-gsp-rm-vm/harness/portability_matrix.py index 82af458..68ffdd3 100644 --- a/debug/risc-v-gsp-rm-vm/harness/portability_matrix.py +++ b/debug/risc-v-gsp-rm-vm/harness/portability_matrix.py @@ -8,9 +8,9 @@ each on the QEMU backend: 1. bounded probe: relocate into virt RAM and run/step a fixed budget, capturing the first exception via ``parse_qemu_faults``; 2. symbol DB build: ELF symbols plus optional Ghidra exports / an existing - green-eye JSON DB, saved per target; + risc-v-gsp-rm-debugger JSON DB, saved per target; 3. scripted demo run with handler hooks and a control-block watchpoint, - recorded as a normal green-eye session; + recorded as a normal risc-v-gsp-rm-debugger session; 4. cross-target comparison with ``greeneye.analyze.compare_sessions`` plus explicit hit/watch/write profile deltas and the docs/06 M1-M6 skeleton (metrics without a reference capture are marked "not measured"). @@ -563,11 +563,11 @@ def _profile_tables(title: str, profile: dict, max_rows: int) -> list[str]: def render_markdown(report: dict, options: MatrixOptions) -> str: lines = [ - "# green-eye portability delta report", + "# risc-v-gsp-rm-debugger portability delta report", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/portability_matrix.py`.", "", - f"* format: `{report['format']}` (green-eye {_greeneye_version()})", + f"* format: `{report['format']}` (risc-v-gsp-rm-debugger {_greeneye_version()})", f"* backend: `{report['backend']}` (qemu available: {report['qemu_available']})", f"* targets: {len(report['targets'])}", "", @@ -726,7 +726,7 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--scenario-duration", type=float, default=0.4, help="budget for each scenario phase") parser.add_argument("--max-stops", type=int, default=5000, help="safety bound on serviced stops per scenario phase") parser.add_argument("--max-rows", type=int, default=40, help="table row cap in reports") - parser.add_argument("--scenario-script", help="replace the builtin scenario with a green-eye script") + parser.add_argument("--scenario-script", help="replace the builtin scenario with a risc-v-gsp-rm-debugger script") return parser diff --git a/debug/risc-v-gsp-rm-vm/harness/reach.py b/debug/risc-v-gsp-rm-vm/harness/reach.py index 9df0c4c..68934b1 100644 --- a/debug/risc-v-gsp-rm-vm/harness/reach.py +++ b/debug/risc-v-gsp-rm-vm/harness/reach.py @@ -8,7 +8,7 @@ I trigger it, what arguments does it need, and what happens when it runs?* Methods attempted (``--method auto`` tries them in this order and stops at the first hit unless ``--all-methods`` is given): -* ``stimulus`` -- run a supplied green-eye script (``--stimulus script.py``) +* ``stimulus`` -- run a supplied risc-v-gsp-rm-debugger script (``--stimulus script.py``) or probe spec (``--probe probe.json``) under instrumentation; * ``trigger`` -- discover the dispatch entry that routes to the target (the demo's handler table), apply that command, and run bounded; @@ -671,7 +671,7 @@ def trace_window(success: Attempt | None) -> dict | None: def render_markdown(report: dict, options: ReachOptions) -> str: lines = [ - "# green-eye reachability report", + "# risc-v-gsp-rm-debugger reachability report", "", "> TOOL IN DEVELOPMENT - NOT READY YET! Generated by `harness/reach.py`.", "", @@ -874,7 +874,7 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--arg-fill", choices=("zero", "sentinel"), default="zero", help="auto-fill value policy") parser.add_argument("--timeout", type=float, default=0.5, help="per-attempt budget (seconds)") parser.add_argument("--settle", type=float, default=2.0, help="self-test settle budget before trigger") - parser.add_argument("--stimulus", help="green-eye script to run under instrumentation") + parser.add_argument("--stimulus", help="risc-v-gsp-rm-debugger script to run under instrumentation") parser.add_argument("--probe", help="JSON probe spec to replay (see --emit-probe)") parser.add_argument("--emit-probe", help="where to write the repeatable probe spec (default <out>/probe.json)") parser.add_argument("--record", nargs="?", const=True, default=None, help="record attempts under DIR/<method>") diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/README.md b/debug/risc-v-gsp-rm-vm/harness/value_demos/README.md index e1a450c..96ce4d9 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/README.md +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/README.md @@ -1,19 +1,19 @@ -# green-eye value-validation demos +# risc-v-gsp-rm-debugger value-validation demos -Runnable demonstrations that tie green-eye tool capabilities to **real** +Runnable demonstrations that tie risc-v-gsp-rm-debugger tool capabilities to **real** Open-IOV scenarios (cited from `Handoff-vGPU-IO.md` and the project docs) and measure the time-to-value against the static/Ghidra-only baseline. Each demo: * names the real scenario (handoff PART/addendum + date) and what it cost; -* prints the question, the green-eye commands used, the answer, the evidence +* prints the question, the risc-v-gsp-rm-debugger commands used, the answer, the evidence artifact and the elapsed wall-clock; * writes a machine-readable `result.json` under `artifacts/<demo>/`; * labels what is **measured on the analog** vs **projected for the real case**; device-model-blocked scenarios say so explicitly. -> green-eye is development-only tooling (docs/00); these demos never touch +> risc-v-gsp-rm-debugger is development-only tooling (docs/00); these demos never touch > hardware, a guest or a kernel module. The real `.fwimage` cannot boot > without the H2 device model (docs/06 §3), so every demo is honest about > being a *shape* reproduction on the bundled `uproc_demo` firmware + native @@ -58,7 +58,7 @@ per-demo timeout and the full suite runs in ~18 s on the reference host | s09 | `s09_grabbing_a_ghidra_address.py` | static/dynamic join; GPFIFO GET fault `0x40000` vs `0x101000` (PART 91 ADDENDUM 9 cycle 24) | hypothesis unproven until the decoded status-queue fault (8 cycles) | Ghidra addr + bias = runtime; hook hit + `greeneye_hits.tsv` (0.72 s) | | s10 | `s10_full_session_evidence.py` | evidence pack for a milestone (docs/14 §6; cycles 11–13, 2026-10-01) | hashes/sessions/logs/compare gathered by hand per cycle | one run → analyze + compare + hits + manifest + M1–M6 (4.92 s) | -Times are the measured green-eye path on the reference host (native for +Times are the measured risc-v-gsp-rm-debugger path on the reference host (native for s01–s08, QEMU for s09/s10); see `artifacts/results.json` for a fresh run. ## Projected vs measured diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/__init__.py b/debug/risc-v-gsp-rm-vm/harness/value_demos/__init__.py index 87cabe7..727f0c0 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/__init__.py +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/__init__.py @@ -1 +1 @@ -"""green-eye value-validation demos (see docs/25-VALUE-VALIDATION.md).""" +"""risc-v-gsp-rm-debugger value-validation demos (see docs/25-VALUE-VALIDATION.md).""" diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/_common.py b/debug/risc-v-gsp-rm-vm/harness/value_demos/_common.py index f70ef1f..0733c48 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/_common.py +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/_common.py @@ -1,9 +1,9 @@ #!/usr/bin/env python3 -"""Shared plumbing for the green-eye value-validation demos. +"""Shared plumbing for the risc-v-gsp-rm-debugger value-validation demos. Every demo maps one *real* Open-IOV scenario (cited from the handoffs) onto a runnable demonstration on the bundled demo firmware / native RV64 simulator, -prints the question, the green-eye commands, the answer, the evidence artifact +prints the question, the risc-v-gsp-rm-debugger commands, the answer, the evidence artifact and the measured wall-clock, and emits one machine-readable ``RESULT_JSON`` line so ``run_all.py`` can aggregate. diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/s05_snapshot_diff.py b/debug/risc-v-gsp-rm-vm/harness/value_demos/s05_snapshot_diff.py index fd89131..d6b6871 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/s05_snapshot_diff.py +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/s05_snapshot_diff.py @@ -83,7 +83,7 @@ def run() -> dict: ctrl = session.symbols.lookup("gsp_ctrl") session.run(duration=0.25) before = session.snapshot(ctrl, C.CTRL_SIZE, "before-echo") - message = b"hello-green-eye" + message = b"hello-risc-v-gsp-rm-debugger" # Locate the string literal in the loaded image so the stimulus is # self-describing (no hardcoded address). hits = session.memory.search(0x80000000, 0x2000, message) diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/s07_version_diff.py b/debug/risc-v-gsp-rm-vm/harness/value_demos/s07_version_diff.py index e4748d7..eaad957 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/s07_version_diff.py +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/s07_version_diff.py @@ -29,8 +29,8 @@ except ImportError: #: addiw a1, a1, -0x111 (the 0xbeef PING key) -> -0x110 (0xbef0) ADDW_OLD = bytes.fromhex("9b85f5ee") ADDW_NEW = bytes.fromhex("9b8505ef") -STRING_OLD = b"hello-green-eye" -STRING_NEW = b"hello-green-eyf" +STRING_OLD = b"hello-risc-v-gsp-rm-debugger" +STRING_NEW = b"hello-risc-v-gsp-rm-debuggef" def _make_variant(src: str, dst: str) -> dict: @@ -89,7 +89,7 @@ def run() -> dict: "comparison; the pairing hypothesis took cycles 2 and 3 back-to-back" ), projection=( - "green-eye cannot boot the real image without the H2 device model; " + "risc-v-gsp-rm-debugger cannot boot the real image without the H2 device model; " "the same same-stimulus/compare-sessions loop runs on re-hosted " "firmware and the produced symbol/session deltas are the H4.1 artifact" ), diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/s08_mutation_triage.py b/debug/risc-v-gsp-rm-vm/harness/value_demos/s08_mutation_triage.py index 8fcaed1..d961ee0 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/s08_mutation_triage.py +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/s08_mutation_triage.py @@ -39,7 +39,7 @@ def _probe(ge, mutation: dict, backend: str) -> dict: session.run(duration=0.15) literal = 0 if mutation.get("arg0") == "hello": - hits = session.memory.search(0x80000000, 0x2000, b"hello-green-eye") + hits = session.memory.search(0x80000000, 0x2000, b"hello-risc-v-gsp-rm-debugger") literal = hits[0] if hits else ctrl + C.CTRL_BUF before = session.memory.read_u64(ctrl + C.CTRL_RPC_COUNT) session.memory.write_u64(ctrl + C.CTRL_ARG0, literal if mutation.get("arg0") == "hello" else mutation.get("arg0", 0)) diff --git a/debug/risc-v-gsp-rm-vm/harness/value_demos/s09_grabbing_a_ghidra_address.py b/debug/risc-v-gsp-rm-vm/harness/value_demos/s09_grabbing_a_ghidra_address.py index 1577772..1d30b58 100644 --- a/debug/risc-v-gsp-rm-vm/harness/value_demos/s09_grabbing_a_ghidra_address.py +++ b/debug/risc-v-gsp-rm-vm/harness/value_demos/s09_grabbing_a_ghidra_address.py @@ -7,7 +7,7 @@ hypothesis (the GPFIFO GET encodes entry VA ``0x101000``) was only accepted after the decoded status-queue fault showed the engine actually fetched ``0x40000`` because the GET field dropped the high VA bits (fix ``6f9cbfa``). The static/dynamic join is exactly this: Ghidra owns addresses and -decompilation, green-eye answers "did it execute here". +decompilation, risc-v-gsp-rm-debugger answers "did it execute here". Analog: export a Ghidra-style ``names.tsv`` from the demo ELF *with a base offset* (the classic program-address vs runtime-address trap), load it with diff --git a/debug/risc-v-gsp-rm-vm/harness/version_diff.py b/debug/risc-v-gsp-rm-vm/harness/version_diff.py index a95f244..ccc6a15 100644 --- a/debug/risc-v-gsp-rm-vm/harness/version_diff.py +++ b/debug/risc-v-gsp-rm-vm/harness/version_diff.py @@ -8,7 +8,7 @@ of aborting the report: 1. image/shape -- entry, PT_LOAD layout, ELF section sizes, hashes, span; 2. symbol inventory -- ELF ``.symtab`` plus Ghidra names/index/exports TSVs (including the 3-column ``ExportForGreenEye`` form) and - green-eye JSON DBs; added/removed/moved/resized with + risc-v-gsp-rm-debugger JSON DBs; added/removed/moved/resized with the anonymous-shift matching discipline of ``userspace/cuda/tools/diff_corpus.py``; 3. decompiled hints -- a corpus diff over two ``decompiled_index.tsv`` files, @@ -27,11 +27,15 @@ Everything is local and stdlib-only: nothing is downloaded. The RM 610 gate Run from the tool root: python3 harness/version_diff.py --old old.elf --new new.elf --out dumps/vdiff + +``--dry-run`` prints the plan (and enforces the RM 610 gate) without opening +any target or creating ``--out``. """ from __future__ import annotations import argparse import contextlib +import json import os import re import shutil @@ -102,6 +106,7 @@ from greeneye.symbols import Symbol # noqa: E402 from greeneye.target import QemuTarget # noqa: E402 FORMAT = "greeneye-version-diff/1" +PLAN_FORMAT = "greeneye-version-diff-plan/1" RM610_DOC = "docs/23-RM610-READINESS.md" RM610_TOKEN = "RM610-APPROVED" RM610_ENV = "GREENEYE_RM610_APPROVED" @@ -1218,7 +1223,7 @@ def _hex(value) -> str: def render_markdown(report: dict, options: VersionDiffOptions) -> str: old, new = report["old"], report["new"] lines = [ - "# green-eye version diff", + "# risc-v-gsp-rm-debugger version diff", "", "> **# TOOL IN DEVELOPMENT - NOT READY YET!** Generated by `harness/version_diff.py`.", "", @@ -1413,7 +1418,7 @@ def _short_json(value, limit: int = 72) -> str: def _add_side_symbols(parser: argparse.ArgumentParser, side: str) -> None: - parser.add_argument(f"--{side}-symbols", help="green-eye symbol DB JSON for the %s target" % side) + parser.add_argument(f"--{side}-symbols", help="risc-v-gsp-rm-debugger symbol DB JSON for the %s target" % side) parser.add_argument(f"--{side}-ghidra-names", help="Ghidra names.tsv for the %s target" % side) parser.add_argument(f"--{side}-ghidra-index", help="Ghidra decompiled_index.tsv for the %s target" % side) parser.add_argument( @@ -1428,7 +1433,8 @@ def build_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser(prog="version_diff", description=__doc__.splitlines()[0]) parser.add_argument("--old", required=True, help="old target (RISC-V ELF or raw .fwimage)") parser.add_argument("--new", required=True, help="new target (RISC-V ELF or raw .fwimage)") - parser.add_argument("--out", required=True, help="output directory for the report, sessions and DBs") + parser.add_argument("--out", help="output directory for the report, sessions and DBs (required unless --dry-run)") + parser.add_argument("--dry-run", action="store_true", help="print the plan and exit without opening targets or creating --out") parser.add_argument("--old-label", help="report label for the old target (default: file stem)") parser.add_argument("--new-label", help="report label for the new target (default: file stem)") parser.add_argument("--release", help="release label; an rm610 release is gated by docs/23") @@ -1438,7 +1444,7 @@ def build_parser() -> argparse.ArgumentParser: parser.add_argument("--corpus-diff", nargs=2, metavar=("OLD_TSV", "NEW_TSV"), help="diff two decompiled_index.tsv corpus exports") parser.add_argument("--corpus-report", help="attach a previously produced corpus diff report") - parser.add_argument("--stimulus", help="green-eye script replacing the builtin demo scenario") + parser.add_argument("--stimulus", help="risc-v-gsp-rm-debugger script replacing the builtin demo scenario") parser.add_argument("--probe-instructions", type=int, default=2000, help="probe step budget (0 = wall-clock --probe-duration)") parser.add_argument("--probe-duration", type=float, default=0.5, @@ -1456,7 +1462,7 @@ def options_from_args(args: argparse.Namespace) -> VersionDiffOptions: return VersionDiffOptions( old=args.old, new=args.new, - out=os.path.abspath(args.out), + out=os.path.abspath(args.out) if args.out else "", old_label=args.old_label, new_label=args.new_label, release=args.release, @@ -1483,9 +1489,39 @@ def options_from_args(args: argparse.Namespace) -> VersionDiffOptions: ) +def build_plan(options: VersionDiffOptions) -> dict: + """Dry-run plan: gate + targets + output layout, nothing opened.""" + check_rm610_gate(options.labels(), approval_token=options.approval_token) + return { + "format": PLAN_FORMAT, + "tool": "harness/version_diff.py", + "dry_run": True, + "status": "planned", + "rm610_gate": {"status": "passed", "labels": sorted(set(options.labels()))}, + "old": {"label": options.label_for("old"), "path": options.old}, + "new": {"label": options.label_for("new"), "path": options.new}, + "out": os.path.abspath(options.out) if options.out else "<out>", + "sections": ["image", "symbols", "corpus", "probe", "behavior"], + "corpus_diff": list(options.corpus_diff) if options.corpus_diff else None, + "reports": {"json": "version-diff.json", "markdown": "version-diff.md"}, + } + + def main(argv: list[str] | None = None) -> int: parser = build_parser() args = parser.parse_args(argv) + if args.dry_run: + options = options_from_args(args) + try: + plan = build_plan(options) + except Rm610GateError as exc: + print(f"[version-diff] RM610 gate refused: {exc}", file=sys.stderr) + return 3 + print(json.dumps(plan, indent=2, sort_keys=True)) + print("[version-diff] dry-run: no target opened, nothing written") + return 0 + if not args.out: + parser.error("--out is required unless --dry-run is used") options = options_from_args(args) try: report = run_version_diff(options) |
