vmbase: Define .image_footer linker section
Replace the runtime memory reservation for the footer with a linker
defined placeholder. Keep this uniform across the clients instead of
making it specific for the pvmfw.
Note: no functional change intended.
Bug: 377276983
Test: m {pvmfw,rialto,vmbase_example_{bios,kernel}}_bin
Change-Id: I46ca02f68af6e0c135a1b6bf9f0701388ca9a445
diff --git a/libs/libvmbase/sections.ld b/libs/libvmbase/sections.ld
index 61af60f..222edae 100644
--- a/libs/libvmbase/sections.ld
+++ b/libs/libvmbase/sections.ld
@@ -76,6 +76,13 @@
/* Everything beyond this point will not be included in the binary. */
bin_end = data_lma + SIZEOF(.data);
+ /* Data may be appended at load time to our binary. */
+ .image_footer (NOLOAD) : ALIGN(4096) {
+ image_footer_begin = .;
+ . = ALIGN(LENGTH(image));
+ image_footer_end = .;
+ } >image
+
/* The entry point code assumes that .bss is 16-byte aligned. */
.bss : ALIGN(16) {
bss_begin = .;
diff --git a/libs/libvmbase/src/layout.rs b/libs/libvmbase/src/layout.rs
index 2f710ef..a8f7827 100644
--- a/libs/libvmbase/src/layout.rs
+++ b/libs/libvmbase/src/layout.rs
@@ -70,6 +70,11 @@
linker_region!(rodata_begin, rodata_end)
}
+/// Region which may contain a footer appended to the binary at load time.
+pub fn image_footer_range() -> Range<VirtualAddress> {
+ linker_region!(image_footer_begin, image_footer_end)
+}
+
/// Initialised writable data.
pub fn data_range() -> Range<VirtualAddress> {
linker_region!(data_begin, data_end)
diff --git a/libs/libvmbase/src/linker.rs b/libs/libvmbase/src/linker.rs
index 40afce5..8654cf9 100644
--- a/libs/libvmbase/src/linker.rs
+++ b/libs/libvmbase/src/linker.rs
@@ -35,6 +35,10 @@
pub static dtb_end: u8;
/// First byte of the region available for the exception handler stack.
pub static eh_stack_limit: u8;
+ /// First byte of the `.image_footer` section.
+ pub static image_footer_begin: u8;
+ /// First byte beyond the `.image_footer` section.
+ pub static image_footer_end: u8;
/// First byte past the region available for the exception handler stack.
pub static init_eh_stack_pointer: u8;
/// First byte past the region available for the stack.