Skip to content

Commit

Permalink
Disable native and foreign interrupts in thread handlers for arm32
Browse files Browse the repository at this point in the history
The tee handlers can decide when the native interrupts can be enabled.

Signed-off-by: David Wang <david.wang@arm.com>
  • Loading branch information
David Wang committed Aug 18, 2017
1 parent 59a3cd8 commit 345e2bb
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
32 changes: 16 additions & 16 deletions core/arch/arm/kernel/thread_a32.S
Original file line number Diff line number Diff line change
Expand Up @@ -656,12 +656,12 @@ thread_abort_handler:
thread_und_handler:
UNWIND( .fnstart)
UNWIND( .cantunwind)
#if defined(CFG_ARM_GICV3)
/*
* Disable FIQ which is used as foreign interrupt in GICv3 mode
* Disable both foreign and native interrupts in the thread handlers.
* The tee handlers can decide when the native interrupts should
* be enabled.
*/
cpsid f
#endif
cpsid f /* IRQ is already masked by the hardware */
/*
* Switch to abort mode to use that stack instead.
*/
Expand All @@ -679,12 +679,12 @@ UNWIND( .cantunwind)
b .thread_abort_generic

thread_dabort_handler:
#if defined(CFG_ARM_GICV3)
/*
* Disable FIQ which is used as foreign interrupt in GICv3 mode
* Disable both foreign and native interrupts in the thread handlers.
* The tee handlers can decide when the native interrupts should
* be enabled.
*/
cpsid f
#endif
cpsid f /* IRQ is already masked by the hardware */
push {r0-r11, ip}
sub r1, lr, #8
mrs r0, spsr
Expand All @@ -693,12 +693,12 @@ thread_dabort_handler:
b .thread_abort_generic

thread_pabort_handler:
#if defined(CFG_ARM_GICV3)
/*
* Disable FIQ which is used as foreign interrupt in GICv3 mode
* Disable both foreign and native interrupts in the thread handlers.
* The tee handlers can decide when the native interrupts should
* be enabled.
*/
cpsid f
#endif
cpsid f /* IRQ is already masked by the hardware */
push {r0-r11, ip}
sub r1, lr, #4
mrs r0, spsr
Expand Down Expand Up @@ -730,12 +730,12 @@ END_FUNC thread_abort_handler
LOCAL_FUNC thread_svc_handler , :
UNWIND( .fnstart)
UNWIND( .cantunwind)
#if defined(CFG_ARM_GICV3)
/*
* Disable FIQ which is used as foreign interrupt in GICv3 mode
* Disable both foreign and native interrupts in the thread handlers.
* The tee handlers can decide when the native interrupts should
* be enabled.
*/
cpsid f
#endif
cpsid f /* IRQ is already masked by the hardware */
push {r0-r7, lr}
mrs r0, spsr
push {r0}
Expand Down
3 changes: 3 additions & 0 deletions core/arch/arm/tee/arch_svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ void __weak tee_svc_handler(struct thread_svc_regs *regs)
COMPILE_TIME_ASSERT(ARRAY_SIZE(tee_svc_syscall_table) ==
(TEE_SCN_MAX + 1));

/* Enable native interupts */
thread_unmask_exceptions(THREAD_EXCP_NATIVE_INTR);

thread_user_save_vfp();

/* TA has just entered kernel mode */
Expand Down

0 comments on commit 345e2bb

Please sign in to comment.