Skip to content
Open
Show file tree
Hide file tree
Changes from 70 commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,15 @@ headers), open with `format: "raw-binary"`, `architecture` (`x86`, `x86_64`,
`arm`, `arm64`, `6502`, or `m68k`), and `entry_point` (`0x` hex). File offset 0 is mapped at
that address. Hopper and IDA refuse this interpretation; Ghidra uses
`BinaryLoader` with a generic language: big-endian for `m68k`, little-endian
otherwise. Big-endian ARM, Thumb-only, and Cortex-M variants are unsupported.
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; 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.
Results report canonical addresses (`0x08000000` as `0x8000000`) and treat an
omitted `vector_table_address` as one at the base; when your exact spelling
matters, save your request beside the Evidence, together with its
`evidence_id`. 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
semantics are unsupported. `m68k` requires an even entry and decodes the 68040
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,15 @@ headers), open with `format: "raw-binary"`, `architecture` (`x86`, `x86_64`,
`arm`, `arm64`, `6502`, or `m68k`), and `entry_point` (`0x` hex). File offset 0 is mapped at
that address. Hopper and IDA refuse this interpretation; Ghidra uses
`BinaryLoader` with a generic language: big-endian for `m68k`, little-endian
otherwise. Big-endian ARM, Thumb-only, and Cortex-M variants are unsupported.
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; 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.
Results report canonical addresses (`0x08000000` as `0x8000000`) and treat an
omitted `vector_table_address` as one at the base; when your exact spelling
matters, save your request beside the Evidence, together with its
`evidence_id`. 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
semantics are unsupported. `m68k` requires an even entry and decodes the 68040
Expand Down
24 changes: 21 additions & 3 deletions bridge/ghidra/ReaGhidraBridge.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@ public final class ReaGhidraBridge extends HeadlessScript {
// DecompileProcess converts MiB to bytes using a signed-int left shift.
private static final int MAX_DECOMPILE_PAYLOAD_MIB = Integer.MAX_VALUE >> 20;
private ValueFlowLimits valueFlowLimits = defaultValueFlowLimits();
// Context registers whose entry values TypeScript committed for this import, such as TMode.
private List<String> entryContextRegisters = List.of();
// The registers GHIDRA_RAW_ENTRY_CONTEXT can commit; the launcher tests keep them equal.
private static final Set<String> ENTRY_CONTEXT_REGISTERS = Set.of("TMode");
// DecompileProcess converts seconds to an int millisecond timer delay.
private static final int MAX_DECOMPILE_TIMEOUT_SECONDS = Integer.MAX_VALUE / 1000;
private final ReaGhidraExtensions analysisExtensions = new ReaGhidraExtensions();
Expand All @@ -217,6 +221,7 @@ public void run() throws Exception {
SessionDescriptor descriptor = readDescriptor(descriptorPath);
existingProject = descriptor.existingProject;
decompileTimeoutSeconds = descriptor.decompileTimeoutSeconds();
entryContextRegisters = descriptor.entryContextRegisters();
// Windows retains a native immutable bearer descriptor lease until
// runtime_close; POSIX removes it after this read. Normal cleanup removes
// the Windows file, while abrupt owner death can leave private residue.
Expand Down Expand Up @@ -789,7 +794,9 @@ private JsonObject inspectNativeLoadImage(JsonObject params) throws Exception {
JsonObject context = new JsonObject();
context.addProperty("address", canonicalAddress(entry));
JsonArray registers = new JsonArray();
for (String name : new String[] { "CS", "DS", "ES", "SS" }) {
List<String> names = new ArrayList<>(List.of("CS", "DS", "ES", "SS"));
for (String name : entryContextRegisters) if (!names.contains(name)) names.add(name);
for (String name : names) {
Register register = currentProgram.getRegister(name);
if (register == null) continue;
JsonObject row = new JsonObject();
Expand Down Expand Up @@ -5654,7 +5661,16 @@ private static SessionDescriptor readDescriptor(Path path) throws IOException {
keys.add("decompile_timeout_seconds");
if (parsed.isJsonObject() && parsed.getAsJsonObject().has("existing_project"))
keys.add("existing_project");
if (parsed.isJsonObject() && parsed.getAsJsonObject().has("entry_context_register"))
keys.add("entry_context_register");
JsonObject object = requireObject(parsed, keys);
List<String> entryContext = List.of();
if (object.has("entry_context_register")) {
String register = requireString(object, "entry_context_register");
if (!ENTRY_CONTEXT_REGISTERS.contains(register))
throw new IllegalArgumentException("REA session descriptor is invalid");
entryContext = List.of(register);
}
int decompileTimeout = 0;
if (object.has("decompile_timeout_seconds")) {
decompileTimeout = requireInteger(object, "decompile_timeout_seconds");
Expand All @@ -5671,7 +5687,8 @@ private static SessionDescriptor readDescriptor(Path path) throws IOException {
requireString(object, "profile_digest"),
object.has("analysis_extensions") ? object.getAsJsonArray("analysis_extensions") : new JsonArray(),
decompileTimeout,
object.has("existing_project") && requireBoolean(object, "existing_project")
object.has("existing_project") && requireBoolean(object, "existing_project"),
entryContext
);
}

Expand Down Expand Up @@ -5936,7 +5953,8 @@ private record SessionDescriptor(
String profileDigest,
JsonArray analysisExtensions,
int decompileTimeoutSeconds,
boolean existingProject
boolean existingProject,
List<String> entryContextRegisters
) {}
private static ValueFlowLimits defaultValueFlowLimits() {
return new ValueFlowLimits(DEFAULT_HIGH_PCODE_OPS, DEFAULT_HIGH_PCODE_INPUTS_PER_OP, DEFAULT_HIGH_PCODE_DEF_USE_EDGES);
Expand Down
36 changes: 30 additions & 6 deletions bridge/ghidra/ReaGhidraPrepareRaw.java
Original file line number Diff line number Diff line change
@@ -1,46 +1,70 @@
import ghidra.app.script.GhidraScript;
import ghidra.program.model.address.Address;
import ghidra.program.model.lang.Register;
import ghidra.program.model.listing.Program;
import ghidra.program.model.mem.MemoryBlock;
import ghidra.program.model.mem.MemoryBlockSourceInfo;
import java.math.BigInteger;

/** Seed the caller-supplied raw-binary entry before default auto-analysis. */
public final class ReaGhidraPrepareRaw extends GhidraScript {
@Override
public void run() throws Exception {
String[] arguments = getScriptArgs();
if (arguments.length != 2) {
if (arguments.length != 4) {
throw new IllegalArgumentException(
"Raw binary preparation requires the committed language and entry address"
"Raw binary preparation requires the committed language, load base, entry and entry context"
);
}
String expectedLanguage = arguments[0];
String entryHex = arguments[1];
String baseHex = arguments[1];
String entryHex = arguments[2];
String entryContext = arguments[3];
if (!currentProgram.getLanguageID().getIdAsString().equals(expectedLanguage) ||
!currentProgram.getExecutableFormat().equals("Raw Binary")) {
throw new IllegalArgumentException(
"Raw binary preparation requires the committed language and BinaryLoader import"
);
}
Address base = currentProgram.getAddressFactory().getDefaultAddressSpace().getAddress(baseHex);
Address entry = currentProgram.getAddressFactory().getDefaultAddressSpace().getAddress(entryHex);
MemoryBlock block = entry == null ? null : currentProgram.getMemory().getBlock(entry);
MemoryBlock block = base == null ? null : currentProgram.getMemory().getBlock(base);
boolean fileStart = false;
if (block != null) {
// Processor-defined zero page/stack blocks can precede the imported file.
for (MemoryBlockSourceInfo source : block.getSourceInfos()) {
if (source.getFileBytes().isPresent() && source.getFileBytesOffset() == 0 &&
entry.equals(source.getMinAddress())) {
base.equals(source.getMinAddress())) {
fileStart = true;
break;
}
}
}
if (!fileStart) {
throw new IllegalArgumentException(
"Raw binary import must map file offset 0 at the caller-supplied entry"
"Raw binary import must map file offset 0 at the committed load base"
);
}
if (entry == null || !block.contains(entry)) {
throw new IllegalArgumentException("Raw binary entry must lie inside the source-backed load block");
}
if (!entryContext.equals("language-default")) {
// The committed language selects this context; refuse to analyze if it does not.
String[] assignment = entryContext.split("=", 2);
if (assignment.length != 2 || !assignment[1].startsWith("0x")) {
throw new IllegalArgumentException("Raw binary entry context must be language-default or REGISTER=0xVALUE");
}
Register register = currentProgram.getRegister(assignment[0]);
BigInteger expected = new BigInteger(assignment[1].substring(2), 16);
if (register == null ||
!expected.equals(currentProgram.getProgramContext().getValue(register, entry, false))) {
throw new IllegalStateException("Raw binary entry context " + entryContext + " is not in effect at the entry");
}
}
addEntryPoint(entry);
// Named as Ghidra's loaders name a program entry, whatever its role. The
// load image reports the role; a handler name such as Reset_Handler
// would claim a symbol the image does not carry.
if (!disassemble(entry) || createFunction(entry, "entry") == null) {
throw new IllegalStateException("Raw binary entry cannot be decoded as a function");
}
Expand Down
Loading
Loading