aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2012-09-06 18:12:43 +0100
committerPeter Maydell <peter.maydell@linaro.org>2012-09-26 15:20:53 +0100
commit6c648c46553f0213dd523bdf8430aececdf1e42d (patch)
tree72a0d98cfbe6918d0b4b9b1b11dadd2e0d358954
parentb9d0f17007e6109cba8760807c3814db57d67bef (diff)
downloadboot-wrapper-6c648c46553f0213dd523bdf8430aececdf1e42d.tar.gz
bootwrapper: Refactor entry into Hyp mode to be more reusable
* Split Hyp mode entry out into a separate macro. * hvc now jumps back to the caller in Hyp mode instead of branching to a fixed label. Signed-off-by: Dave Martin <dave.martin@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--boot.S23
1 files changed, 15 insertions, 8 deletions
diff --git a/boot.S b/boot.S
index 0acd243..128f74e 100644
--- a/boot.S
+++ b/boot.S
@@ -12,6 +12,15 @@
.arch_extension virt
.text
+.macro enter_hyp
+ @ We can't call hvc from secure mode, so drop down first.
+ mov r7, #0xffffffff
+ smc #0 @ Change to NS-mode
+
+ @ This is how we enter hyp mode, for booting the next stage.
+ hvc #0
+.endm
+
.align 5
/* Once we get rid of monitor.S, use these smc vectors too! */
hyp_vectors:
@@ -20,10 +29,14 @@ hyp_vectors:
.word 0 /* svc */
.word 0 /* pabt */
.word 0 /* dabt */
- b into_hyp_mode /* hvc */
+ b 1f
.word 0 /* irq */
.word 0 /* fiq */
+/* Return directly back to the caller without leaving Hyp mode: */
+1: mrs lr, elr_hyp
+ mov pc, lr
+
.globl start
start:
#ifdef SMP
@@ -83,14 +96,8 @@ start:
mov r7, #0xfffffff0
smc #0 @ Set HVBAR
- @ We can't call hvc from secure mode, so drop down first.
- mov r7, #0xffffffff
- smc #0 @ Change to NS-mode
-
- @ This is how we enter hyp mode, for booting the next stage.
- hvc #0
+ enter_hyp
-into_hyp_mode:
@ Check CPU nr again
mrc p15, 0, r0, c0, c0, 5 @ MPIDR (ARMv7 only)
and r0, r0, #15 @ CPU number