vmbase: Introduce the reset_or_hang macro
Extract the logic from exceptions_panic.S as boot code might use it.
Stop zeroing registers x1-x3 as it doesn't seem to be required by PSCI.
Test: atest MicrodroidTestApp
Change-Id: I8c9eb371299152b173c8bb589dccfb6edf8d634e
diff --git a/vmbase/common.h b/vmbase/common.h
index 8878c6e..788dcf0 100644
--- a/vmbase/common.h
+++ b/vmbase/common.h
@@ -16,6 +16,8 @@
#pragma once
+#define PSCI_SYSTEM_RESET (0x84000009)
+
.macro adr_l, reg:req, sym:req
adrp \reg, \sym
add \reg, \reg, :lo12:\sym
@@ -27,3 +29,10 @@
movk \reg, :abs_g1_nc:\imm
movk \reg, :abs_g0_nc:\imm
.endm
+
+.macro reset_or_hang
+ mov_i x0, PSCI_SYSTEM_RESET
+ hvc 0
+999: wfi
+ b 999b
+.endm