diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-06-22 18:07:34 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2010-06-22 18:07:34 +0000 |
commit | 28437e3058e78509ac7f692b80cf8ffd04db1a9b (patch) | |
tree | 94866254fd483b5b4877633f5858ab0ac60087c1 /os | |
parent | f115fa2321518d4f6297a252415c8f1df45a8234 (diff) | |
download | ChibiOS-28437e3058e78509ac7f692b80cf8ffd04db1a9b.tar.gz ChibiOS-28437e3058e78509ac7f692b80cf8ffd04db1a9b.tar.bz2 ChibiOS-28437e3058e78509ac7f692b80cf8ffd04db1a9b.zip |
Fixed bug 3019738.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2034 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os')
-rw-r--r-- | os/ports/GCC/ARMCMx/chcore_v7m.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/os/ports/GCC/ARMCMx/chcore_v7m.c b/os/ports/GCC/ARMCMx/chcore_v7m.c index 68aba522d..74b9ff43b 100644 --- a/os/ports/GCC/ARMCMx/chcore_v7m.c +++ b/os/ports/GCC/ARMCMx/chcore_v7m.c @@ -30,16 +30,15 @@ /**
* @brief Internal context stacking. */
-#define PUSH_CONTEXT(sp) { \
+#define PUSH_CONTEXT() { \
asm volatile ("push {r4, r5, r6, r7, r8, r9, r10, r11, lr}"); \
}
/**
* @brief Internal context unstacking.
*/
-#define POP_CONTEXT(sp) { \
- asm volatile ("pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}" \
- : : "r" (sp)); \
+#define POP_CONTEXT() { \
+ asm volatile ("pop {r4, r5, r6, r7, r8, r9, r10, r11, pc}"); \
}
#if !CH_OPTIMIZE_SPEED
@@ -137,21 +136,21 @@ void _port_switch_from_isr(void) { __attribute__((naked))
#endif
void port_switch(Thread *ntp, Thread *otp) {
- register struct intctx *r13 asm ("r13");
- /* Stack overflow check, if enabled.*/
#if CH_DBG_ENABLE_STACK_CHECK
+ /* Stack overflow check, if enabled.*/
+ register struct intctx *r13 asm ("r13");
if ((void *)(r13 - 1) < (void *)(otp + 1))
asm volatile ("movs r0, #0 \n\t"
"b chDbgPanic");
#endif /* CH_DBG_ENABLE_STACK_CHECK */
- PUSH_CONTEXT(r13);
+ PUSH_CONTEXT();
- otp->p_ctx.r13 = r13;
- r13 = ntp->p_ctx.r13;
+ asm volatile ("str sp, [%1, #12] \n\t"
+ "ldr sp, [%0, #12]" : : "r" (ntp), "r" (otp));
- POP_CONTEXT(r13);
+ POP_CONTEXT();
}
/**
|