* 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>
* 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>
* 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>