b26: S17 safe-logger baked

This commit is contained in:
SashegDev
2026-09-13 12:08:22 +00:00
parent 13b314e9cf
commit 8b1eaeba18
4 changed files with 120 additions and 5 deletions
+25 -4
View File
@@ -104,15 +104,15 @@ static void saimaa_tmr_init(Object *obj)
/* Stubs region handle for set_readonly after scaffold implant. */
static MemoryRegion *saimaa_stubs_mr;
/* DDRLOW stub trap [0x08006B80,0x08006CF0): serves the scaffolded bytes
* (S/maze/S6/banner/S7/S9/S10/S16 stubs) on read/fetch, ignores SBL
/* DDRLOW stub trap [0x08006B80,0x08006D30): serves the scaffolded bytes
* (S/maze/S6/banner/S7/S9/S10/S16/S17 stubs) on read/fetch, ignores SBL
* heap-clobber writes. Uni parity: deferred-restore guard in sbl_uni.py
* (wider: [0x080068C0,0x08006CF0), also covers PBL stub).
* (wider: [0x080068C0,0x08006D30), also covers PBL stub).
* Snapshot is taken AFTER ELF load + all stub writes (readback).
* PBL stub [0x080068C0,0x080068F4) and the ELF-text gap below stay plain
* RAM: PBL runs once (if at all), gap holds real hot SBL code. */
#define SAIMAA_DSTUB_BASE 0x08006B80
#define SAIMAA_DSTUB_SIZE 0x00000170
#define SAIMAA_DSTUB_SIZE 0x000001B0
static uint8_t saimaa_dstub_mem[SAIMAA_DSTUB_SIZE];
static uint64_t saimaa_dstub_read(void *opaque, hwaddr off, unsigned size)
@@ -692,6 +692,27 @@ static void saimaa_machine_init(MachineState *machine)
cpu_physical_memory_write(0x08006C88 + k, &word, 4);
}
}
/* S17 safe-logger (50B @0x08006CF0, b26): print r1-string
* via UARTDM-TF iff r1 in rodata [0x804B800,0x8058000);
* pop-return (no leak). Replaces S8 silence with logs. */
{
static const uint8_t s17[] = {
0x4b, 0xf6, 0x00, 0x03, 0xc0, 0xf6, 0x04, 0x03,
0x99, 0x42, 0x11, 0xd3, 0x48, 0xf2, 0x00, 0x03,
0xc0, 0xf6, 0x05, 0x03, 0x99, 0x42, 0x0b, 0xd2,
0x10, 0xb5, 0x4f, 0xf2, 0x00, 0x03, 0xc0, 0xf2,
0x8a, 0x73, 0x0c, 0x46, 0x14, 0xf8, 0x01, 0x0b,
0x08, 0xb1, 0x18, 0x67, 0xfa, 0xe7, 0x10, 0xbd,
0x70, 0x47,
};
size_t k;
for (k = 0; k < sizeof(s17); k += 4) {
uint32_t word = 0;
size_t n = sizeof(s17) - k < 4 ? sizeof(s17) - k : 4;
__builtin_memcpy(&word, &s17[k], n);
cpu_physical_memory_write(0x08006CF0 + k, &word, 4);
}
}
/* PBL version-table fabrication (b23): [0x080528D0] = STUBV
* so the rollback query's blx calls maze (0 = versions OK). */
{