summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/common
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2013-07-23 17:52:06 -0600
committerGregory Nutt <gnutt@nuttx.org>2013-07-23 17:52:06 -0600
commit0d5c6f5ba0e21048316e15c63ae4c7eeca269ba0 (patch)
treed58f3643565c971c233e6e9d12718570b18a8500 /nuttx/arch/arm/src/common
parent01282438eedb355172c734726723549d6f767bc1 (diff)
downloadnuttx-0d5c6f5ba0e21048316e15c63ae4c7eeca269ba0.tar.gz
nuttx-0d5c6f5ba0e21048316e15c63ae4c7eeca269ba0.tar.bz2
nuttx-0d5c6f5ba0e21048316e15c63ae4c7eeca269ba0.zip
Improve some ARMv7-A/M floating point register save time; Add floating point register save logic for ARMv7-A
Diffstat (limited to 'nuttx/arch/arm/src/common')
-rw-r--r--nuttx/arch/arm/src/common/up_internal.h37
1 files changed, 32 insertions, 5 deletions
diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h
index 5f3f5e63b..86e49004c 100644
--- a/nuttx/arch/arm/src/common/up_internal.h
+++ b/nuttx/arch/arm/src/common/up_internal.h
@@ -121,22 +121,46 @@
#if defined(CONFIG_ARCH_CORTEXM0) || defined(CONFIG_ARCH_CORTEXM3) || \
defined(CONFIG_ARCH_CORTEXM4)
+ /* If the floating point unit is present and enabled, then save the
+ * floating point registers as well as normal ARM registers. This only
+ * applies if "lazy" floating point register save/restore is used
+ * (i.e., not CONFIG_ARMV7M_CMNVECTOR).
+ */
+
# if defined(CONFIG_ARCH_FPU) && !defined(CONFIG_ARMV7M_CMNVECTOR)
# define up_savestate(regs) \
do { \
- up_copystate(regs, (uint32_t*)current_regs); \
+ up_copyarmstate(regs, (uint32_t*)current_regs); \
up_savefpu(regs); \
} \
while (0)
# else
-# define up_savestate(regs) up_copystate(regs, (uint32_t*)current_regs)
+# define up_savestate(regs) up_copyfullstate(regs, (uint32_t*)current_regs)
# endif
# define up_restorestate(regs) (current_regs = regs)
+/* Otherwise, for the ARM7, ARM9, and Cortex-A5. The state is copied in full
+ * from stack to stack. This is not very efficient.
+ */
+
#else
-# define up_savestate(regs) up_copystate(regs, (uint32_t*)current_regs)
-# define up_restorestate(regs) up_copystate((uint32_t*)current_regs, regs)
+ /* If the floating point unit is present and enabled, then save the
+ * floating point registers as well as normal ARM registers. Only "lazy"
+ * floating point save/restore is supported.
+ */
+
+# if defined(CONFIG_ARCH_FPU)
+# define up_savestate(regs) \
+ do { \
+ up_copyarmstate(regs, (uint32_t*)current_regs); \
+ up_savefpu(regs); \
+ } \
+ while (0)
+# else
+# define up_savestate(regs) up_copyfullstate(regs, (uint32_t*)current_regs)
+# endif
+# define up_restorestate(regs) up_copyfullstate((uint32_t*)current_regs, regs)
#endif
@@ -244,7 +268,10 @@ void up_boot(void);
/* Context switching */
-void up_copystate(uint32_t *dest, uint32_t *src);
+void up_copyfullstate(uint32_t *dest, uint32_t *src);
+#ifdef CONFIG_ARCH_FPU
+void up_copyarmstate(uint32_t *dest, uint32_t *src);
+#endif
void up_decodeirq(uint32_t *regs);
int up_saveusercontext(uint32_t *saveregs);
void up_fullcontextrestore(uint32_t *restoreregs) noreturn_function;