Commit Graph
8960 Commits
Author SHA1 Message Date
04d473ca0b feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads (#14447)
* feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads

Disassemble PC-relative literal-pool load instructions (`arm-thumb` 16-bit
LDR and 32-bit Thumb-2 LDR.W, `arm-a32` LDR, and `xtensa` L32R) from local
firmware images at an explicit `base_address` without target execution:

- Byte-granular `PoolByteBitset` suppresses forward and backward pool byte
  ranges even at `4k + 2` unaligned file offsets (`base_address` ending in 2).
- Two-pass Xtensa pool discovery preserves `L32R` alignment after leading or
  interleaved 4-byte literal pools and preserves valid `21 36 01` encodings.
- Indexed `O(log M)` CMSIS-SVD disjoint `<addressBlock>`/`<register>` matching
  with cycle-safe multi-hop `derivedFrom` resolution, `mapped_image` bounds
  precedence, exact ARMv7-M/v8-M SCS sub-blocks, and `arm-a32` SoC neutrality.
- Cooperative `setImmediate` event-loop yields with `AbortSignal` cancellation,
  complete retained Evidence with `detail: "summary"` and `inspect_analysis_view`
  (`firmware-literal-pools`), `max_svd_nodes` parameter budget, and
  field-specific `invalid_request` validation.

* fix(firmware): bound SVD and candidate memory, preserve overshadowed loads, and report required_value

* fix(firmware): resolve SVD derivedFrom chains iteratively and restore lifecycle test title

* fix(firmware): bound Xtensa trace and SVD representation memory, make Evidence cooperative, and preserve unaligned literal loads

* fix(firmware): retain completed literal-pool scans on late cancellation and avoid repeated SVD string hashing

* fix(firmware): walk SVD register clusters, sweep dense overlaps linearly, and preserve XML depth recovery

* fix(firmware): enforce profile-wide cooperative SVD cluster expansion budget and sync schema

* fix(firmware): pre-parse SVD cluster templates, inherit defaults, and keep Xtensa framing

* fix(firmware): share inherited SVD template chains and count compact arrays as single intervals

* fix(firmware): replace SVD override chain links with persistent O(log K) treap

* fix(firmware): default max_references to the representation-bounded maximum

The IROM segment of the MicroPython 1.24.1 ESP32 image resolves 35,179
literal-pool loads. A default call scanned it and then refused at 16,384
references, so the agent had to repeat the whole scan with a larger
max_references. The count is checked after scanning, and
max_representation_bytes already bounds the Evidence these rows build. The
default is now the maximum; the same image completes in 1.4 s with a 12 MB
complete result.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* refactor(firmware): use the max_references maximum as its default directly

Knip reported DEFAULT_LITERAL_POOL_MAX_REFERENCES as a duplicate export of
MAX_LITERAL_POOL_REFERENCES. The budget now names the maximum as its
default, and the provider test reads the default from the budget.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* fix(firmware): preserve inherited SVD register widths and addressBlock spans

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 17:00:14 +08:00
Vincent Koc 37365a363e refactor(json): reuse reader failure type in public signatures (#16294) 2026-12-03 08:57:59 +00:00
Vincent Koc 4af8651f6d refactor(javascript): share container entry graph identities (#16293) 2026-12-03 08:56:13 +00:00
Vincent Koc 4630d8a7dc refactor(firmware): share missing dependency gap projection (#16290) 2026-12-03 08:43:47 +00:00
Vincent Koc 2f69bbd442 test(managed): share available metadata heap fixtures (#16289) 2026-12-03 08:40:27 +00:00
bf7646b0c7 feat(firmware): classify privileged system-register, CSR, and port-I/O instructions (#14422)
* feat(firmware): classify privileged system-register, CSR, and port-I/O instructions

Add `inspect_procedure_hardware_instructions` (`rea inspect-procedure-hardware-instructions`)
to extract and classify architectural non-MMIO hardware instructions from
`read_function_instructions` across `arm`, `arm64`, `riscv`, `xtensa`, `mips`,
`x86`, and `x86_64`.

- Parse provider `<nativeAddress>: <assembly>` lines through the shared native
  address grammar (`OBSERVED_NATIVE_ADDRESS_PATTERN` / `nativeAddressInputSchema`)
  without stripping 2-hex-letter mnemonics (`dc`) or discarding address spaces
  (`rom:0x1000`, `overlay%3Aspace:0x1000`).
- Normalize conditional A32/T32 system, coprocessor, barrier, wait, and trap
  mnemonics (`mrcne`, `mcrgt`, `mrsne`, `msreq`, `cpsie.w`, `wfene`, `wfine`,
  `sevne`, `svcne`) while preserving original disassembled mnemonics, and cover
  AArch64 `dc`/`ic`/`at`/`tlbi` maintenance operations.
- Parse complete 8-bit immediate x86 port tokens (`0x00..0xff` across `0x`,
  Intel `h`, `$`/`#`, and decimal syntax), keep register-selected `DX` ports as
  `unresolved_register`, and separate symbolic or unparsed port tokens as
  `unresolved_operand`.
- Classify zero-source RISC-V CSR set/clear pseudo-instructions (`csrsi csr, 0`,
  `csrci csr, 0`, `csrs csr, zero`, `csrc csr, x0`) as `read` consistently with
  their canonical `csrrs`/`csrrc`/`csrrsi`/`csrrci` encodings.

Refs #7955

* chore(firmware): refresh the hardware-instruction advertised schema summary

The shared Evidence output schema on main now advertises its string
patterns, so the summary recorded on the older base was stale.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 16:36:28 +08:00
Vincent Koc 504064c4b9 refactor(environment): share recorded list selection (#16287) 2026-12-03 08:30:44 +00:00
Vincent Koc f1c1787b8f refactor(elf): share kernel version report fields (#16286) 2026-12-03 08:28:57 +00:00
Vincent Koc 8375d83dc2 test(vsix): share main manifest fixtures (#16285) 2026-12-03 08:25:51 +00:00
Vincent Koc bfe2c7cf0c refactor(environment): share recorded-answer fallback (#16284) 2026-12-03 08:17:03 +00:00
Vincent Koc f0469700a0 refactor(go): share binary image result construction (#16283) 2026-12-03 08:15:43 +00:00
Vincent Koc eb779420bc test(dwarf): share compile-unit abbreviation fixtures (#16282) 2026-12-03 08:14:20 +00:00
Vincent Koc 6dddf4c9a8 refactor(cli): share command index insertion (#16279) 2026-12-03 08:03:59 +00:00
Vincent Koc 6f8fe529c2 refactor(vsix): share interesting-member projection (#16280) 2026-12-03 08:03:40 +00:00
Vincent Koc 7cc831fef9 test(ips): share report inspection fixtures (#16281) 2026-12-03 08:00:42 +00:00
Vincent Koc 400d282848 refactor(gradle): share variant row projection (#16277) 2026-12-03 07:55:43 +00:00
Vincent Koc 9192daaf36 refactor(n64): reuse cartridge CRC report fields (#16271) 2026-12-03 07:45:13 +00:00
Vincent Koc 7c88b2ea92 refactor(python): share constant summary cases (#16276) 2026-12-03 07:41:20 +00:00
Vincent Koc 8038e8e0ef test(search): share predicate input fixtures (#16275) 2026-12-03 07:37:13 +00:00
Vincent Koc ad6f2130ed refactor(desktop): share checkpoint version traversal (#16272) 2026-12-03 07:30:23 +00:00
Vincent Koc 4f5a01e7b4 test(oci): share image-layout service fixtures (#16270) 2026-12-03 07:25:59 +00:00
Vincent Koc 53afc0b14a refactor(environment): share two-value difference formatting (#16269) 2026-12-03 07:16:39 +00:00
Vincent Koc 184e3befb3 refactor(flutter): reuse ABI library result fields (#16268) 2026-12-03 07:15:40 +00:00
Vincent Koc ee85bd9b8f test(pe): share named resource fixtures (#16267) 2026-12-03 07:11:28 +00:00
Vincent Koc 100dcabeb6 refactor(javascript): reuse invalid source-map projection (#16265) 2026-12-03 07:02:28 +00:00
Vincent Koc 7c7cd6bc4a refactor(evtx): share archive result construction (#16264) 2026-12-03 07:01:38 +00:00
Vincent Koc 3efef07859 test(json-shape): share nested property expectations (#16263) 2026-12-03 06:58:08 +00:00
Vincent Koc 167b880b6d refactor(mega-drive): share ROM region projection (#16255) 2026-12-03 06:46:57 +00:00
Vincent Koc b6ca1310ad refactor(capabilities): reuse public mode fields (#16256) 2026-12-03 06:33:14 +00:00
Vincent Koc a6533ca160 refactor(cli): reuse parsed completion flags (#16248) 2026-12-03 06:15:41 +00:00
Vincent Koc 7f72b78d47 refactor(nib): share hierarchy collection lookup (#16247) 2026-12-03 06:14:44 +00:00
Vincent Koc 7ef78a6ac0 test(dol): share BSS fixture setup (#16246) 2026-12-03 06:11:22 +00:00
Vincent Koc 103fbabb6c refactor(javascript): share graph finding source projection (#16243) 2026-12-03 06:02:12 +00:00
Vincent Koc b80a771449 refactor(media): reuse Ogg Opus page facts (#16242) 2026-12-03 06:01:02 +00:00
Vincent Koc 28dcb8478a test(rust): share binary service fixture setup (#16241) 2026-12-03 05:58:02 +00:00
Vincent Koc 618ae7fef3 refactor(macos-pkg): share XAR entry metadata projection (#16238) 2026-12-03 05:48:26 +00:00
Vincent Koc 45dc99a88f refactor(config): share Vibe TOML section writing (#16239) 2026-12-03 05:47:47 +00:00
Vincent Koc b3ad7ec381 test(mcp): share evidence server handshake setup (#16237) 2026-12-03 05:44:22 +00:00
Vincent Koc 0c37579726 refactor(cli): share output control rejection construction (#16236) 2026-12-03 05:34:33 +00:00
Vincent Koc e26fa4bedb refactor(xml): collect outermost ranges in source order (#16235) 2026-12-03 05:33:11 +00:00
Vincent Koc 18dad5a9e1 refactor(investigation): share retained evidence resolution (#16229) 2026-12-03 05:20:29 +00:00
Vincent Koc 7a2fa449a9 refactor(managed): reuse the BOM-preserving UTF-8 decoder (#16228) 2026-12-03 05:13:17 +00:00
Vincent Koc dc6f34cad7 refactor(iso9660): share timestamp formatting (#16226) 2026-12-03 05:12:01 +00:00
Vincent Koc 48eaf6ceb7 test(analysis-view): share module reference page fixtures (#16227) 2026-12-03 05:08:13 +00:00
CyberSprout 6c627682ba feat(artifacts): inspect and extract MCUboot firmware images (#15414)
* feat(firmware): inspect and extract MCUboot images offline

* fix(firmware): align MCUboot digest tags, ParseFailureError locations, and compact summaries
2026-12-03 13:02:15 +08:00
CyberSprout 60d804050c feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables (#15404)
* feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables

* fix(firmware): preserve legacy vector views and tighten AVR/ARM-AR bounds

* fix(firmware): report truncated AVR vector slots and remove unused wrapper

* fix(firmware): enforce ARM A/R LDR pc target rules and slot-based table coverage
2026-12-03 13:02:09 +08:00
c50b1bae9d feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs (#14419)
* feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs

* fix(firmware): preserve MCP caller inputs, x32 decoder width, and bounded ELF tallies

* fix(firmware): leave M-profile variant and PPC width unresolved and report observed file size

* chore(firmware): remove unused exported types flagged by knip

* fix(firmware): recognize x86_64 leave;ret functions, keep uImage ppc width unknown, and preserve MIPS ELF flags

* fix(firmware): preserve MIPS/ARM decoder uncertainty and partial scan stages

* fix(firmware): preserve MIPS16 and microMIPS ELF ASE mode declarations

* fix(firmware): admit Cortex-M vector tables with filled reserved slots

The Raspberry Pi Pico SDK fills reserved vector slots with its default
handler. The detector required them to be zero, so it missed the vector
table and load base of the MicroPython 1.24.1 RP2040 image and offered only
an instruction-census guess. Reserved slots may now hold a Thumb handler in
the Reset region; any other value still rejects the table.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

* feat(firmware): identify ESP-IDF images from their header chip_id

The detectors found no candidate for the MicroPython 1.24.1 ESP32 image.
They have no Xtensa signature, and the chip is named in the image header.
A new esp-image-header detector recognizes the ESP-IDF header at offset 0
or a ROM bootloader offset, and takes the ISA from the existing ESP-IDF chip
table. The chip_id field now has one reader shared with the ESP image
parser. ESP32 images report Xtensa and ESP32-C3 images RISC-V.

Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>

---------

Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-12-03 13:02:04 +08:00
Vincent Koc a52d543f73 refactor(pe): share import descriptor walking (#16225) 2026-12-03 04:57:56 +00:00
Vincent Koc c9eaf853be refactor(cli): share managed inspection runner (#16224) 2026-12-03 04:54:05 +00:00
Vincent Koc 49c4a91540 test(zip): share descriptor directory record setup (#16223) 2026-12-03 04:51:14 +00:00