Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_m/fpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

void z_arm_save_fp_context(struct fpu_ctx_full *buffer)
{
#if defined(CONFIG_FPU_SHARING)
#if defined(CONFIG_FPU)
__ASSERT_NO_MSG(buffer != NULL);

uint32_t CONTROL = __get_CONTROL();
Expand Down Expand Up @@ -44,7 +44,7 @@ void z_arm_save_fp_context(struct fpu_ctx_full *buffer)

void z_arm_restore_fp_context(const struct fpu_ctx_full *buffer)
{
#if defined(CONFIG_FPU_SHARING)
#if defined(CONFIG_FPU)
if (buffer->ctx_saved) {
/* Set FPCA first so it is set even if an interrupt happens
* during restoration.
Expand Down
3 changes: 3 additions & 0 deletions include/zephyr/arch/arm/cortex_m/fpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
#ifndef ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_FPU_H_
#define ZEPHYR_INCLUDE_ARCH_ARM_CORTEX_M_FPU_H_

#include <stdint.h>
#include <stdbool.h>

struct fpu_ctx_full {
uint32_t caller_saved[16];
uint32_t callee_saved[16];
Expand Down
4 changes: 4 additions & 0 deletions modules/trusted-firmware-m/interface/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ int32_t tfm_ns_interface_dispatch(veneer_fn fn,
#endif
}

#if defined(CONFIG_FPU_SHARING)
struct fpu_ctx_full context_buffer;

z_arm_save_fp_context(&context_buffer);
#endif

result = fn(arg0, arg1, arg2, arg3);

#if defined(CONFIG_FPU_SHARING)
z_arm_restore_fp_context(&context_buffer);
#endif

if (!isr_mode) {
#if !defined(CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS)
Expand Down