sbl b13: NOP null-struct strb; vec trap banked regs+BKPT

This commit is contained in:
SashegDev
2026-09-11 06:24:09 +00:00
parent 8ae06cf1c8
commit 61a0b724ff
2 changed files with 24 additions and 0 deletions
+2
View File
@@ -442,6 +442,8 @@ static void saimaa_machine_init(MachineState *machine)
cpu_physical_memory_write(0x085FFF5C, &v, 4);
v = 0x8016183; /* S5 pop10 @ff50: 0x8013ae4 caller */
cpu_physical_memory_write(0x085FFF74, &v, 4);
v = 0x8013ba5; /* S6 ldmia.w @7afc: sp=0x85fff20, pc=[+36] */
cpu_physical_memory_write(0x085FFF44, &v, 4);
{ /* words that popped regs must read as 0 (not stub-fill) */
uint32_t z = 0;
cpu_physical_memory_write(0x085FFF58, &z, 4); /* r7 src */
+22
View File
@@ -133,6 +133,28 @@ def main():
assert d[o:o + 4].hex() == '07f026be', hx(d, 0x8013AA8)
d[o:o + 4] = bytes.fromhex('c046c046')
save(d, 'img0_b12.elf')
# b13 = b12 + NOP strb.w fp,[r1,#-7]! at 0x8006684 (helper stores
# fp into struct r1, but r1 arrives NULL from 0x8007e82 chain;
# store to [0-7]=0xfffffff9 faults; struct unrecoverable here)
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'),
(0x8006684, '01f807bd', '46c046c0'),
]:
assert hx(d, va) == exp, (hex(va), hx(d, va))
set4(d, va, new)
o = off(0x8013AA8)
assert d[o:o + 4].hex() == '07f026be', hx(d, 0x8013AA8)
d[o:o + 4] = bytes.fromhex('c046c046')
save(d, 'img0_b13.elf')
if __name__ == '__main__':