Commit Graph
24 Commits
Author SHA1 Message Date
YAO Changsong 9574a2f728 Drop the constants a skipped AArch64 page load overwrites (R3.11) (#1764) (#1764)
AArch64 page loads and import-slot loads are shown through what uses them, but skipping them also skipped forgetting what their destination held, so movz x9; adrp x9; movk x9 folded the MOVK with a constant the page load had replaced, and an argument register reloaded by adrp could show its old value. Those loads now forget every register they write.
2026-11-12 17:47:38 +07:00
YAO Changsong b82f43a4ae Fold an AArch64 MOVZ/MOVK pair into one constant (R3.11) (#1761) (#1761)
mov w9, #0x2493 followed by movk w9, #0x9249, lsl #16 now lifts to pseudo-C as the one constant it builds (w9 = 0x92492493;) instead of two statements, through a full 64-bit chain of MOVKs too; a W pair stays 32-bit, and the two statements stay when anything reads or writes the register between them.
2026-11-12 17:21:42 +07:00
YAO Changsong bd72993604 Keep the extension on AArch64 memory index operands (R3.11) (#1745) (#1745)
A register-offset AArch64 memory operand such as ldr w0, [x1, w2, sxtw #2] now keeps its index at its written width with its extension or shift, so pseudo-C shows the sign-extended index ((int64_t)(int32_t)w2 << 2) instead of a plain unsigned x2 * 4. An unchanged index stays plain, and x86 scaled indices render as before.
2026-11-12 14:54:11 +07:00
htjulia 0453ec4a9b Keep the shift on AArch64 shifted and extended register operands (R3.11) (#1729)
Shifted-register operands lost their shift and extended registers their extension, so add w9, w10, w9, lsr #31 read as w9 = w10 + w9; and sub w9, w9, w9, lsl #3 as w9 -= w9; (#1725). Operands now carry a shift or extension (LSL, LSR, ASR, ROR and the eight extensions), dropped only when it changes nothing, and pseudo-C spells out what C needs, such as ((uint32_t)w9 >> 31) and sign or zero extension before a shift.
2026-11-12 12:07:02 +07:00
htjulia b2c221971a Keep the value of AArch64 MOVK and MOVN immediates (R3.11) (#1728)
MOVK replaces 16 bits and keeps the rest, but lifted as a whole move (mov w9, #0x2493; movk w9, #0x9249, lsl #16 read as w9 = 0x92490000;), and MOVN's value is the inverted immediate but lifted as the immediate (mov w0, #-1 read as w0 = 0;) (#1724). MOVK now decodes as an insert carrying the shifted immediate and the mask of the bits kept, printed as w9 = (w9 & 0xffff) | 0x92490000;, and MOVN carries the inverted value, shown for a W register as the signed value the assembler shows.
2026-11-12 12:06:44 +07:00
htjulia 96bf9c2017 Move the source, not the zero register, in AArch64 move aliases (R3.11) (#1727)
mov xd, xm and mov wd, #bitmask are ORR from the zero register, and the lifter took the zero register as the value moved, so mov x19, x0 read as x19 = xzr; and a loop then read from address 0 (#1723). The A64 decoder now recognises the ORR form of mov from its operands, with or without formatted text, and keeps only the destination and the moved value; pseudo-C prints x19 = x0; and constant tracking follows a known value through the move. A shifted source or a real first source is still an ORR.
2026-11-12 12:06:26 +07:00
Afloat affed64ed1 Keep AArch64 address evidence tied to proven register values (R3.11) (#1601)
The AArch64 address tracker kept an old value after an addition with an unknown register, read unknown memory indices as zero, could keep a stale base after a load with writeback or a stale link register after a call, and did W-register additions in 64 bits, so stale values could name a later indirect call as an import its instructions didn't establish. Address facts are now kept only when the operands prove them: unknown addends and indices clear the result, W additions wrap at 32 bits, every register an instruction writes is forgotten before new facts are recorded, and calls clear the link register too.
2026-11-11 13:57:00 +07:00
Afloat 15bb58b686 Preserve the possible x16 input of authenticated returns (R3.11) (#1621)
With FEAT_PAuth_LR and PSTATE.PACM set, RETAA and RETAB use x16 as an extra modifier. The decoder knows neither the CPU's features nor PSTATE, so authenticated returns now also record a possible read of x16, beside their link register and stack pointer, and value flow keeps that input.
2026-11-11 13:14:40 +07:00
Afloat 6a4dee893e Keep native function evidence from blocks before its entry (R3.11) (#1600)
A native function can branch to a body block placed before its entry address. The control-flow graph already included that block, but reference and string scans only looked from the entry onward, and parameter inference took the lowest-address block as the entry, so a register set by the real entry could become a false parameter while the real input disappeared. Reference scans now cover the address range of all of the function's body blocks, and parameters are read from the block at the function's actual entry.
2026-11-11 13:11:26 +07:00
Afloat 25b7aca841 Preserve AArch64 inputs when arithmetic results are discarded (R3.11) (#1593)
The AArch64 decoder drops XZR and WZR from the register list, so for an ordinary arithmetic instruction whose result is discarded, the first remaining source register was marked as written. That false write broke reaching definitions and could erase a proven import-slot base before a later load and call. The discarded-destination rule, which covered only flag-setting instructions, now applies to ordinary arithmetic too, so those registers stay inputs.
2026-11-11 13:05:48 +07:00
Afloat 6c32b3b5a2 Preserve AArch64 control-transfer register effects (R3.11) (#1599)
Ordinary AArch64 returns treated the selected target register as a destination and unconditionally read `x30`, even for `ret x19`. Authenticated branches and calls had correct control-flow categories but fell through the generic operand-write rule, which overwrote their target's reaching definition. Authenticated returns also omitted their stack-pointer input.
2026-11-11 12:47:22 +07:00
Afloat 9c4f081e92 Bound native value-flow work before decoding instructions (R3.11) (#1598)
The value-flow graph decoded every instruction of every block and only then applied its node limit, so a huge function did all that work before most of it was thrown away. The node budget is now spent as nodes are made: parameters first, then instructions, and decoding stops once it runs out. Blocks that weren't decoded in full are tracked so their edges and definitions aren't treated as complete, and the graph is marked truncated.
2026-11-11 12:28:36 +07:00
Afloat b92931196d Preserve AArch64 exclusive-memory results and semantics (R3.11) (#1592)
AArch64 exclusive stores treated their status result as an input and never defined it, exclusive pair loads defined only their first result, and acquire-exclusive single loads were unknown operations. The value-flow graph lost the status edge into a retry loop's condition and the second loaded value, and pseudo-C could show an exclusive store as an assignment from its status register, or drop an exclusive load from a known import slot. Exclusive stores now write their status (unless it's discarded to WZR) and read their values, exclusive and acquire-exclusive loads are loads, pair forms define both results, and pseudo-C keeps them as memory operations.
2026-11-11 11:51:17 +07:00
BFlatandAfloat ebed13d0fc Keep ARM32 conditional call values, esbuild dependencies and window labels right (#656)
Replays #640–#642. Conditional A32 calls keep the skipped path's value, esbuild dependencies survive unrelated calls, and window comparison labels stay distinct without renumbering occurrences.

Co-authored-by: Afloat <132809511+Afloat16@users.noreply.github.com>
2026-11-03 20:49:11 +07:00
Bently 2c7a311dfd Find strings in ELF files with no section headers, read from their loaded segments (#491)
For ELF files with no section headers (common in firmware), native strings are read from the loaded segments, limited to the bytes each segment maps.
2026-11-03 14:50:43 +07:00
Bently c5fce85fe0 In stripped programs, a jump below a function's entry is a tail call to a function of its own (#492)
In a stripped program, an unconditional jump to code below a function's entry that the function hasn't reached otherwise is a tail call to a function of its own (such as frame_dummy jumping to register_tm_clones), instead of pulling that code into the caller.
2026-11-03 14:50:38 +07:00
BFlat 4a6d87a107 ARM32 loads and stores keep their memory operands in pseudo-C (#450)
ARM32 and Thumb loads and stores keep their memory operands, so pseudo-C shows r0 = *(uint32_t*)(r1 + 4); instead of r0 = 0;; write-back and shifted or subtracted index forms are shown as written. Fixes #277.
2026-11-03 00:12:07 +07:00
Afloat 858037dc3d Use ARM32 registers in value-flow graphs (R0.5) (#436)
ARM32 and Thumb value-flow graphs use r0–r3 and r12 for calls and r0 for returns instead of x86 registers. Fixes #239.
2026-11-02 23:41:56 +07:00
GGWA d57649cf7a ARM and Thumb branches point at their real targets (#363)
ARM and Thumb branches, BL/BLX calls and CBZ/CBNZ point at the targets llvm-objdump reports, so Thumb calls no longer land four bytes early. Fixes #250.
2026-11-02 23:39:14 +07:00
phatloi0010 8fb98ceea7 ARM32 pseudo-C keeps call return values in r0 (#380)
ARM32 and Thumb pseudo-C returns a call's result in r0 instead of an x86 register. Fixes #278.
2026-11-02 23:08:39 +07:00
GGWA 35d76945ca ELF files with no section headers show their dynamic symbols and functions (#233)
ELF files whose section headers were removed (common in NAS and router firmware) now show their functions, imports and exports. The dynamic symbol table is found through PT_DYNAMIC (DT_SYMTAB/DT_STRTAB, counted from DT_HASH, then DT_GNU_HASH, then an estimate with a warning), shared with the Flutter reader. The prologue scan walks executable segments when there are no sections.

Fixes #223
2026-11-02 13:26:37 +07:00
GGWA fa7f1a114e An A32 doubleword load or store into r15 decodes as invalid instead of stopping the ARM analysis (#204)
An A32 LDRD/STRD with Rt=15 (e.g. 0xc0c7fef3) made the decoder library panic on the nonexistent r16; such a word now decodes as no instruction, before the library sees it.
2026-11-02 10:07:46 +07:00
Agapenor 348949ca76 Analysing code at the top of the address space finishes instead of running forever (#78)
The PLT, prologue and pointer scans in disasm/program.rs use checked steps, so code near u64::MAX no longer wraps to 0 and walks the whole address space. Adds open roadmap lines for an A32 STRD/LDRD decoder panic and unchecked header offsets in dart.rs.
2026-11-01 22:39:42 +07:00
Brandon ThomasandClaude Opus 5.5 f64ae3bf3c Craft Anything
A native, pure-Rust app that shows anyone how a piece of software works, with
evidence-backed answers, then helps them rebuild it. It ships a desktop app, a
CLI and an MCP server, all driven by one engine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 10:52:14 -04:00