From a5070b8e577dee21b30c7ef6918133344787f997 Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 2 Feb 2010 21:25:04 +0000 Subject: [PATCH] git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1559 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/ARM7/chcoreasm.s | 4 ++-- os/ports/GCC/AVR/chcore.c | 22 +++------------------- os/ports/GCC/SIMIA32/chcore.c | 4 ++-- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/os/ports/GCC/ARM7/chcoreasm.s b/os/ports/GCC/ARM7/chcoreasm.s index 93a8ceb2a..e172e3455 100644 --- a/os/ports/GCC/ARM7/chcoreasm.s +++ b/os/ports/GCC/ARM7/chcoreasm.s @@ -115,8 +115,8 @@ _port_switch_arm: #endif /* !THUMB_PRESENT */ #else /* !CH_CURRP_REGISTER_CACHE */ stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} - str sp, [r0, #16] - ldr sp, [r1, #16] + str sp, [r0, #12] + ldr sp, [r1, #12] #ifdef THUMB_PRESENT ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr} bx lr diff --git a/os/ports/GCC/AVR/chcore.c b/os/ports/GCC/AVR/chcore.c index e99c2b970..6662b5199 100644 --- a/os/ports/GCC/AVR/chcore.c +++ b/os/ports/GCC/AVR/chcore.c @@ -59,33 +59,17 @@ void port_switch(Thread *otp, Thread *ntp) { asm volatile ("push r28"); asm volatile ("push r29"); - /* This is required because the context offset changes if CH_USE_DYNAMIC - is activated.*/ -#if CH_USE_DYNAMIC asm volatile ("movw r30, r24"); asm volatile ("in r0, 0x3d"); - asm volatile ("std Z+8, r0"); + asm volatile ("std Z+6, r0"); asm volatile ("in r0, 0x3e"); - asm volatile ("std Z+9, r0"); - - asm volatile ("movw r30, r22"); - asm volatile ("ldd r0, Z+8"); - asm volatile ("out 0x3d, r0"); - asm volatile ("ldd r0, Z+9"); - asm volatile ("out 0x3e, r0"); -#else /* !CH_USE_DYNAMIC */ - asm volatile ("movw r30, r24"); - asm volatile ("in r0, 0x3d"); asm volatile ("std Z+7, r0"); - asm volatile ("in r0, 0x3e"); - asm volatile ("std Z+8, r0"); asm volatile ("movw r30, r22"); - asm volatile ("ldd r0, Z+7"); + asm volatile ("ldd r0, Z+6"); asm volatile ("out 0x3d, r0"); - asm volatile ("ldd r0, Z+8"); + asm volatile ("ldd r0, Z+7"); asm volatile ("out 0x3e, r0"); -#endif /* !CH_USE_DYNAMIC */ asm volatile ("pop r29"); asm volatile ("pop r28"); diff --git a/os/ports/GCC/SIMIA32/chcore.c b/os/ports/GCC/SIMIA32/chcore.c index 6fe0725dd..2cacd7b65 100644 --- a/os/ports/GCC/SIMIA32/chcore.c +++ b/os/ports/GCC/SIMIA32/chcore.c @@ -46,8 +46,8 @@ static void __dummy(Thread *otp, Thread *ntp) { "push %esi \n\t" \ "push %edi \n\t" \ "push %ebx \n\t" \ - "movl %esp, 16(%ecx) \n\t" \ - "movl 16(%edx), %esp \n\t" \ + "movl %esp, 12(%ecx) \n\t" \ + "movl 12(%edx), %esp \n\t" \ "pop %ebx \n\t" \ "pop %edi \n\t" \ "pop %esi \n\t" \