diff options
author | David Hu <david.hu@arm.com> | 2019-07-02 18:08:23 +0800 |
---|---|---|
committer | David Hu <david.hu@arm.com> | 2019-07-04 15:27:42 +0800 |
commit | cfbf2a2fe46809b8b27de01079b16f903ad2bd0a (patch) | |
tree | 477793d4e2caa7dd32d17ba14886165f1932fd1e | |
parent | 21e752e1df7de691bc581abd5d8aaa39354f5a90 (diff) | |
download | trusted-firmware-m-cfbf2a2fe46809b8b27de01079b16f903ad2bd0a.tar.gz |
Arch: Abstract checking whether FP is allocated in stack from EXC_RETURN
Abstract the operation checking whether Floating Point status
information is allocated in stack frame from EXC_RETURN value.
Change-Id: Id7dab53f58f303a402aa9ed9f4f840fcb0a97a11
Signed-off-by: David Hu <david.hu@arm.com>
-rw-r--r-- | secure_fw/core/arch/include/tfm_arch_v8m.h | 14 | ||||
-rw-r--r-- | secure_fw/core/ipc/tfm_svcalls.c | 2 |
2 files changed, 15 insertions, 1 deletions
diff --git a/secure_fw/core/arch/include/tfm_arch_v8m.h b/secure_fw/core/arch/include/tfm_arch_v8m.h index bbf397d76b..99420f8329 100644 --- a/secure_fw/core/arch/include/tfm_arch_v8m.h +++ b/secure_fw/core/arch/include/tfm_arch_v8m.h @@ -77,6 +77,20 @@ __STATIC_INLINE bool is_return_secure_stack(uint32_t lr) } /** + * \brief Check whether the stack frame for this exception has space allocated + * for Floating Point(FP) state information. + * + * \param[in] lr LR register containing the EXC_RETURN value. + * + * \retval true The stack allocates space for FP information + * \retval false The stack doesn't allocate space for FP information + */ +__STATIC_INLINE bool is_stack_alloc_fp_space(uint32_t lr) +{ + return (lr & EXC_RETURN_FPU_FRAME_BASIC) ? false : true; +} + +/** * \brief Set PSPLIM register. * * \param[in] psplim Register value to be written into PSPLIM. diff --git a/secure_fw/core/ipc/tfm_svcalls.c b/secure_fw/core/ipc/tfm_svcalls.c index 45d286493f..e33884851f 100644 --- a/secure_fw/core/ipc/tfm_svcalls.c +++ b/secure_fw/core/ipc/tfm_svcalls.c @@ -88,7 +88,7 @@ psa_status_t tfm_svcall_psa_call(uint32_t *args, int32_t ns_caller, uint32_t lr) * - if FP is used and FPCCR_S.TS is 1, 5th parameter is at 42th * position counting from SP. */ - if (lr & EXC_RETURN_FPU_FRAME_BASIC) { + if (!is_stack_alloc_fp_space(lr)) { out_num = (size_t)args[8]; #if defined (__FPU_USED) && (__FPU_USED == 1U) } else if (FPU->FPCCR & FPU_FPCCR_TS_Msk) { |