Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
4de50d5
test(raw): pin raw-binary admission and identity
Entrpi Oct 27, 2026
893a023
refactor(raw): carry the raw load selection as one admitted value
Entrpi Oct 27, 2026
56f27b3
feat(raw): state the M-profile raw load contract
Entrpi Oct 27, 2026
f7b4496
feat(raw): admit M-profile loads at a separate base
Entrpi Oct 27, 2026
74b4a2c
feat(raw): give M-profile loads a versioned identity
Entrpi Oct 27, 2026
e1271f9
feat(ghidra): open M-profile loads at their base in Thumb state
Entrpi Oct 27, 2026
5962d2a
test(raw): check saved raw snapshots and schemas stay compatible
Entrpi Oct 27, 2026
6565d11
test(ghidra): verify M-profile raw loads against real Ghidra
Entrpi Oct 27, 2026
ea8ac34
feat(raw): add the armv8.1-m.main variant
Entrpi Oct 28, 2026
8bd006e
fix(ghidra): report Ghidra's ARMv8.1-M loop flow for armv8.1-m.main
Entrpi Oct 28, 2026
b45a7d4
test(ghidra): verify an ARMv8.1-M image against real Ghidra
Entrpi Oct 28, 2026
8d9e15a
refactor: name the variant vocabulary after architecture_variant
Entrpi Oct 28, 2026
63f2552
refactor(ghidra): keep variant decoder limitations beside the languages
Entrpi Oct 28, 2026
56a0587
fix(raw): require base_address with every architecture_variant
Entrpi Oct 28, 2026
808240d
fix(raw): align vector tables as VTOR does and refuse Reset inside them
Entrpi Oct 28, 2026
3bded52
fix(ghidra): key variant coordinates by base, not entry
Entrpi Oct 28, 2026
8315acc
refactor(raw): discriminate the segments load image by layout
Entrpi Oct 28, 2026
a2decdd
docs(raw): record why vector-table words keep their full width
Entrpi Oct 28, 2026
404b60f
docs(raw): record why the seeded entry function is named entry
Entrpi Oct 28, 2026
b381a01
fix(raw): name the refused load input in error details
Entrpi Oct 28, 2026
58ab75f
docs(raw): state that results keep no caller spellings yet
Entrpi Oct 28, 2026
3c4e4f5
docs(raw): explain why reused sessions cannot report stale vector words
Entrpi Oct 28, 2026
891a731
docs(raw): scope architecture_variant to the ARM M profiles
Entrpi Oct 28, 2026
3bc15c9
docs(raw): state each load pairing rule once in open_binary
Entrpi Oct 28, 2026
26cac3d
refactor(ghidra): let session limitations own the variant load facts
Entrpi Oct 28, 2026
33f1d13
refactor(ghidra): launch with the label policy the profile committed
Entrpi Oct 28, 2026
58c7e88
refactor(raw): let the vector-table read carry its length
Entrpi Oct 28, 2026
d7622e8
test(raw): compare saved raw images by their facts, not their prose
Entrpi Oct 28, 2026
36e0908
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 28, 2026
d708eb4
test(ghidra): expect not-in-listing where the Cortex-M lane stops
Entrpi Oct 28, 2026
beaa182
test(raw): pin raw identity to main after its instruction-status revi…
Entrpi Oct 28, 2026
1b55c3a
test(ghidra): own the Cortex-M lane's LLVM and CLI commands
Entrpi Oct 29, 2026
a7451a0
test(raw): derive the Reset fixtures from one Thumb image
Entrpi Oct 29, 2026
bd985a4
docs(raw-binary): say that recording load spellings would not be addi…
Entrpi Oct 29, 2026
4731755
docs(raw-binary): tell callers how to keep their load spellings
Entrpi Oct 29, 2026
c943559
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 29, 2026
13906c5
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 29, 2026
a1c564e
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Oct 31, 2026
8745130
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 1, 2026
93cde07
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 1, 2026
54d4d33
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 1, 2026
b250be1
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 4, 2026
18c8965
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 5, 2026
8aec915
test(ghidra): keep raw digests at main's byte-search and data-type re…
Entrpi Nov 5, 2026
8b78936
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 5, 2026
a0717a6
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 5, 2026
f45a6ca
Merge upstream main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
63b4fc8
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
46a8db4
test(domain): check raw-binary refusal facts, not sentences
Entrpi Nov 7, 2026
1238961
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
b82751a
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 7, 2026
7b4d25e
docs(adr): move the M-profile raw load decision into an ADR
Entrpi Nov 7, 2026
9251826
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 8, 2026
7c9d321
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 8, 2026
79ae54d
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 9, 2026
526c456
Merge main into feat-ghidra-mprofile-raw
Entrpi Nov 9, 2026
f0c95ab
test(ghidra): repin digests and replay for main's call-coverage revision
Entrpi Nov 9, 2026
ec36dc9
Merge branch 'main' into feat-ghidra-mprofile-raw
Entrpi Nov 10, 2026
68fa04d
Merge branch 'main' into feat-ghidra-mprofile-raw
Entrpi Nov 10, 2026
8ae3b4e
Merge branch 'main' into feat-ghidra-mprofile-raw
Entrpi Nov 10, 2026
ca775e7
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 11, 2026
69fb296
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 11, 2026
3760d36
chore(plugin): regenerate the skill bundle from the authored skill
Entrpi Nov 11, 2026
f032197
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 14, 2026
da137b0
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 14, 2026
cf445aa
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 21, 2026
9d7ab2c
test(raw): keep the target route diagnostics within the function leng…
Entrpi Nov 22, 2026
dd59ab0
docs(raw): record the M-profile lane on Ghidra 12.2
Entrpi Nov 22, 2026
583ecb7
refactor(raw): read vector words and own the Cortex-M workspace throu…
Entrpi Nov 22, 2026
0edf352
fix(raw): name raw-binary as the format of vector-table read failures
Entrpi Nov 22, 2026
207631c
fix(verify): remove the Cortex-M workspace after a verified run
Entrpi Nov 22, 2026
35fbcb8
chore(verify): record open_binary's input schema with the M-profile l…
Entrpi Nov 22, 2026
3d8e5c3
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 22, 2026
f6415fe
test(cli): expect open_binary's M-profile load flags in the CLI comma…
Entrpi Nov 22, 2026
c8a68a4
test(cli): record the CLI help goldens with the M-profile load flags
Entrpi Nov 22, 2026
0a66d7c
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 22, 2026
14bce8e
docs(raw-binary): qualify snapshot replay under the producer rule
Entrpi Nov 22, 2026
b660ef4
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 22, 2026
77d14bd
test(ghidra): report why Cortex-M verifier cleanup could not be checked
Entrpi Nov 22, 2026
5ecb56d
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 23, 2026
db9bc1d
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 23, 2026
07f639c
Merge remote-tracking branch 'origin/main' into feat-ghidra-mprofile-raw
Entrpi Nov 23, 2026
4f29527
fix(domain): compare raw-load functions by coordinates, not entry pro…
Entrpi Nov 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(raw): require base_address with every architecture_variant
A variant without base_address mapped the image at its entry, and the
odd-entry suggestion led callers there: retrying with the even
code_address and no base mapped the vector table at Reset, and the
segments image still verified.

architecture_variant now requires base_address, the address of file
offset 0, and the odd-entry suggestion no longer offers a retry without
a base. A code fragment that starts at its entry passes that address as
its base. Loads without a variant are unchanged.
  • Loading branch information
Entrpi committed Oct 28, 2026
commit 56a058768d705e93207c1d5a867d6eca18052c7e
Original file line number Diff line number Diff line change
Expand Up @@ -596,9 +596,8 @@ that address. Hopper and IDA refuse this interpretation; Ghidra uses
`BinaryLoader` with a generic language: big-endian for `m68k`, little-endian
otherwise. For a Cortex-M dump, add `architecture_variant` (`armv6-m`,
`armv7-m`, `armv7e-m`, `armv8-m.base`, `armv8-m.main` or `armv8.1-m.main`)
and `base_address`,
which maps file offset 0 separately and is accepted only with a variant;
omit `entry_point` to take Reset from the vector table, adding
and `base_address`, which maps file offset 0 separately; each requires the
other. Omit `entry_point` to take Reset from the vector table, adding
`vector_table_address` when a header precedes it. An odd entry is refused. Big-endian ARM is unsupported.
`6502` selects NMOS 6502; the entry and complete file mapping must fit within
`0x0000..0xffff`. 65C02, 65816, cartridge containers, bank switching, and mapper
Expand Down
11 changes: 7 additions & 4 deletions docs/raw-binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,16 @@ code is decoded with the ARMv7-M instruction set, and `armv8-m.main` code with
the ARMv8.1-M one.

- `base_address` maps file offset 0 at its own address, and `entry_point` must
then lie inside the mapped image. It is accepted only with
`architecture_variant`, the one lane whose verifier covers a separate base.
then lie inside the mapped image. It is required with `architecture_variant`
and refused without it, the one lane whose verifier covers a separate base. A
dump records neither its load address nor where Reset is, and mapping it at
the entry would put a vector table at Reset; a code fragment that starts at
its entry passes that address as `base_address`.
- Without `entry_point`, REA reads the vector table at `vector_table_address`, or
at `base_address` when that is omitted. Word 1 is the Reset handler with bit 0
set for Thumb state. The vector value is observed, and the entry is derived by
clearing bit 0. Word 0, the initial stack pointer, is recorded as observed and
is not validated. `base_address` is required to omit `entry_point`.
is not validated.
- Use `vector_table_address` when a header precedes the vector table, such as the
256-byte boot2 stage of an RP2040 image or an MCUboot header. It must be
4-byte aligned and inside the mapped image, and it applies only when
Expand Down Expand Up @@ -208,7 +211,7 @@ This is decision D1 of the embedded-target work, raised in
[#4246](https://github.com/morluto/rea/issues/4246).

- **Choice.** `architecture_variant` naming the M profile, mapped as in the table
above; with it, `base_address` separate from the entry and an optional
above; with it, a required `base_address` separate from the entry and an optional
`vector_table_address`; Reset read from the vector table when a variant and a
base are given without an entry; explicit odd entries refused; the `segments`
load image and versioned `raw_load` identity only for loads that are not
Expand Down
4 changes: 2 additions & 2 deletions src/cli/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ export const entryPointSelectionOption = rawBinaryEntryPointSchema
export const baseAddressSelectionOption = rawBinaryBaseAddressSchema
.optional()
.describe(
"Address of raw file offset 0 (0xhex) for an --architecture-variant image, separate from --entry-point; defaults to it",
"Address of raw file offset 0 (0xhex) for an --architecture-variant image, separate from --entry-point; required with --architecture-variant and refused without it",
);

export const architectureVariantSelectionOption = architectureVariantSchema
.optional()
.describe(
"ARM M-profile variant of a raw image, decoded in Thumb state; requires --architecture arm",
"ARM M-profile variant of a raw image, decoded in Thumb state; requires --architecture arm and --base-address",
);

export const vectorTableAddressSelectionOption =
Expand Down
12 changes: 11 additions & 1 deletion src/contracts/sessionLifecycleInputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ describe("open_binary load input pairing", () => {
format: "raw-binary",
architecture: "arm",
architecture_variant: "armv7-m",
base_address: "0x8000000",
entry_point: "0x8000000",
vector_table_address: "0x8000000",
},
Expand All @@ -102,7 +103,16 @@ describe("open_binary load input pairing", () => {
architecture: "arm",
architecture_variant: "armv7-m",
},
"entry_point",
"base_address",
],
[
{
format: "raw-binary",
architecture: "arm",
architecture_variant: "armv7-m",
entry_point: "0x8000000",
},
"base_address",
],
[
{ format: "raw-binary", architecture: "arm", base_address: "0x8000000" },
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/sessionLifecycleInputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ export const openBinaryInputSchema = z
base_address: rawBinaryBaseAddressSchema
.optional()
.describe(
"Address of raw file offset 0 (0xhex) for an architecture_variant image, separate from entry_point. Defaults to entry_point. Only with format=raw-binary.",
"Address of raw file offset 0 (0xhex) for an architecture_variant image, separate from entry_point. Required with architecture_variant and refused without it.",
),
architecture_variant: architectureVariantSchema
.optional()
.describe(
"ARM M-profile variant of a raw image (raw dumps do not record it). Requires format=raw-binary and architecture=arm. Code is decoded in Thumb state; an odd entry_point is refused.",
"ARM M-profile variant of a raw image (raw dumps do not record it). Requires format=raw-binary, architecture=arm and base_address. Code is decoded in Thumb state; an odd entry_point is refused.",
),
vector_table_address: rawBinaryVectorTableAddressSchema
.optional()
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/sessionToolContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const exportEvidenceBundleInputSchema = z.strictObject({
export const SESSION_TOOL_CONTRACTS = [
session(
"open_binary",
"Open a local executable, application bundle, archive, JavaScript, source map, plist, or analysis database after validation. format=dos-com explicitly interprets 1..65280 headerless bytes as a DOS COM analysis image. format=raw-binary interprets headerless bytes with a required architecture and entry_point; file offset 0 maps at the entry. architecture_variant names an ARM M profile decoded in Thumb state; with it, base_address maps file offset 0 separately and entry_point may be omitted to read Reset from the vector table. Omission preserves header-based detection. provider_id selects one deep provider or deterministic auto selection; the binding remains stable until close or an explicit switch, with no failure fallback. Reopening the same target and profile retains its active database and metadata edits. An optional analysis snapshot is imported atomically and must match the binary identity, concrete provider, and canonical analysis profile exactly; importing into a session with metadata mutations requires closing and reopening it first. Call close_binary when the investigation is finished.",
"Open a local executable, application bundle, archive, JavaScript, source map, plist, or analysis database after validation. format=dos-com explicitly interprets 1..65280 headerless bytes as a DOS COM analysis image. format=raw-binary interprets headerless bytes with a required architecture and entry_point; file offset 0 maps at the entry. architecture_variant names an ARM M profile decoded in Thumb state; it requires base_address, which maps file offset 0 separately, and entry_point may then be omitted to read Reset from the vector table. Omission preserves header-based detection. provider_id selects one deep provider or deterministic auto selection; the binding remains stable until close or an explicit switch, with no failure fallback. Reopening the same target and profile retains its active database and metadata edits. An optional analysis snapshot is imported atomically and must match the binary identity, concrete provider, and canonical analysis profile exactly; importing into a session with metadata mutations requires closing and reopening it first. Call close_binary when the investigation is finished.",
openBinaryInputSchema,
),
session(
Expand Down
16 changes: 12 additions & 4 deletions src/domain/architectureVariant.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ describe.each(ARCHITECTURE_VARIANT_NAMES)("architecture variant %s", (name) => {
format: "raw-binary",
architecture,
entryPoint: "0x8000000",
baseAddress: "0x8000000",
architectureVariant: name,
}),
).toEqual(
Expand All @@ -43,7 +44,7 @@ describe.each(ARCHITECTURE_VARIANT_NAMES)("architecture variant %s", (name) => {
},
);

it("lets the entry be omitted only together with a base", () => {
it("requires a base, which lets the entry be omitted", () => {
const selection = {
format: "raw-binary",
architecture: row.architecture,
Expand All @@ -52,9 +53,16 @@ describe.each(ARCHITECTURE_VARIANT_NAMES)("architecture variant %s", (name) => {
expect(
rawBinarySelectionError({ ...selection, baseAddress: "0x8000000" }),
).toBeUndefined();
expect(rawBinarySelectionError(selection)).toMatchObject({
field: "entry_point",
});
// A variant never maps the image at its entry.
for (const unbased of [
selection,
{ ...selection, entryPoint: "0x8000000" },
])
expect(rawBinarySelectionError(unbased)).toEqual({
field: "base_address",
message:
"architecture_variant requires base_address, the address of file offset 0",
});
Comment thread
Entrpi marked this conversation as resolved.
Resolved
});
});

Expand Down
57 changes: 29 additions & 28 deletions src/domain/rawBinary.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,11 +541,13 @@ describe.each(ARCHITECTURE_VARIANT_NAMES)(
(variant) => {
const { architecture, isaMode } = ARCHITECTURE_VARIANTS[variant];

// A code fragment that starts at its entry passes that address as its base.
it("admits an even Thumb entry that generic ARM would refuse", () => {
expect(
admitRawBinary({
architecture,
architectureVariant: variant,
baseAddress: "0x8000002",
entryPoint: "0x8000002",
fileBytes: 4,
}),
Expand All @@ -564,34 +566,29 @@ describe.each(ARCHITECTURE_VARIANT_NAMES)(
});
});

it.each([
[undefined, "Pass code_address as entry_point, or give base_address"],
["0x08000000", "Omit entry_point to read Reset from the vector table"],
])(
"refuses an odd entry with base %s and gives its code address",
(baseAddress, suggestion) => {
const result = admitRawBinary({
architecture,
architectureVariant: variant,
entryPoint: "0x080001c5",
...(baseAddress === undefined ? {} : { baseAddress }),
fileBytes: 0x200,
});
expect(result).toMatchObject({
ok: false,
error: {
reason: `raw-binary ${variant} entry_point 0x80001c5 is a Thumb interworking address with bit 0 set; its code address is 0x80001c4`,
constraint: "load_selection_rejected",
diagnostics: {
entry_point: "0x080001c5",
code_address: "0x80001c4",
isa_mode: isaMode,
suggestion: expect.stringContaining(suggestion),
},
it("refuses an odd entry and gives its code address", () => {
const result = admitRawBinary({
architecture,
architectureVariant: variant,
entryPoint: "0x080001c5",
baseAddress: "0x08000000",
fileBytes: 0x200,
});
expect(result).toMatchObject({
ok: false,
error: {
reason: `raw-binary ${variant} entry_point 0x80001c5 is a Thumb interworking address with bit 0 set; its code address is 0x80001c4`,
constraint: "load_selection_rejected",
diagnostics: {
entry_point: "0x080001c5",
code_address: "0x80001c4",
isa_mode: isaMode,
suggestion:
"Omit entry_point to read Reset from the vector table, or pass code_address as entry_point.",
},
});
},
);
},
});
});

it("refuses a vector table address beside an explicit entry", () => {
expect(
Expand Down Expand Up @@ -750,12 +747,16 @@ describe("raw-binary variant pairing at admission", () => {
it.each([
[
{ architectureVariant: "armv7-m" },
"entry_point may be omitted only with architecture_variant and base_address; Reset is then read from the vector table",
"architecture_variant requires base_address, the address of file offset 0",
],
[
{ baseAddress: "0x8000000" },
"base_address applies only with architecture_variant",
],
[
{ vectorTableAddress: "0x8000000" },
"entry_point may be omitted only with architecture_variant and base_address; Reset is then read from the vector table",
],
])(
"requires a variant and a base to omit the entry: %j",
(selection, reason) => {
Expand Down
18 changes: 14 additions & 4 deletions src/domain/rawBinary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,7 @@ export const admitRawBinary = (input: {
code_address: codeAddress,
isa_mode: variant.isaMode,
suggestion:
base === undefined
? "Pass code_address as entry_point, or give base_address and omit entry_point to read Reset from the vector table."
: "Omit entry_point to read Reset from the vector table, or pass code_address as entry_point.",
"Omit entry_point to read Reset from the vector table, or pass code_address as entry_point.",
},
);
}
Expand Down Expand Up @@ -329,7 +327,7 @@ export const admitRawBinary = (input: {
const length = validateRawBinaryLength(input.fileBytes);
if (!length.ok)
return err({ reason: length.error, constraint: "file_format_rejected" });
// Without base_address, file offset 0 maps at the entry.
// A legacy load has no base_address: file offset 0 maps at its entry.
const start = base ?? entry;
if (start === undefined)
throw new Error("raw-binary admission lost both base and entry");
Expand Down Expand Up @@ -468,6 +466,18 @@ export const rawBinaryVariantSelectionIssue = (input: {
field: "architecture_variant",
message: `architecture_variant ${variant.name} requires architecture ${variant.architecture}`,
};
// A raw dump records neither its load address nor where Reset is; mapping it
// at the entry would put a vector table at Reset. A code fragment that does
// start at its entry passes that address as its base.
if (
input.architectureVariant !== undefined &&
input.baseAddress === undefined
)
return {
field: "base_address",
message:
"architecture_variant requires base_address, the address of file offset 0",
};
// Narrow first: only the M-profile lane is verified with a separate base.
if (
input.baseAddress !== undefined &&
Expand Down
1 change: 1 addition & 0 deletions tests/boundary/mcp/rawLoadCompatibility.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ describe("raw-binary snapshots saved before base_address", () => {
rawLoad: admittedRawLoad({
architecture: "arm",
architectureVariant: "armv7-m",
baseAddress: "0x8000000",
entryPoint: "0x8000000",
fileBytes: 4,
}),
Expand Down