Files
xenia-rs/audit-runs/audit-026-mem-diff/page_diffs.py
MechaCat02 8e709b0a24 chore: track audit-runs summary artifacts (md/csv/diff/txt/json/etc)
Snapshot of every non-log artifact under audit-runs/ from audits 003
through 058: findings.md per audit, comparison CSVs, probe diffs,
schema docs, register-dump txts, lr-trace JSONL streams, the saved
canary patch diffs, etc. ~284 files / ~52 MB total.

Excluded (per .gitignore): probe stdout/stderr/log streams (the raw
firehose), guest-memory dumps under audit-026/027/029 (4.5 GB of
.bin files; *.bin pattern added to .gitignore this commit).

Also adds the orphan audit-058-sub825070F0-activation directory that
a subagent accidentally created at project-root instead of
under xenia-rs/audit-runs/; relocated to its proper home.

Purpose: cross-machine continuity. With these summaries committed,
a fresh clone gives the next session the full per-audit context
(findings + tables + cascade predictions) without dependence on
local-only working tree.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 21:36:41 +02:00

62 lines
2.2 KiB
Python

#!/usr/bin/env python3
"""Identify the 7 differing 64KB pages and dump per-page summaries."""
import struct
import os
here = os.path.dirname(os.path.abspath(__file__))
canary = open(os.path.join(here, "canary-v80.bin"), "rb").read()
ours = open(os.path.join(here, "ours-v80.bin"), "rb").read()
PG = 65536
PC_LO, PC_HI = 0x82000000, 0x82A00000
V80 = 0x80000000
print("=== differing 64KB pages ===\n")
for i in range(0, len(canary), PG):
if not any(canary[i:i+PG]) and not any(ours[i:i+PG]):
continue
if canary[i:i+PG] == ours[i:i+PG]:
continue
page_addr = V80 + i
# count differing dwords
diffs = 0
pc_diffs_canary = 0
pc_diffs_ours = 0
for j in range(0, PG, 4):
cdw = struct.unpack_from(">I", canary, i+j)[0]
odw = struct.unpack_from(">I", ours, i+j)[0]
if cdw != odw:
diffs += 1
if PC_LO <= cdw < PC_HI:
pc_diffs_canary += 1
if PC_LO <= odw < PC_HI:
pc_diffs_ours += 1
cnz = sum(1 for b in canary[i:i+PG] if b != 0)
onz = sum(1 for b in ours[i:i+PG] if b != 0)
print(f"page {page_addr:#010x}: {diffs} diff dwords, canary_nz={cnz}, ours_nz={onz}, "
f"PCs_in_diffs(canary={pc_diffs_canary}, ours={pc_diffs_ours})")
print("\n=== detailed dump: first 64 differing dwords per page ===")
for i in range(0, len(canary), PG):
if canary[i:i+PG] == ours[i:i+PG]:
continue
if not any(canary[i:i+PG]) and not any(ours[i:i+PG]):
continue
page_addr = V80 + i
print(f"\n--- page {page_addr:#010x} ---")
shown = 0
for j in range(0, PG, 4):
cdw = struct.unpack_from(">I", canary, i+j)[0]
odw = struct.unpack_from(">I", ours, i+j)[0]
if cdw != odw:
addr = V80 + i + j
shown += 1
print(f" +{j:#06x}={addr:#010x}: canary={cdw:#010x} ours={odw:#010x}")
if shown >= 64:
# report total remaining
remaining = sum(1 for k in range(j+4, PG, 4)
if struct.unpack_from(">I", canary, i+k)[0] !=
struct.unpack_from(">I", ours, i+k)[0])
print(f" ... and {remaining} more on this page")
break