aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Bellows <greg.bellows@linaro.org>2014-09-12 14:47:42 -0500
committerGreg Bellows <greg.bellows@linaro.org>2014-09-12 14:47:42 -0500
commit09ca03e54192732d17101df5cc6040c46cc70f9e (patch)
treebad86882f2bcd9693371226d6f951bbe818c05a4
parent851630861345b51fff47c277418b417485a0d598 (diff)
Break out non-init secure code
As part of general clean-up, move the non initialization functions out of the secure_init code. Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r--arm/Makefile.tztest1
-rw-r--r--arm/secure_init.S35
-rw-r--r--arm/tztest_secure_svc.c4
3 files changed, 4 insertions, 36 deletions
diff --git a/arm/Makefile.tztest b/arm/Makefile.tztest
index f697256..971d986 100644
--- a/arm/Makefile.tztest
+++ b/arm/Makefile.tztest
@@ -8,6 +8,7 @@ TZSECLOAD = $(ARCH)/tztest_secure.lds
TZNSECLOAD = $(ARCH)/tztest_nonsecure.lds
TZSECOBJS = $(ARCH)/secure_init.o \
$(ARCH)/tztest_secure_svc.o \
+ $(ARCH)/secure_asm.o \
$(ARCH)/sm_asm.o \
$(ARCH)/sm.o
TZNSECOBJS = $(ARCH)/nonsecure_init.o \
diff --git a/arm/secure_init.S b/arm/secure_init.S
index 642b9f8..415bafe 100644
--- a/arm/secure_init.S
+++ b/arm/secure_init.S
@@ -191,38 +191,5 @@ secure_init_monitor:
/* If we get here we are on the way out, poweroff the device */
end:
- ldr r0, =SYSREG_BASE
- add r0, r0, #SYSREG_CFGCTRL
- ldr r1, =SYS_SHUTDOWN
- str r1, [r0]
- b end
-
- .globl dispatch_secure_usr
-dispatch_secure_usr:
- /* Push the LR onto the stack so we can return immediately from the svc
- * handler on return.
- */
- push {lr}
+ b secure_shutdown
- /* Reset the user stack for the dispatch, so we have a clean stack */
- cps #CPSR_MODE_SYS
- ldr sp, =sec_usr_stacktop
- push {r0, r1}
- cps #CPSR_MODE_SVC
-
- /* Return to USR mode to execute the dispatch function in r0
- */
- ldr r0, =dispatch_usr_wrapper
- mov r1, #CPSR_MODE_USR
- push {r0, r1}
- rfefd sp!
-
-/* This is the user-side dispatch wrapper that accepts the function pointer and
- * function arg in r0 & r1 respectively. The wrapper is simply an anstraction
- * layer for translating the input parameters into the user function call.
- */
-dispatch_usr_wrapper:
- pop {r0, r1}
- mov r2, r0
- mov r0, r1
- mov pc, r2
diff --git a/arm/tztest_secure_svc.c b/arm/tztest_secure_svc.c
index 8e27dea..69f036b 100644
--- a/arm/tztest_secure_svc.c
+++ b/arm/tztest_secure_svc.c
@@ -6,7 +6,7 @@
*/
extern int _ram_nsec_base;
-int dispatch_secure_usr(int, int);
+int secure_dispatch_usr(int, int);
void tztest_secure_svc_loop(int initial_r0, int initial_r1);
void *sec_allocate_secure_memory(int);
extern uint32_t _sec_l1_page_table;
@@ -147,7 +147,7 @@ void tztest_secure_svc_loop(int initial_op, int initial_data)
case SMC_DISPATCH_SECURE_USR:
DEBUG_MSG("Dispatching secure USR function\n");
data->dispatch.ret =
- dispatch_secure_usr((int)data->dispatch.func,
+ secure_dispatch_usr((int)data->dispatch.func,
data->dispatch.arg);
DEBUG_MSG("Returned from secure USR dispatch\n");
break;