b21: logger S8 (pop.w -> bx lr)
This commit is contained in:
@@ -661,6 +661,75 @@ def main():
|
|||||||
|
|
||||||
save(d, 'img0_b20.elf')
|
save(d, 'img0_b20.elf')
|
||||||
|
|
||||||
|
# b21 = b18 + logger S8 (0x8034810 pop.w -> bx lr):
|
||||||
|
# the logger is a naked pop.w {r2-r8,sb,sl,pc} (0x28) with no push;
|
||||||
|
# called via bl from scaffold-frame workers, it eats 0x28 of live
|
||||||
|
# stack per call (slots->fill->zeros->null-loop->IMEM overflow).
|
||||||
|
# S8 turns it into a no-op return (bx lr, 2B; tail bytes unreachable):
|
||||||
|
# return value ignored (callers set r0=0 after), workers unwind via
|
||||||
|
# their own epilogue pops. Logging already empty (UART stubs).
|
||||||
|
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'),
|
||||||
|
|
||||||
|
(0x8013BAC, 'f8bd0a4a', 'f3f730b8'),
|
||||||
|
|
||||||
|
]:
|
||||||
|
|
||||||
|
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')
|
||||||
|
|
||||||
|
# Logger S8: pop.w entry (4B bde8fc87) -> bx lr (first 2B).
|
||||||
|
o = off(0x8034810)
|
||||||
|
|
||||||
|
assert d[o:o + 4].hex() == 'bde8fc87', hx(d, 0x8034810)
|
||||||
|
|
||||||
|
d[o:o + 2] = bytes.fromhex('7047')
|
||||||
|
|
||||||
|
save(d, 'img0_b21.elf')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user