b37: S20 clock-dispatcher router
This commit is contained in:
@@ -2171,6 +2171,129 @@ def main():
|
||||
|
||||
save(d, 'img0_b36.elf')
|
||||
|
||||
# b37 = b36 + S20 clock-dispatcher router (0x800EB96 pop.w -> b.w):
|
||||
# naked dispatcher (no pushes!) pops 0x30/pass, marching sp to IMEM
|
||||
# top. S20 (34B @0x08006D38, scaffold): [sp+0x2C] valid-code?
|
||||
# original pop.w (legit return); else r0=sl + re-run (idempotent).
|
||||
d = bytearray(base)
|
||||
|
||||
for va, (a, b) in BLX2BL.items():
|
||||
|
||||
set4(d, va, b)
|
||||
|
||||
for va, exp, new in [
|
||||
|
||||
(0x802F664, 'e4f77efc', 'c046c046'),
|
||||
|
||||
(0x802F672, 'e6f7bbfa', 'c046c046'),
|
||||
|
||||
(0x802F678, 'e9f7fef9', 'c046c046'),
|
||||
|
||||
(0x801B71E, '9847fee7', 'c046c046'),
|
||||
|
||||
(0x8008396, 'fef780f9', 'c046c046'),
|
||||
|
||||
(0x8016184, 'fdf790fc', 'c046c046'),
|
||||
|
||||
(0x801B76C, '280b0508', '00000708'),
|
||||
|
||||
(0x8017AFC, 'bde8fc87', 'eef74fb8'),
|
||||
|
||||
(0x802F690, '9847fee7', 'c046c046'),
|
||||
|
||||
(0x801671C, '9847fee7', 'c046c046'),
|
||||
|
||||
(0x8013BAC, 'f8bd0a4a', 'f3f730b8'),
|
||||
|
||||
(0x801B6BE, 'bde8f081', 'ebf7c3ba'),
|
||||
|
||||
(0x8016720, '10bd0000', 'f0f7b2ba'),
|
||||
|
||||
(0x8034810, 'bde8fc87', 'd2f76eba'),
|
||||
|
||||
(0x8007798, 'bde8f08f', 'fff7c3ba'),
|
||||
|
||||
(0x8016334, 'f0f7a4ff', 'c046c046'),
|
||||
|
||||
(0x8016342, 'f0f79eef', 'f0f79dbf'),
|
||||
|
||||
(0x802F9A0, 'ffe70648', 'd7f7c4b9'),
|
||||
|
||||
(0x802F9B2, 'fee78817', 'd7f7bbb9'),
|
||||
|
||||
(0x802F9A2, 'c4b943f2', 'd7f7c3b9'),
|
||||
|
||||
(0x800EB96, 'bde8fe8f', 'f8f7cfb8'),
|
||||
|
||||
]:
|
||||
|
||||
assert hx(d, va) == exp, (hex(va), hx(d, va))
|
||||
|
||||
set4(d, va, new)
|
||||
|
||||
# Full bl idiom at 0x8006682 (bl + pop, 6B) -> NOPs (see b18).
|
||||
o = off(0x8006682)
|
||||
|
||||
assert d[o:o + 6].hex() == '00f001f807bd', hx(d, 0x8006682, 6)
|
||||
|
||||
d[o:o + 6] = bytes.fromhex('c046c046c046')
|
||||
|
||||
o = off(0x8013AA8)
|
||||
|
||||
assert d[o:o + 4].hex() == '07f026be', hx(d, 0x8013AA8)
|
||||
|
||||
d[o:o + 4] = bytes.fromhex('c046c046')
|
||||
|
||||
o = off(0x8013BA6)
|
||||
|
||||
assert d[o:o + 2].hex() == 'b888', (hex(0x8013BA6), hx(d, 0x8013BA6, 2))
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('ff20')
|
||||
|
||||
# Helper-pop S16 chain (see b25).
|
||||
o = off(0x8007B66)
|
||||
|
||||
assert d[o:o + 2].hex() == '10bd', hx(d, 0x8007B66, 2)
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('6047')
|
||||
|
||||
# Clock S11 (see b24).
|
||||
o = off(0x800E988)
|
||||
|
||||
assert d[o:o + 2].hex() == '10bd', hx(d, 0x800E988, 2)
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('7047')
|
||||
|
||||
# Poll re-init skip (see b27).
|
||||
o = off(0x8007748)
|
||||
|
||||
assert d[o:o + 2].hex() == '96b1', hx(d, 0x8007748, 2)
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('14e0')
|
||||
|
||||
# Poll-epilogue add NOP (see b28).
|
||||
o = off(0x8007794)
|
||||
|
||||
assert d[o:o + 2].hex() == '07b0', hx(d, 0x8007794, 2)
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('c046')
|
||||
|
||||
# Partition wrap-check (see b33).
|
||||
o = off(0x801844E)
|
||||
|
||||
assert d[o:o + 2].hex() == '04d3', hx(d, 0x801844E, 2)
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('04e0')
|
||||
|
||||
# Hang-site neutralize (see b34).
|
||||
o = off(0x8018458)
|
||||
|
||||
assert d[o:o + 2].hex() == 'fee7', hx(d, 0x8018458, 2)
|
||||
|
||||
d[o:o + 2] = bytes.fromhex('ffe7')
|
||||
|
||||
save(d, 'img0_b37.elf')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user