From a34c2444c227b41a397fa8bde985e5015dc01a1d Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 26 Feb 2011 09:36:20 +0000 Subject: Fixed bug 3193062 (GCC only). git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2764 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/ARMCMx/chcore_v6m.c | 5 ----- os/ports/GCC/ARMCMx/chcore_v6m.h | 12 ++++-------- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'os/ports/GCC') diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.c b/os/ports/GCC/ARMCMx/chcore_v6m.c index 790761876..4e49e6256 100644 --- a/os/ports/GCC/ARMCMx/chcore_v6m.c +++ b/os/ports/GCC/ARMCMx/chcore_v6m.c @@ -32,11 +32,6 @@ */ regarm_t _port_saved_pc; -/** - * @brief IRQ nesting counter. - */ -unsigned _port_irq_nesting; - /** * @brief System Timer vector. * @details This interrupt is used as system tick. 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 -- cgit v1.2.3