qvm: recover override map command bytes
Browse files- docs/FINDINGS.md +3 -0
- docs/PROVISIONAL_TODO.md +3 -0
- docs/RESEARCH_LEDGER.md +5 -0
- docs/REVERSE_ENGINEERING_TODO.md +3 -0
- docs/research/QVM_MAP_SELECT.md +7 -0
- docs/research/README.md +3 -0
- docs/research/qvm-map-select.json +0 -0
- scripts/analyze_qvm_map_select.py +15 -0
- scripts/qvm_map_commands_support.py +16 -0
- scripts/test_qvm_map_select.py +14 -0
- xtask/checks.tsv +4 -0
docs/FINDINGS.md
CHANGED
|
@@ -1607,3 +1607,6 @@ RE-813–822 replaces the scoreboard decimal assumption with actual37914 executi
|
|
| 1607 |
|
| 1608 |
|
| 1609 |
**RE-869:** Rust matches192 original rotation cases, preserving signed cursor wrap, enable/threshold gating, refreshed filename C-string handling and ordered refresh/write/clear/reset intentions. Engine refresh input is explicit; invalid refreshed data rejects before boundary mutations. Native callbacks remain unimplemented. [Evidence](research/RUST_ROTATION_ADVANCE.md).
|
|
|
|
|
|
|
|
|
|
|
|
| 1607 |
|
| 1608 |
|
| 1609 |
**RE-869:** Rust matches192 original rotation cases, preserving signed cursor wrap, enable/threshold gating, refreshed filename C-string handling and ordered refresh/write/clear/reset intentions. Engine refresh input is explicit; invalid refreshed data rejects before boundary mutations. Native callbacks remain unimplemented. [Evidence](research/RUST_ROTATION_ADVANCE.md).
|
| 1610 |
+
|
| 1611 |
+
|
| 1612 |
+
**RE-870:** 90 original7188 cases compose actual strlen, bounded-copy wrapper and original formatter. A nonempty override mirror records current engine mapname in g_nextCycleMap, copies the override into a127-byte local command buffer, requests engine g_NextMap clear and emits mode2 map command. VM mirror bytes remain unchanged; engine/native-copy and lower effects remain supplied/captured. [Evidence](research/QVM_MAP_SELECT.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -1632,3 +1632,6 @@ RE-868: 192 original122230 cases execute actual strlen and recover signed counte
|
|
| 1632 |
|
| 1633 |
|
| 1634 |
RE-869: Rust matches192 original rotation cases, preserving signed cursor wrap, enable/threshold gating, refreshed filename C-string handling and ordered refresh/write/clear/reset intentions. Engine refresh input is explicit; invalid refreshed data rejects before boundary mutations. Native callbacks remain unimplemented. Full runtime completion remains open. [Evidence](research/RUST_ROTATION_ADVANCE.md).
|
|
|
|
|
|
|
|
|
|
|
|
| 1632 |
|
| 1633 |
|
| 1634 |
RE-869: Rust matches192 original rotation cases, preserving signed cursor wrap, enable/threshold gating, refreshed filename C-string handling and ordered refresh/write/clear/reset intentions. Engine refresh input is explicit; invalid refreshed data rejects before boundary mutations. Native callbacks remain unimplemented. Full runtime completion remains open. [Evidence](research/RUST_ROTATION_ADVANCE.md).
|
| 1635 |
+
|
| 1636 |
+
|
| 1637 |
+
RE-870: 90 original7188 cases compose actual strlen, bounded-copy wrapper and original formatter. A nonempty override mirror records current engine mapname in g_nextCycleMap, copies the override into a127-byte local command buffer, requests engine g_NextMap clear and emits mode2 map command. VM mirror bytes remain unchanged; engine/native-copy and lower effects remain supplied/captured. Full runtime completion remains open. [Evidence](research/QVM_MAP_SELECT.md).
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -2046,3 +2046,8 @@ Rust matches128 continuous source camera/fallback/placement cases with shared RN
|
|
| 2046 |
## 2026-10-27 — RE-869 Rust refreshed rotation callback policy
|
| 2047 |
|
| 2048 |
Rust matches192 original rotation cases, preserving signed cursor wrap, enable/threshold gating, refreshed filename C-string handling and ordered refresh/write/clear/reset intentions. Engine refresh input is explicit; invalid refreshed data rejects before boundary mutations. Native callbacks remain unimplemented. Focused `cargo xtask test-group rust-rotation-advance` passes (9 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2046 |
## 2026-10-27 — RE-869 Rust refreshed rotation callback policy
|
| 2047 |
|
| 2048 |
Rust matches192 original rotation cases, preserving signed cursor wrap, enable/threshold gating, refreshed filename C-string handling and ordered refresh/write/clear/reset intentions. Engine refresh input is explicit; invalid refreshed data rejects before boundary mutations. Native callbacks remain unimplemented. Focused `cargo xtask test-group rust-rotation-advance` passes (9 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
|
| 2049 |
+
|
| 2050 |
+
|
| 2051 |
+
## 2026-10-27 — RE-870 Original map command branch with recovered copy and formatter
|
| 2052 |
+
|
| 2053 |
+
90 original7188 cases compose actual strlen, bounded-copy wrapper and original formatter. A nonempty override mirror records current engine mapname in g_nextCycleMap, copies the override into a127-byte local command buffer, requests engine g_NextMap clear and emits mode2 map command. VM mirror bytes remain unchanged; engine/native-copy and lower effects remain supplied/captured. Focused `cargo xtask test-group map-select` passes (5 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
|
docs/REVERSE_ENGINEERING_TODO.md
CHANGED
|
@@ -1669,3 +1669,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
|
|
| 1669 |
|
| 1670 |
|
| 1671 |
- [x] RE-869 Rust refreshed rotation callback policy ([evidence](research/RUST_ROTATION_ADVANCE.md)).
|
|
|
|
|
|
|
|
|
|
|
|
| 1669 |
|
| 1670 |
|
| 1671 |
- [x] RE-869 Rust refreshed rotation callback policy ([evidence](research/RUST_ROTATION_ADVANCE.md)).
|
| 1672 |
+
|
| 1673 |
+
|
| 1674 |
+
- [x] RE-870 Original map command branch with recovered copy and formatter ([evidence](research/QVM_MAP_SELECT.md)).
|
docs/research/QVM_MAP_SELECT.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Original map command branch with recovered copy and formatter
|
| 2 |
+
|
| 3 |
+
RE-870. Reproduce with `python3 scripts/analyze_qvm_map_select.py`; focused validation: `cargo xtask test-group map-select`. [Machine report](qvm-map-select.json).
|
| 4 |
+
|
| 5 |
+
90 original7188 cases compose actual strlen, bounded-copy wrapper and original formatter. A nonempty override mirror records current engine mapname in g_nextCycleMap, copies the override into a127-byte local command buffer, requests engine g_NextMap clear and emits mode2 map command. VM mirror bytes remain unchanged; engine/native-copy and lower effects remain supplied/captured.
|
| 6 |
+
|
| 7 |
+
Original executable/native runtime and complete Linux/macOS Rust/Bevy/Solari acceptance remain unverified.
|
docs/research/README.md
CHANGED
|
@@ -1205,3 +1205,6 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 1205 |
|
| 1206 |
|
| 1207 |
[RE-869: Rust refreshed rotation callback policy](RUST_ROTATION_ADVANCE.md).
|
|
|
|
|
|
|
|
|
|
|
|
| 1205 |
|
| 1206 |
|
| 1207 |
[RE-869: Rust refreshed rotation callback policy](RUST_ROTATION_ADVANCE.md).
|
| 1208 |
+
|
| 1209 |
+
|
| 1210 |
+
[RE-870: Original map command branch with recovered copy and formatter](QVM_MAP_SELECT.md).
|
docs/research/qvm-map-select.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/analyze_qvm_map_select.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
import itertools
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
from qvm_research_support import source
|
| 5 |
+
from qvm_map_commands_support import map_seed,select_map,MIRROR,D
|
| 6 |
+
from qvm_byte_memory_support import read_bytes
|
| 7 |
+
from qvm_string_memory_support import cstring
|
| 8 |
+
from analyze_qvm import write_json
|
| 9 |
+
|
| 10 |
+
def main():
|
| 11 |
+
q,raw,h,ins=source();rows=[]
|
| 12 |
+
for mirror,current,fallback in itertools.product([b'',b'cycle',b'\0tail',b'\xff',b'A'*129],[b'',b'abbey',b'x\0tail',b'\xff',b'z'*127,b'z'*128],[-1,0,1]):
|
| 13 |
+
m,b=map_seed(raw,h,mirror);guard=read_bytes(m,b,MIRROR+128,16);before=read_bytes(m,b,MIRROR,128);m,p,b=select_map(ins,m,b,current,fallback);commands=[v['text'] for v in p['operations'] if v['op']=='command'];p.update(input=dict(mirror=mirror.hex(),current=current.hex(),fallback=fallback),mirror=cstring(m,b,MIRROR).hex(),command=commands[0] if commands else None,buffer=read_bytes(m,b,MIRROR,128).hex(),buffer_before=before.hex(),local_buffer=read_bytes(m,b,D+0x2000+24,128).hex() if commands else None,guard_before=guard.hex(),guard_after=read_bytes(m,b,MIRROR+128,16).hex(),ring=m[23708]&0xffffffff);rows.append(p)
|
| 14 |
+
write_json(Path('docs/research/qvm-map-select.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Actual7188 with actual36038/69338/70458/37914 over90 cases.128-byte engine buffer and native-103 strncpy remain supplied/modeled. Captured cvar sets and mode2 command;221662 return supplied. Override mirror gate, source-to-local copy and requested mapname/cvar strings verified; no native execution/runtime claim.'})
|
| 15 |
+
if __name__=='__main__':main()
|
scripts/qvm_map_commands_support.py
CHANGED
|
@@ -28,3 +28,19 @@ def rotation(ins,m,b,updated):
|
|
| 28 |
return m,0,{'external_effect_captured':True}
|
| 29 |
return call
|
| 30 |
m,v,p,b=run(ins,m,122230,122286,24,b=b,handlers={-5:refresh,36038:strlen,122143:capture(122143),-6:capture(-6),121987:capture(121987)},base=D);p.update(requests=requests,operations=operations);return m,p,b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
return m,0,{'external_effect_captured':True}
|
| 29 |
return call
|
| 30 |
m,v,p,b=run(ins,m,122230,122286,24,b=b,handlers={-5:refresh,36038:strlen,122143:capture(122143),-6:capture(-6),121987:capture(121987)},base=D);p.update(requests=requests,operations=operations);return m,p,b
|
| 31 |
+
|
| 32 |
+
def map_seed(raw,h,mirror):
|
| 33 |
+
m,b=formatter_env(raw,h);m[23708]=0;put_string(m,b,34728,image_bytes(raw,h,34728).split(b'\0')[0]);put_string(m,b,MIRROR,mirror,256);return m,b
|
| 34 |
+
|
| 35 |
+
def select_map(ins,m,b,current,fallback=0):
|
| 36 |
+
requests=[];operations=[];formatted=[]
|
| 37 |
+
def read(i,m,a,bs):
|
| 38 |
+
data=current.split(b'\0')[0][:127];cells={a[12]+j:v for j,v in enumerate((data+b'\0').ljust(128,b'\0'))};requests.append({'target':-8,'arguments':a});operations.append({'op':'read-map','text':data.hex()});return m,0,{'engine_buffer_supplied':True,'child_memory_bytes':cells}
|
| 39 |
+
def set_cvar(i,m,a,bs):
|
| 40 |
+
requests.append({'target':-6,'arguments':a});operations.append({'op':'set-cycle','value':cstring(m,bs,a[12]).hex()} if a[8]==34736 else {'op':'clear-next'});return m,0,{'cvar_set_captured':True}
|
| 41 |
+
def copy(i,m,a,bs):requests.append({'target':69338,'arguments':a});return copy_bounded(i,m,a,dict(bs))
|
| 42 |
+
def format(i,m,a,bs):
|
| 43 |
+
requests.append({'target':70458,'arguments':a});m,v,p=final_format(i,m,a,dict(bs),formatter);formatted.append(p['wrapper_trace_sha256']);return m,v,p
|
| 44 |
+
def command(i,m,a,bs):requests.append({'target':-15,'arguments':a});operations.append({'op':'command','mode':a[8],'text':cstring(m,bs,a[12]).hex()});return m,0,{'command_captured':True}
|
| 45 |
+
def choose(i,m,a,bs):requests.append({'target':221662,'arguments':a});operations.append({'op':'fallback'});return m,fallback,{'selection_return_supplied':True}
|
| 46 |
+
m,v,p,b=run(ins,m,7188,7257,156,b=b,handlers={36038:strlen,-8:read,-6:set_cvar,69338:copy,70458:format,-15:command,221662:choose},base=D+0x2000);p.update(requests=requests,operations=operations,format_traces=formatted);return m,p,b
|
scripts/test_qvm_map_select.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json,unittest
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
class MapSelectTests(unittest.TestCase):
|
| 4 |
+
def test_mirror_gate_engine_truncation_and_actual_command_bytes(self):
|
| 5 |
+
rows=json.loads(Path('docs/research/qvm-map-select.json').read_text())['probes'];self.assertEqual(len(rows),90)
|
| 6 |
+
for p in rows:
|
| 7 |
+
a=p['input'];before=bytes.fromhex(a['mirror']).split(b'\0')[0];current=bytes.fromhex(a['current']).split(b'\0')[0][:127];command=b'map '+before[:127]+b'\n' if before else None;ops=[{'op':'read-map','text':current.hex()},{'op':'set-cycle','value':current.hex()},{'op':'clear-next'},{'op':'command','mode':2,'text':command.hex()}] if before else [{'op':'fallback'}];self.assertEqual(p['operations'],ops);self.assertEqual(p['mirror'],before.hex());self.assertEqual(p['command'],command.hex() if command is not None else None);self.assertEqual(p['ring'],int(bool(before)))
|
| 8 |
+
def test_buffer_guard_formatter_and_internal_abi_order(self):
|
| 9 |
+
for p in json.loads(Path('docs/research/qvm-map-select.json').read_text())['probes']:
|
| 10 |
+
active=bool(bytes.fromhex(p['input']['mirror']).split(b'\0')[0]);self.assertEqual(p['guard_before'],p['guard_after']);self.assertEqual([r['target'] for r in p['requests']],[-8,-6,69338,-6,70458,-15] if active else [221662]);self.assertEqual(len(p['format_traces']),int(active))
|
| 11 |
+
self.assertEqual(p['buffer'],p['buffer_before'])
|
| 12 |
+
if active:
|
| 13 |
+
self.assertEqual(bytes.fromhex(p['local_buffer']),(bytes.fromhex(p['mirror'])[:127]+b'\0').ljust(128,b'\0'));self.assertEqual(p['requests'][2]['arguments'],{'8':p['requests'][0]['arguments']['12'],'12':34067112,'16':128})
|
| 14 |
+
if __name__=='__main__':unittest.main()
|
xtask/checks.tsv
CHANGED
|
@@ -2480,3 +2480,7 @@ edge docs/research/rust-rotation-advance.json scripts/test_rust_rotation_advance
|
|
| 2480 |
group rust-rotation-advance scripts/analyze_rust_rotation_advance.py
|
| 2481 |
edge scripts/analyze_rust_rotation_advance.py scripts/analyze_qvm_resumer_audit.py
|
| 2482 |
edge scripts/rust_map_commands_support.py scripts/analyze_qvm_resumer_audit.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2480 |
group rust-rotation-advance scripts/analyze_rust_rotation_advance.py
|
| 2481 |
edge scripts/analyze_rust_rotation_advance.py scripts/analyze_qvm_resumer_audit.py
|
| 2482 |
edge scripts/rust_map_commands_support.py scripts/analyze_qvm_resumer_audit.py
|
| 2483 |
+
report scripts/analyze_qvm_map_select.py docs/research/qvm-map-select.json
|
| 2484 |
+
edge docs/research/qvm-map-select.json scripts/test_qvm_map_select.py
|
| 2485 |
+
group map-select scripts/analyze_qvm_map_select.py
|
| 2486 |
+
edge scripts/analyze_qvm_map_select.py scripts/analyze_qvm_resumer_audit.py
|