vmbase: entry.S: Reset if relocated
As vmbase-based baremetal code isn't position-independent, refuse to
keep booting if the image wasn't loaded where we intended it to be.
Test: atest MicrodroidTestApp
Change-Id: I9980d82cc43e66fd368812da0e4197bd88dd2b12
diff --git a/vmbase/entry.S b/vmbase/entry.S
index e1d2c98..5f0a2ce 100644
--- a/vmbase/entry.S
+++ b/vmbase/entry.S
@@ -85,6 +85,16 @@
adr x30, vector_table_panic
msr vbar_el1, x30
+ /*
+ * Our load address is set by the host so validate it before proceeding.
+ */
+ adr x30, entry
+ mov_i x29, entry
+ cmp x29, x30
+ b.eq 1f
+ reset_or_hang
+1:
+
adrp x30, idmap
msr ttbr0_el1, x30