Files
rk3588-ddr-analysis/benchmark/04_train_phy_block/func.s
T
marfrit 00d655187a benchmark/: three-way RE-tool comparison + first real C-lift
Three small functions extracted from the v1.19 conservative blob with
ground-truth C and per-tool (Ghidra / retdec / decomp.me) docs:
  01_memset        — byte memset, 28 B
  02_memcpy32      — word-aligned memcpy, 36 B
  03_magic_memset  — magic check + tail-call to memset, 40 B
  04_train_phy_block — first real poll-site function (104 B, 26 insts),
                       contains poll sites 12-15

Results in RESULTS.md:
  - Ghidra: A on all four. Auto-decompile is close to final.
  - retdec: A on #3, F on #1 and #2 (no register-arg inference on raw),
    C on #4 (mistakes & 0xF0000000 for < 0x10000000).

GRIND_LOG.md (in 04_train_phy_block/) records the matching-decomp
iteration: 116-byte candidate.c at -Os vs vendor 104 bytes = 89.7%
size match on first real iteration. Remaining gap is GCC's choice of
`cmp w, w_const; b.ls` over vendor's `tst w, #imm; b.eq` for the
mask tests.

gdb_debug/ holds a native-aarch64 GDB single-stepper for the three
benchmark functions — boltzmann smoke test passed (memset:
buf[10] 0x00→0xab).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 07:26:23 +02:00

34 lines
1.2 KiB
ArmAsm

func.bin: file format binary
Disassembly of section .data:
000000000000d328 <.data>:
d328: f9405c00 ldr x0, [x0, #184]
d32c: 32048fe1 mov w1, #0xf000f000 // #-268374016
d330: 91402000 add x0, x0, #0x8, lsl #12
d334: b9011001 str w1, [x0, #272]
d338: b9411801 ldr w1, [x0, #280]
d33c: 72040c3f tst w1, #0xf0000000
d340: 54ffffc0 b.eq 0xd338 // b.none
d344: b9412001 ldr w1, [x0, #288]
d348: 72040c3f tst w1, #0xf0000000
d34c: 54ffffc0 b.eq 0xd344 // b.none
d350: 320087e1 mov w1, #0x30003 // #196611
d354: b9016001 str w1, [x0, #352]
d358: b9015401 str w1, [x0, #340]
d35c: b9418401 ldr w1, [x0, #388]
d360: f240043f tst x1, #0x3
d364: 54ffffc0 b.eq 0xd35c // b.none
d368: 52a00061 mov w1, #0x30000 // #196608
d36c: b9015401 str w1, [x0, #340]
d370: b9418401 ldr w1, [x0, #388]
d374: f240043f tst x1, #0x3
d378: 54ffffc1 b.ne 0xd370 // b.any
d37c: 52a00061 mov w1, #0x30000 // #196608
d380: b9016001 str w1, [x0, #352]
d384: 52be0001 mov w1, #0xf0000000 // #-268435456
d388: b9011001 str w1, [x0, #272]
d38c: d65f03c0 ret