From 11af394fec5d2723827819ce43c7205bc20fa6dc Mon Sep 17 00:00:00 2001 From: gdisirio Date: Sat, 19 Feb 2011 21:23:12 +0000 Subject: [PATCH] Fixed bug 3187105. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2744 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/ARMCMx/chcore_v6m.c | 5 +++-- os/ports/IAR/ARMCMx/chcoreasm_v6m.s | 3 ++- os/ports/RVCT/ARMCMx/chcoreasm_v6m.s | 3 ++- readme.txt | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/os/ports/GCC/ARMCMx/chcore_v6m.c b/os/ports/GCC/ARMCMx/chcore_v6m.c index dbff1d07c..790761876 100644 --- a/os/ports/GCC/ARMCMx/chcore_v6m.c +++ b/os/ports/GCC/ARMCMx/chcore_v6m.c @@ -75,7 +75,7 @@ void _port_switch_from_isr(void) { chSchDoRescheduleI(); - /* Note, the last registers are restored alone after re-enabling the + /* Note, the last register is restored alone after re-enabling the interrupts in order to minimize the (very remote and unlikely) possibility that the stack is filled by continuous and saturating interrupts that would not allow that last words to be pulled out of @@ -84,8 +84,9 @@ void _port_switch_from_isr(void) { "mov r12, r1 \n\t" "msr APSR, r0 \n\t" "mov lr, r2 \n\t" + "pop {r0, r1, r2, r3} \n\t" "cpsie i \n\t" - "pop {r0, r1, r2, r3, pc}" : : : "memory"); + "pop {pc}" : : : "memory"); } #define PUSH_CONTEXT(sp) { \ diff --git a/os/ports/IAR/ARMCMx/chcoreasm_v6m.s b/os/ports/IAR/ARMCMx/chcoreasm_v6m.s index 07d89e6b5..1b8a5583c 100644 --- a/os/ports/IAR/ARMCMx/chcoreasm_v6m.s +++ b/os/ports/IAR/ARMCMx/chcoreasm_v6m.s @@ -96,8 +96,9 @@ _port_switch_from_isr: mov r12, r1 msr APSR, r0 mov lr, r2 + pop {r0, r1, r2, r3} cpsie i - pop {r0, r1, r2, r3, pc} + pop {pc} /* * Reschedule verification and setup after an IRQ. diff --git a/os/ports/RVCT/ARMCMx/chcoreasm_v6m.s b/os/ports/RVCT/ARMCMx/chcoreasm_v6m.s index 8f348f099..2424de03f 100644 --- a/os/ports/RVCT/ARMCMx/chcoreasm_v6m.s +++ b/os/ports/RVCT/ARMCMx/chcoreasm_v6m.s @@ -93,8 +93,9 @@ _port_switch_from_isr PROC mov r12, r1 msr APSR, r0 mov lr, r2 + pop {r0, r1, r2, r3} cpsie i - pop {r0, r1, r2, r3, pc} + pop {pc} ENDP /* diff --git a/readme.txt b/readme.txt index 659860a0e..c2f718246 100644 --- a/readme.txt +++ b/readme.txt @@ -69,6 +69,8 @@ ***************************************************************************** *** 2.3.0 *** +- FIX: Stack overflow in CM0 port when nearing interrupts saturation (bug + 3187105)(backported to 2.2.1). - FIX: Error in MAC driver (bug 3179783)(backported to 2.2.1). - FIX: Fixed wrong serial driver macros (bug 3173336)(backported to 2.2.1). - NEW: Added experimental generic USB driver, it will evolve in next