aboutsummaryrefslogtreecommitdiffstats
path: root/os/ports/GCC/ARMCMx/chcore_v6m.h
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-26 09:36:20 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2011-02-26 09:36:20 +0000
commita34c2444c227b41a397fa8bde985e5015dc01a1d (patch)
treed1cae3cd61c604593240f7414f0e5928ea396b00 /os/ports/GCC/ARMCMx/chcore_v6m.h
parentcd17bfa35ec8b30b490952abeb2177d3498d6bb4 (diff)
downloadChibiOS-a34c2444c227b41a397fa8bde985e5015dc01a1d.tar.gz
ChibiOS-a34c2444c227b41a397fa8bde985e5015dc01a1d.tar.bz2
ChibiOS-a34c2444c227b41a397fa8bde985e5015dc01a1d.zip
Fixed bug 3193062 (GCC only).
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2764 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/ports/GCC/ARMCMx/chcore_v6m.h')
-rw-r--r--os/ports/GCC/ARMCMx/chcore_v6m.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.h b/os/ports/GCC/ARMCMx/chcore_v6m.h
index 1bd2f777e..4b4ef04f6 100644
--- a/os/ports/GCC/ARMCMx/chcore_v6m.h
+++ b/os/ports/GCC/ARMCMx/chcore_v6m.h
@@ -118,11 +118,9 @@ struct intctx {
* @details This macro must be inserted at the start of all IRQ handlers
* enabled to invoke system APIs.
*/
-#define PORT_IRQ_PROLOGUE() { \
- port_lock_from_isr(); \
- _port_irq_nesting++; \
- port_unlock_from_isr(); \
-}
+#define PORT_IRQ_PROLOGUE() \
+ regarm_t _saved_lr; \
+ asm volatile ("mov %0, lr" : "=r" (_saved_lr) : : "memory")
/**
* @brief IRQ epilogue code.
@@ -131,7 +129,7 @@ struct intctx {
*/
#define PORT_IRQ_EPILOGUE() { \
port_lock_from_isr(); \
- if ((--_port_irq_nesting == 0) && chSchIsRescRequiredExI()) { \
+ if ((_saved_lr != (regarm_t)0xFFFFFFF1) && chSchIsRescRequiredExI()) { \
register struct cmxctx *ctxp; \
\
asm volatile ("mrs %0, PSP" : "=r" (ctxp) : ); \
@@ -160,7 +158,6 @@ struct intctx {
* @brief Port-related initialization code.
*/
#define port_init() { \
- _port_irq_nesting = 0; \
SCB_AIRCR = AIRCR_VECTKEY | AIRCR_PRIGROUP(0); \
NVICSetSystemHandlerPriority(HANDLER_SYSTICK, \
CORTEX_PRIORITY_MASK(CORTEX_PRIORITY_SYSTICK)); \
@@ -229,7 +226,6 @@ struct intctx {
#if !defined(__DOXYGEN__)
extern regarm_t _port_saved_pc;
-extern unsigned _port_irq_nesting;
#endif
#ifdef __cplusplus