summaryrefslogtreecommitdiff
path: root/monitor.S
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2012-09-26 13:01:01 +0100
committerPeter Maydell <peter.maydell@linaro.org>2012-09-26 16:06:38 +0100
commit9be038e9d1da591cdc7697da718072da8a41e875 (patch)
tree603321e9383a3d6995fa6b407ad4848c419df2b8 /monitor.S
parent4c9faad9ada797eca381576c3da55e6e6a4acd87 (diff)
bootwrapper: Drop now-obsolete SMC interface supportdrop-smc
Now that the kernel supports simply being started in Hyp mode, we don't need to maintain the obsolete SMC interface for setting HVBAR and switching to NS mode. Drop monitor.S in favour of a much simpler special-purpose bit of code in boot.S which passes briefly through Monitor mode to set up HVBAR and drop into NS state. We also disable SMC in NS mode, so that inadvertent use of it will UNDEF rather than leaping back into the boot wrapper later on. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'monitor.S')
-rw-r--r--monitor.S95
1 files changed, 0 insertions, 95 deletions
diff --git a/monitor.S b/monitor.S
deleted file mode 100644
index dea8551..0000000
--- a/monitor.S
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * monitor.S - simple monitor code to switch to NS state before executing kernel
- *
- * Copyright (C) 2011 Columbia University. All rights reserved.
- * Christoffer Dall <cdall@cs.columbia.edu>
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE.txt file.
- */
-
-#.syntax unified
- .section monitor, "x"
-
- .word 0
- .word 0
- b 1f
- .word 0
- .word 0
- .word 0
- .word 0
- .word 0
-
- @
- @ Secure Monitor Call
- @
-1:
- ldr sp, =_monitor_stack
- push {r10-r12}
-
- cmp r7, #0xffffffff
- beq _non_sec
-
- @ Check smc number and VMID
- bic r12, r7, #0xf
- cmp r12, #0xfffffff0
- movnes pc, lr
- and r12, r7, #0xf
- cmp r12, #0x0
- popgt {r10-r12}
- movgts pc, lr
-
- @ Check the VMID is 0
- mrc p15, 0, r10, c1, c1, 0 @ SCR
- orr r11, r10, #1 @ SCR.NS = 1
- mcr p15, 0, r11, c1, c1, 0
- isb
- mrrc p15, 6, r12, r11, c2
- mcr p15, 0, r10, c1, c1, 0 @ Restore SCR
- lsr r11, r11, #16
- and r11, r11, #0xff
- cmp r11, #0
- popne {r10-r12}
- movnes pc, lr
-
- @ Jump to the right function
- and r12, r7, #0xf
- adr r11, _hyp_funcs
- add r11, r11, r12, lsl #2
- ldr pc, [r11]
-
- @
- @ Jump table for the SMC hypervisor API calls
- @
-_hyp_funcs:
- .long _write_hvbar
-
- @
- @ Switch to non-secure mode
- @
-_non_sec:
- mrc p15, 0, r12, c1, c1, 0 @ Secure configuration register
- bic r12, r12, #0x07f
- ldr r11, =0x131
- orr r12, r12, r11
- mcr p15, 0, r12, c1, c1, 0
- pop {r10-r12}
- movs pc, lr
-
- @
- @ Read/Write HVBAR
- @
-_write_hvbar:
- orr r11, r10, #1 @ SCR.NS = 1 (r10 already = SCR)
- mcr p15, 0, r11, c1, c1, 0
- isb
- mcr p15, 4, r0, c12, c0, 0
- mcr p15, 0, r10, c1, c1, 0 @ Restore SCR
- pop {r10-r12}
- movs pc, lr
-
- .ltorg
-
- /* A bit of stack space for monitor mode */
- .align 12
-_monitor_stack: