Support custom boot address for primary VMs
A VM may be preloaded to a different address than the bottom of its
address space. Support providing a custom address to ERET to after
initialization. This is supported only for primary VMs for now.
Change-Id: I81bb43bf11a626d5fe8b5cdea6361b91d9eb5e46
diff --git a/src/manifest.c b/src/manifest.c
index db01612..bbff8a5 100644
--- a/src/manifest.c
+++ b/src/manifest.c
@@ -127,6 +127,20 @@
return MANIFEST_SUCCESS;
}
+static enum manifest_return_code read_optional_uint64(
+ const struct fdt_node *node, const char *property,
+ uint64_t default_value, uint64_t *out)
+{
+ enum manifest_return_code ret;
+
+ ret = read_uint64(node, property, out);
+ if (ret == MANIFEST_ERROR_PROPERTY_NOT_FOUND) {
+ *out = default_value;
+ return MANIFEST_SUCCESS;
+ }
+ return ret;
+}
+
static enum manifest_return_code read_uint16(const struct fdt_node *node,
const char *property,
uint16_t *out)
@@ -295,6 +309,9 @@
if (vm_id == HF_PRIMARY_VM_ID) {
TRY(read_optional_string(node, "ramdisk_filename",
&vm->primary.ramdisk_filename));
+ TRY(read_optional_uint64(node, "boot_address",
+ MANIFEST_INVALID_ADDRESS,
+ &vm->primary.boot_address));
} else {
TRY(read_uint64(node, "mem_size", &vm->secondary.mem_size));
TRY(read_uint16(node, "vcpu_count", &vm->secondary.vcpu_count));