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/load.c b/src/load.c
index 2751d7f..d692f86 100644
--- a/src/load.c
+++ b/src/load.c
@@ -119,18 +119,17 @@
const struct memiter *cpio,
const struct boot_params *params, struct mpool *ppool)
{
- paddr_t primary_begin = layout_primary_begin();
struct vm *vm;
struct vm_locked vm_locked;
struct vcpu_locked vcpu_locked;
size_t i;
bool ret;
- /*
- * TODO: This bound is currently meaningless but will be addressed when
- * the manifest specifies the load address.
- */
- paddr_t primary_end = pa_add(primary_begin, 0x8000000);
+ paddr_t primary_begin =
+ (manifest_vm->primary.boot_address == MANIFEST_INVALID_ADDRESS)
+ ? layout_primary_begin()
+ : pa_init(manifest_vm->primary.boot_address);
+ paddr_t primary_end = pa_add(primary_begin, RSIZE_MAX);
if (!load_kernel(stage1_locked, primary_begin, primary_end, manifest_vm,
cpio, ppool)) {