Repository navigation
feat(ghidra): admit raw 8051 images - #15057
Merged
Merged
Conversation
Add 8051 as a raw-only architecture: byte-aligned entry, mapping within 0x0000..0xffff, analyzed by Ghidra with 8051:BE:16:default in the CODE space. Hopper, IDA, Kuna and Windows Ghidra P0 keep refusing it. Document the lane, including that bank-switch thunks and Keil ?C?CCASE switch arms are not followed by auto-analysis and need REA_GHIDRA_SEED_FILE entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
[Medium impact] The reviewed changes appear safe to merge, with no blocking findings. SummaryAdds raw 8051 analysis through Ghidra’s
Reviews (3) · Last reviewed commit: "test(ghidra): pin the 8051 CODE binding ..." · Reviewed by Greptile |
morluto
marked this pull request as ready for review
November 28, 2026 21:11
morluto
enabled auto-merge (squash)
November 28, 2026 21:11
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The architecture enum gained 8051, so the committed input schema digest for open_binary changed. Regenerated with `npm run verify:advertised-schemas -- --update-summary`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
auto-merge was automatically disabled
November 28, 2026 21:59
Head branch was pushed to by a user without write access
- Assert the 8051 language binding (8051:BE:16:default, CODE) and that load-image attestation requires the CODE default space; replacing CODE with ram now fails three tests. - Assert that Windows Ghidra P0 refuses raw 8051. - Derive the raw-binary architecture refusal from BINARY_ARCHITECTURES with Intl.ListFormat; the wording, and so the admission grid digest, is unchanged. - Docs: list the memory blocks Ghidra really creates for 8051 (no external RAM block), explain bank addressing for paged banks and the entry-decode requirement, state when the seed file is read, and add 8051 to the n64 guide's family list. Fix a duplicated "and" in the generic-language limitation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Admit headerless Intel 8051 (MCS-51) images as
raw-binarywitharchitecture: "8051", analyzed by Ghidra with8051:BE:16:default. Before this change,open_binaryand the CLI refused 8051 at the architecture enum, and an ELF carrier withEM_8051was refused as an unsupported ELF architecture, so 8051 firmware could not be analyzed through REA at all even though Ghidra ships the language.Problem and expected behavior
Use case: static analysis of a banked Keil C51 firmware image (32 × 64 KiB banks). Expected outcome: each 64 KiB bank opens as a raw 8051 image, decompiles through the existing Ghidra lane, and keeps the same Evidence, profile and load-image guarantees as the 6502 and m68k raw lanes.
Change and scope
8051joinsBINARY_ARCHITECTURESandRAW_ONLY_ARCHITECTURES(header detection never yields it).0x0000..0xffff.ghidraRawBinaryLanguagemaps it to8051:BE:16:default, compiler specdefault, default spaceCODE. The language'sINTMEM/SFR/BITSblocks remain uninitialized observations, as with 6502 zero page.raw-only), IDA (unsupported), Kuna (null) and Windows Ghidra P0 keep refusing it, matching m68k.docs/providers/raw-binary.mdgains an 8051 section; the skill reference lists the family and notes that bank-switch thunks and Keil?C?CCASEswitch arms are not followed by auto-analysis, so their targets must be supplied through the existingREA_GHIDRA_SEED_FILE.Not included: bank/overlay modelling, cross-bank call resolution, automatic seed derivation, the 80251/80390/MX51/CIP-51 variants, and a source-owned
verify:ghidra:8051lane.Contribution scope: not applicable (new raw family on the existing Ghidra lane; no new provider, execution, injection, mutation or protection recovery).
Contract and boundary impact
src/domain/binaryTargetTypes.ts/src/domain/rawBinary.ts(family set and admission), consumed byGhidraRawBinaryLanguage, provider architecture tables and the CLI/MCP schemas generated from the enum.--architecture/architectureenum gains8051; the raw-binary refusal text lists it. CLI help goldens updated.architecture: "8051"only forraw-binary, like 6502/m68k (evidenceSubject.test.tsnow derives that rule fromRAW_ONLY_ARCHITECTURES)..cursor-pluginskill copy regenerated withscripts/generate-cursor-plugin-skill.mjs.Expected effects:
Evidence and regression coverage
Tests added or updated:
rawBinary.test.ts: the 16-bit admission block runs for 6502 and 8051; 8051 joins the base-address refusal cases. The admission grid digest changed only because the refusal text now lists 8051: substituting the previous list back into the grid reproduces the previous digestccc75843….GhidraRawProfileDigest.test.ts: 8051 binds8051:BE:16:default/default, and joins the legacy raw-load commitments.GhidraProvider.behavior.test.ts: the admitted-family refusal names 8051; raw 8051 binds8051:BE:16:defaultoutside Windows and Windows Ghidra P0 refuses it.GhidraRawBinaryLoadImage.test.ts: the 8051 language binding returns default spaceCODE, and load-image attestation acceptsCODEand reportsramas a mismatch (replacingCODEwithramin the binding fails three tests).rawBinaryMcp.test.ts: opens a 4-byte 8051 image (LJMP 0x0003; RET) through MCP.liveBinaryTargetSummary.test.ts,evidenceSubject.test.ts, CLI parity help goldens.Base reproduction: on
main,open_binarywitharchitecture: "8051"is rejected by the schema enum; anEM_8051ELF carrier fails withunsupported ELF architecture.User-visible CLI/MCP output (real Ghidra 12.2, JDK 25, macOS arm64, one 64 KiB bank of a 2 MiB Keil C51 image):
decompile-allcompleted on 17 banks of the same image (1,400–2,300 functions each). Without seeds, auto-analysis from the reset vector finds 42 functions in a bank, which is why the docs point toREA_GHIDRA_SEED_FILE.Remaining proof gaps: no source-owned 8051 fixture or
verify:ghidra:8051lane; Linux and Windows not exercised; load-image verification was exercised only through the real-provider runs above.For evidence-bearing changes:
Validation performed
npm run check:test(typecheck, lint, format:check, knip, metadata:check, test:run), macOS arm64, Node 24.22.1 — 58,381 passed, 651 skipped, 5 failed in 4 files. The same 5 tests fail on unmodifiedmainin this environment (reran them with the change stashed):tests/acceptance/artifactExtractionLimitations.test.ts,tests/boundary/providers/desktopTaskReaderTemporaryFiles.test.ts,tests/boundary/providers/hopper/hopperBridgeReconnect.test.ts, and both cases intests/boundary/mcp/signalRecordingMcp.test.ts.npm run test:focusedon the 8 touched test files — 637 passed, 2 skipped.npm run check:fast— typecheck and lint pass; architecture guards pass across 3322 source files.npm run format:check(oxfmt) — all files use the correct format.npm run docs:check— pass (Cursor plugin skill copy regenerated).npm run verify:advertised-schemas— pass after regenerating theopen_binarysummary (only its input-schema digest changed).origin/main(25 commits newer) in a scratch worktree: no conflicts; check:fast, format:check, docs:check and verify:advertised-schemas pass; every test file that names a raw family (14 files, 893 tests) passes; a real Ghidra 12.2 decompile of a seeded 8051 bank still succeeds.inspect,decompileanddecompile-allon raw 8051 banks as shown above.Compatibility, safety, and release
8051.Author readiness
Human owner: @petrochen
Author checklist (completed by the PR author before requesting review)
type(scope): outcome.REA_runtime setting with a default, floor, and maximum, unless a fixed ceiling has a stated reason. See Adding a runtime setting.🤖 Generated with Claude Code