maze v2: reject even lr (no ARM drift)

This commit is contained in:
lumia-emu
2026-09-14 00:30:18 +00:00
parent 3d011f2994
commit d3e2efe7ba
3 changed files with 38 additions and 37 deletions
+13 -8
View File
@@ -376,18 +376,23 @@ def main():
W32(S, S + 8)
W32(S + 4, STUBV)
W32(S + 8, STUBV)
# maze blob (18B)
# maze blob (24B @STUB): movs r0,#0; return 0 via lr ONLY if lr is
# odd Thumb in DDR (top 8); even lr (stale mid-fn raw addr!) would
# ARM-drift (STM-clobbers + IMEM fault), so hang loud instead.
# Overlaps S6 head ([B9E,BA4), S6 dormant, documented).
mu.mem_write(STUB, bytes([
0x00, 0x20, 0x4f, 0xea, 0x1e, 0x6c, 0xbc, 0xf1,
0x08, 0x0f, 0x00, 0xd1, 0x70, 0x47, 0x72, 0xb6,
0xfd, 0xe7]))
print("maze-rb:", bytes(mu.mem_read(STUB, 18)).hex())
0x08, 0x0f, 0x03, 0xd1, 0x1e, 0xf0, 0x01, 0x0f,
0x00, 0xd0, 0x70, 0x47, 0x72, 0xb6, 0xfd, 0xe7]))
print("maze-rb:", bytes(mu.mem_read(STUB, 24)).hex())
for a in (0x087c29d18, 0x08050b28, 0x08070000):
W32(a, S)
# S6 stublet (14B @0x08006B9E)
mu.mem_write(0x08006B9E, bytes([
0xbd, 0xe8, 0xfc, 0x47, 0x43, 0xf6, 0xa5, 0x3e,
0xc0, 0xf6, 0x01, 0x0e, 0x70, 0x47]))
# S6 stublet DISABLED (maze v2 overlaps its head; S6 dormant,
# never entered (b14 goes to 0x8005B9E, not here). Bytes kept for
# reference (would live at 0x08006B9E):
# mu.mem_write(0x08006B9E, bytes([
# 0xbd, 0xe8, 0xfc, 0x47, 0x43, 0xf6, 0xa5, 0x3e,
# 0xc0, 0xf6, 0x01, 0x0e, 0x70, 0x47]))
# banner stub (34B @0x08006BAC, prints r0 via UARTDM)
mu.mem_write(0x08006BAC, bytes([
0x10, 0xb5, 0x4f, 0xf2, 0x00, 0x03, 0xc0, 0xf2,