From a492366eea9140ed6d1df14c62afcaf9ef1943ff Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 24 Jun 2014 11:19:06 +0200 Subject: [PATCH] hw: fix the TrustZone VM entry path Commit 6a3368ee that refactored the mode transition assembler path, and high-level entry point, fundamentally broke that part for the TrustZone VMs. Instead of jumping to the appropriated address, the instruction value at that point where used as target address. Moreover, the TrustZone part of the mode transition page was not included into the boundary check. Ref #1182 --- repos/base-hw/src/core/arm_v7/mode_transition.s | 8 ++++---- repos/base-hw/src/core/kernel/pd.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repos/base-hw/src/core/arm_v7/mode_transition.s b/repos/base-hw/src/core/arm_v7/mode_transition.s index df93f0f18..4b36d8f4a 100644 --- a/repos/base-hw/src/core/arm_v7/mode_transition.s +++ b/repos/base-hw/src/core/arm_v7/mode_transition.s @@ -455,10 +455,6 @@ /* apply user pc which implies application of spsr as user psr */ ldm sp, {pc}^ - /* end of the mode transition code */ - .global _mt_end - _mt_end: - /* * On vm exceptions the CPU has to jump to one of the following * 7 entry vectors to switch to a kernel context. @@ -488,3 +484,7 @@ .global _mt_vm_entry_pic _mt_vm_entry_pic: _kernel_to_vm + + /* end of the mode transition code */ + .global _mt_end + _mt_end: diff --git a/repos/base-hw/src/core/kernel/pd.h b/repos/base-hw/src/core/kernel/pd.h index e3429785d..b0071718e 100644 --- a/repos/base-hw/src/core/kernel/pd.h +++ b/repos/base-hw/src/core/kernel/pd.h @@ -222,7 +222,7 @@ class Kernel::Mode_transition_control void continue_vm(Cpu_state_modes * const context, unsigned const processor_id) { - _continue_client(context, processor_id, _mt_vm_entry_pic); + _continue_client(context, processor_id, (addr_t)&_mt_vm_entry_pic); } };