* feat(ghidra): admit raw NMOS 6502 analysis * test(ghidra): require verified POSIX verifier cleanup * test(ghidra): verify 6502 low-memory raw imports * docs(skill): document raw NMOS 6502 support * fix(ghidra): preserve requested Windows raw source paths * docs(ghidra): include raw 6502 in Windows installation scope * test(ghidra): verify Windows raw junction rejection through CLI and MCP * fix(validation): make fixtures portable and preserve explicit Codex home * fix(ghidra): attest raw mapping state and address space * fix(ghidra): align diagnostics and regression groups * fix(ghidra): bind raw attestation to language address space * chore(ghidra): avoid verifier insertion conflict * docs(ghidra): align linked raw admission guides * fix(ghidra): retain 6502 verifier workspace on failure * test(ghidra): isolate Windows authority doctor fixture * fix(binary): re-admit Windows raw paths on session reopen * test(binary): require fresh provider execution after path change * Constrain 6502 to raw lifecycle and snapshot targets * Bypass saved reads for unadmitted Windows paths * Guard direct CLI snapshot replay on Windows paths * fix(snapshot): gate Windows Ghidra replay on native admission * fix(snapshot): constrain nested 6502 subjects to raw images * test: make dyld slice fixtures portable
50 lines
2.2 KiB
Java
50 lines
2.2 KiB
Java
import ghidra.app.script.GhidraScript;
|
|
import ghidra.program.model.address.Address;
|
|
import ghidra.program.model.listing.Program;
|
|
import ghidra.program.model.mem.MemoryBlock;
|
|
import ghidra.program.model.mem.MemoryBlockSourceInfo;
|
|
|
|
/** 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) {
|
|
throw new IllegalArgumentException(
|
|
"Raw binary preparation requires the committed language and entry address"
|
|
);
|
|
}
|
|
String expectedLanguage = arguments[0];
|
|
String entryHex = arguments[1];
|
|
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 entry = currentProgram.getAddressFactory().getDefaultAddressSpace().getAddress(entryHex);
|
|
MemoryBlock block = entry == null ? null : currentProgram.getMemory().getBlock(entry);
|
|
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())) {
|
|
fileStart = true;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
if (!fileStart) {
|
|
throw new IllegalArgumentException(
|
|
"Raw binary import must map file offset 0 at the caller-supplied entry"
|
|
);
|
|
}
|
|
addEntryPoint(entry);
|
|
if (!disassemble(entry) || createFunction(entry, "entry") == null) {
|
|
throw new IllegalStateException("Raw binary entry cannot be decoded as a function");
|
|
}
|
|
currentProgram.getOptions(Program.PROGRAM_INFO).setBoolean("REA raw binary prepared", true);
|
|
}
|
|
}
|