This is an automated email from the ASF dual-hosted git repository.

ligd pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 57650d841e armv8-m: set fpscr when do exception_direct
57650d841e is described below

commit 57650d841e78ea1aafd3e59023659ea0e4fd7b49
Author: zhangyuan29 <zhangyua...@xiaomi.com>
AuthorDate: Mon Aug 19 16:57:31 2024 +0800

    armv8-m: set fpscr when do exception_direct
    
    In armv8m the FPSCR[18:16] LTPSIZE field must be set to 0b100 for
    "Tail predication not applied" as it's reset value.
    
    Signed-off-by: zhangyuan29 <zhangyua...@xiaomi.com>
---
 arch/arm/src/armv8-m/arm_doirq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/src/armv8-m/arm_doirq.c b/arch/arm/src/armv8-m/arm_doirq.c
index 0f3fad50bb..469251a09a 100644
--- a/arch/arm/src/armv8-m/arm_doirq.c
+++ b/arch/arm/src/armv8-m/arm_doirq.c
@@ -36,6 +36,7 @@
 #include "arm_internal.h"
 #include "exc_return.h"
 #include "nvic.h"
+#include "psr.h"
 
 /****************************************************************************
  * Public Functions
@@ -45,6 +46,16 @@ void exception_direct(void)
 {
   int irq = getipsr();
 
+#ifdef CONFIG_ARCH_FPU
+  __asm__ __volatile__
+    (
+      "mov r0, %0\n"
+      "vmsr fpscr, r0\n"
+      :
+      : "i" (ARMV8M_FPSCR_LTPSIZE_NONE)
+    );
+#endif
+
   arm_ack_irq(irq);
   irq_dispatch(irq, NULL);
 

Reply via email to