[process] Expose process base address
This address is needed by inferior_control in Garnet.
TEST=ProcessBuilder.Control in Garnet
Change-Id: I4747dafaf540695b5f383bfac1e7acc416b1659c
diff --git a/system/fidl/process/process.fidl b/system/fidl/process/process.fidl
index 21394fc..51da0f5 100644
--- a/system/fidl/process/process.fidl
+++ b/system/fidl/process/process.fidl
@@ -85,6 +85,11 @@
//
// Should be passed to |zx_process_start| when starting the process.
uint64 vdso_base;
+
+ // The base load address of the the ELF file loaded.
+ //
+ // Most often used by debuggers or other tools that inspect the process.
+ uint64 base;
};
struct CreateWithoutStartingResult {
diff --git a/system/ulib/launchpad/include/launchpad/launchpad.h b/system/ulib/launchpad/include/launchpad/launchpad.h
index 46d5352..e6a8553 100644
--- a/system/ulib/launchpad/include/launchpad/launchpad.h
+++ b/system/ulib/launchpad/include/launchpad/launchpad.h
@@ -126,6 +126,9 @@
// The base address of the vDSO to pass to the process on startup.
zx_vaddr_t vdso_base;
+
+ // The base load address of the the ELF file loaded.
+ zx_vaddr_t base;
} launchpad_start_data_t;
// If none of the launchpad_*() calls against this launchpad have failed,
diff --git a/system/ulib/launchpad/launchpad.c b/system/ulib/launchpad/launchpad.c
index da527ff..283ec38 100644
--- a/system/ulib/launchpad/launchpad.c
+++ b/system/ulib/launchpad/launchpad.c
@@ -1221,6 +1221,7 @@
result->sp = sp;
result->bootstrap = bootstrap;
result->vdso_base = lp->vdso_base;
+ result->base = lp->base;
return ZX_OK;
cleanup:
diff --git a/system/ulib/process-launcher/launcher.cpp b/system/ulib/process-launcher/launcher.cpp
index 7e05fd2..53e274f 100644
--- a/system/ulib/process-launcher/launcher.cpp
+++ b/system/ulib/process-launcher/launcher.cpp
@@ -179,6 +179,7 @@
result->data->sp = data.sp;
result->data->bootstrap = data.bootstrap;
result->data->vdso_base = data.vdso_base;
+ result->data->base = data.base;
} else if (error_msg) {
uint32_t len = static_cast<uint32_t>(strlen(error_msg));
result->error_message.size = len;