summaryrefslogtreecommitdiffstats
path: root/userspace/cuda/tools/ghidra/PrintProgramInfo.java
diff options
context:
space:
mode:
authorArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-23 12:11:04 -0400
committerArthur Hanson Rasmusson <arthur@vgpu.io>2026-09-23 12:11:04 -0400
commit21b8ebc9db1d0ae649d6406087ea22b54e3b5775 (patch)
tree192aa5d3c76e0cf3a785936d9902c6848609d37e /userspace/cuda/tools/ghidra/PrintProgramInfo.java
parent631bd20c63a4058775a4fa549b9473915c918020 (diff)
downloadopen-iov-21b8ebc9db1d0ae649d6406087ea22b54e3b5775.tar.gz
open-iov-21b8ebc9db1d0ae649d6406087ea22b54e3b5775.zip
userspace/cuda: add CUDA userspace driver analysis, tooling and name maps
Add the analysis of the NVIDIA CUDA userspace driver used by Open-IOV VMs: * docs/01-08: architecture (layers, object model, threads, sync, memory, channels, launch), build and execution model, the driver/kernel/GPU interface contract, virtualization approaches, the 570.144 decompilation map with the corrected libcuda crash path and the current engine-topology blocker, tooling, and a version-upgrade playbook. * tools/: version-agnostic toolchain - stdlib ELF/interface toolkit (exports, unwind-table function map, wrapper resolution, version delta, crash address decode), callgraph walker, corpus annotator, and Ghidra analysis/decompilation/name-map scripts with resumable parallel drivers. * 570.144/annotations/: our name map (exports + resolved wrappers + verified internals) and subsystem index, tracked so naming work accumulates. * READ-ME-FIRST.md: reading guide with the fast lookup recipes. The full decompiled corpus and annotated corpus stay untracked (vendor- derived, gitignored under the version run/ tree).
Diffstat (limited to 'userspace/cuda/tools/ghidra/PrintProgramInfo.java')
-rw-r--r--userspace/cuda/tools/ghidra/PrintProgramInfo.java38
1 files changed, 38 insertions, 0 deletions
diff --git a/userspace/cuda/tools/ghidra/PrintProgramInfo.java b/userspace/cuda/tools/ghidra/PrintProgramInfo.java
new file mode 100644
index 0000000..86a31b3
--- /dev/null
+++ b/userspace/cuda/tools/ghidra/PrintProgramInfo.java
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: BSD-3-Clause
+//
+// PrintProgramInfo.java - Ghidra post-script: print the program's image base,
+// executable block ranges and function count. Used to establish the address
+// convention of a project before running decompilation tools.
+//
+// Usage:
+// analyzeHeadless <proj> <name> -process <program> -readOnly -noanalysis \
+// -postScript PrintProgramInfo.java
+import ghidra.app.script.GhidraScript;
+import ghidra.program.model.address.Address;
+import ghidra.program.model.listing.Function;
+import ghidra.program.model.listing.FunctionIterator;
+import ghidra.program.model.mem.MemoryBlock;
+
+public class PrintProgramInfo extends GhidraScript {
+ @Override
+ public void run() throws Exception {
+ println("program = " + currentProgram.getName());
+ println("language = " + currentProgram.getLanguageID());
+ println("image base = 0x" + Long.toHexString(currentProgram.getImageBase().getOffset()));
+ println("executable blocks:");
+ for (MemoryBlock b : currentProgram.getMemory().getBlocks()) {
+ if (b.isExecute()) {
+ println(" 0x" + Long.toHexString(b.getStart().getOffset())
+ + " - 0x" + Long.toHexString(b.getEnd().getOffset())
+ + " " + b.getName());
+ }
+ }
+ int n = 0;
+ FunctionIterator fit = currentProgram.getListing().getFunctions(true);
+ while (fit.hasNext() && !monitor.isCancelled()) {
+ Function f = fit.next();
+ if (!f.isExternal()) n++;
+ }
+ println("functions = " + n);
+ }
+}