diff options
author | Jens Wiklander <jens.wiklander@linaro.org> | 2020-07-23 11:01:47 +0200 |
---|---|---|
committer | Jérôme Forissier <jerome@forissier.org> | 2020-07-27 10:38:59 +0200 |
commit | ab42a6aff643944b6fff1e2edf8f8ce64e14e38a (patch) | |
tree | ad9742ea02e383542377b649b8cf2d233ab8fe40 | |
parent | 651d75378f517f798eba7a508e8b457504c0a05c (diff) |
core: remove thread_*_handler_ptr
The thread_*_handler_ptr function pointers only holds the same constant
value. Instead of loading the function pointer from the entry functions
call the handler functions directly and remove these
thread_*_handler_ptr function pointers.
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
-rw-r--r-- | core/arch/arm/include/kernel/thread.h | 3 | ||||
-rw-r--r-- | core/arch/arm/kernel/thread.c | 16 | ||||
-rw-r--r-- | core/arch/arm/kernel/thread_optee_smc_a32.S | 40 | ||||
-rw-r--r-- | core/arch/arm/kernel/thread_optee_smc_a64.S | 26 |
4 files changed, 12 insertions, 73 deletions
diff --git a/core/arch/arm/include/kernel/thread.h b/core/arch/arm/include/kernel/thread.h index 7f90cf65..e10e78fe 100644 --- a/core/arch/arm/include/kernel/thread.h +++ b/core/arch/arm/include/kernel/thread.h @@ -255,9 +255,6 @@ unsigned long thread_system_off_handler(unsigned long a0, unsigned long a1); unsigned long thread_system_reset_handler(unsigned long a0, unsigned long a1); #endif /*CFG_WITH_ARM_TRUSTED_FW*/ -typedef unsigned long (*thread_pm_handler_t)(unsigned long a0, - unsigned long a1); - void thread_init_primary(void); void thread_init_per_cpu(void); diff --git a/core/arch/arm/kernel/thread.c b/core/arch/arm/kernel/thread.c index 48ee3a95..6900e360 100644 --- a/core/arch/arm/kernel/thread.c +++ b/core/arch/arm/kernel/thread.c @@ -122,22 +122,6 @@ const uint32_t stack_tmp_stride __section(".identity_map.stack_tmp_stride") = DECLARE_KEEP_PAGER(stack_tmp_export); DECLARE_KEEP_PAGER(stack_tmp_stride); -#if defined(CFG_WITH_ARM_TRUSTED_FW) -const thread_pm_handler_t thread_cpu_on_handler_ptr __nex_data = - cpu_on_handler; -const thread_pm_handler_t thread_cpu_off_handler_ptr __nex_data = - thread_cpu_off_handler; -const thread_pm_handler_t thread_cpu_suspend_handler_ptr __nex_data = - thread_cpu_suspend_handler; -const thread_pm_handler_t thread_cpu_resume_handler_ptr __nex_data = - thread_cpu_resume_handler; -const thread_pm_handler_t thread_system_off_handler_ptr __nex_data = - thread_system_off_handler; -const thread_pm_handler_t thread_system_reset_handler_ptr __nex_data = - thread_system_reset_handler; -#endif - - #ifdef CFG_CORE_UNMAP_CORE_AT_EL0 static vaddr_t thread_user_kcode_va __nex_bss; long thread_user_kcode_offset __nex_bss; diff --git a/core/arch/arm/kernel/thread_optee_smc_a32.S b/core/arch/arm/kernel/thread_optee_smc_a32.S index d48309b5..f26eabdb 100644 --- a/core/arch/arm/kernel/thread_optee_smc_a32.S +++ b/core/arch/arm/kernel/thread_optee_smc_a32.S @@ -86,30 +86,12 @@ END_FUNC vector_fiq_entry LOCAL_FUNC vector_cpu_on_entry , : , .identity_map UNWIND( .fnstart) UNWIND( .cantunwind) - /* - * We're executing from physical address here while the binary may - * have been relocated to a different virtual address. In order to - * still read the expected physical memory we must use purely - * relative addressing. - */ - adr r0, .cpu_on_handler_ptr_rel - ldr r1, .cpu_on_handler_ptr_rel - ldr lr, [r0, r1] - adr r2, .boot_mmu_config_rel - ldr r3, .boot_mmu_config_rel - add r12, r2, r3 - ldr r12, [r12, #CORE_MMU_CONFIG_LOAD_OFFSET] - sub lr, lr, r12 - blx lr + bl cpu_on_handler /* When cpu_on_handler() returns mmu is enabled */ mov r1, r0 ldr r0, =TEESMC_OPTEED_RETURN_ON_DONE smc #0 b . /* SMC should not return */ -.cpu_on_handler_ptr_rel: - .word thread_cpu_on_handler_ptr - .cpu_on_handler_ptr_rel -.boot_mmu_config_rel: - .word boot_mmu_config - .boot_mmu_config_rel UNWIND( .fnend) END_FUNC vector_cpu_on_entry @@ -117,9 +99,7 @@ LOCAL_FUNC vector_cpu_off_entry , : , .identity_map UNWIND( .fnstart) UNWIND( .cantunwind) readjust_pc - ldr lr, =thread_cpu_off_handler_ptr - ldr lr, [lr] - blx lr + bl thread_cpu_off_handler mov r1, r0 ldr r0, =TEESMC_OPTEED_RETURN_OFF_DONE smc #0 @@ -131,9 +111,7 @@ LOCAL_FUNC vector_cpu_suspend_entry , : , .identity_map UNWIND( .fnstart) UNWIND( .cantunwind) readjust_pc - ldr lr, =thread_cpu_suspend_handler_ptr - ldr lr, [lr] - blx lr + bl thread_cpu_suspend_handler mov r1, r0 ldr r0, =TEESMC_OPTEED_RETURN_SUSPEND_DONE smc #0 @@ -145,9 +123,7 @@ LOCAL_FUNC vector_cpu_resume_entry , : , .identity_map UNWIND( .fnstart) UNWIND( .cantunwind) readjust_pc - ldr lr, =thread_cpu_resume_handler_ptr - ldr lr, [lr] - blx lr + bl thread_cpu_resume_handler mov r1, r0 ldr r0, =TEESMC_OPTEED_RETURN_RESUME_DONE smc #0 @@ -159,9 +135,7 @@ LOCAL_FUNC vector_system_off_entry , : , .identity_map UNWIND( .fnstart) UNWIND( .cantunwind) readjust_pc - ldr lr, =thread_system_off_handler_ptr - ldr lr, [lr] - blx lr + bl thread_system_off_handler mov r1, r0 ldr r0, =TEESMC_OPTEED_RETURN_SYSTEM_OFF_DONE smc #0 @@ -173,9 +147,7 @@ LOCAL_FUNC vector_system_reset_entry , : , .identity_map UNWIND( .fnstart) UNWIND( .cantunwind) readjust_pc - ldr lr, =thread_system_reset_handler_ptr - ldr lr, [lr] - blx lr + bl thread_system_reset_handler mov r1, r0 ldr r0, =TEESMC_OPTEED_RETURN_SYSTEM_RESET_DONE smc #0 diff --git a/core/arch/arm/kernel/thread_optee_smc_a64.S b/core/arch/arm/kernel/thread_optee_smc_a64.S index 08246367..63b73cb5 100644 --- a/core/arch/arm/kernel/thread_optee_smc_a64.S +++ b/core/arch/arm/kernel/thread_optee_smc_a64.S @@ -72,11 +72,7 @@ LOCAL_FUNC vector_fiq_entry , : , .identity_map END_FUNC vector_fiq_entry LOCAL_FUNC vector_cpu_on_entry , : , .identity_map - adr_l x16, thread_cpu_on_handler_ptr - ldr x16, [x16] - ldr x17, boot_mmu_config + CORE_MMU_CONFIG_LOAD_OFFSET - sub x16, x16, x17 - blr x16 + bl cpu_on_handler mov x1, x0 ldr x0, =TEESMC_OPTEED_RETURN_ON_DONE smc #0 @@ -85,9 +81,7 @@ END_FUNC vector_cpu_on_entry LOCAL_FUNC vector_cpu_off_entry , : , .identity_map readjust_pc - adr_l x16, thread_cpu_off_handler_ptr - ldr x16, [x16] - blr x16 + bl thread_cpu_off_handler mov x1, x0 ldr x0, =TEESMC_OPTEED_RETURN_OFF_DONE smc #0 @@ -96,9 +90,7 @@ END_FUNC vector_cpu_off_entry LOCAL_FUNC vector_cpu_suspend_entry , : , .identity_map readjust_pc - adr_l x16, thread_cpu_suspend_handler_ptr - ldr x16, [x16] - blr x16 + bl thread_cpu_suspend_handler mov x1, x0 ldr x0, =TEESMC_OPTEED_RETURN_SUSPEND_DONE smc #0 @@ -107,9 +99,7 @@ END_FUNC vector_cpu_suspend_entry LOCAL_FUNC vector_cpu_resume_entry , : , .identity_map readjust_pc - adr_l x16, thread_cpu_resume_handler_ptr - ldr x16, [x16] - blr x16 + bl thread_cpu_resume_handler mov x1, x0 ldr x0, =TEESMC_OPTEED_RETURN_RESUME_DONE smc #0 @@ -118,9 +108,7 @@ END_FUNC vector_cpu_resume_entry LOCAL_FUNC vector_system_off_entry , : , .identity_map readjust_pc - adr_l x16, thread_system_off_handler_ptr - ldr x16, [x16] - blr x16 + bl thread_system_off_handler mov x1, x0 ldr x0, =TEESMC_OPTEED_RETURN_SYSTEM_OFF_DONE smc #0 @@ -129,9 +117,7 @@ END_FUNC vector_system_off_entry LOCAL_FUNC vector_system_reset_entry , : , .identity_map readjust_pc - adr_l x16, thread_system_reset_handler_ptr - ldr x16, [x16] - blr x16 + bl thread_system_reset_handler mov x1, x0 ldr x0, =TEESMC_OPTEED_RETURN_SYSTEM_RESET_DONE smc #0 |