aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-04-09 12:27:02 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-04-09 12:27:02 +0000
commita8a6649caa7a12aef55883d5c1907a7f5cbca386 (patch)
treef6d52c1914baca15899267574e51e2ff1f971adb
parent3a5cb07fb9198af2f989c4ddaf5b976904fde9e0 (diff)
downloadChibiOS-a8a6649caa7a12aef55883d5c1907a7f5cbca386.tar.gz
ChibiOS-a8a6649caa7a12aef55883d5c1907a7f5cbca386.tar.bz2
ChibiOS-a8a6649caa7a12aef55883d5c1907a7f5cbca386.zip
Fixed bug 2745153.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@882 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/Win32-MinGW/Makefile4
-rw-r--r--demos/Win32-MinGW/chcore.c21
2 files changed, 13 insertions, 12 deletions
diff --git a/demos/Win32-MinGW/Makefile b/demos/Win32-MinGW/Makefile
index 841557827..c0e4afbca 100644
--- a/demos/Win32-MinGW/Makefile
+++ b/demos/Win32-MinGW/Makefile
@@ -77,7 +77,7 @@ ULIBDIR =
ULIBS =
# Define optimisation level here
-OPT = -ggdb -O2 -fomit-frame-pointer
+OPT = -ggdb -O0 -fomit-frame-pointer
#
# End of user defines
@@ -93,7 +93,7 @@ LIBS = $(DLIBS) $(ULIBS)
LDFLAGS = -Wl,-Map=$(PROJECT).map,--cref,--no-warn-mismatch $(LIBDIR)
ASFLAGS = -Wa,-amhls=$(<:.s=.lst) $(ADEFS)
-CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=$(<:.c=.lst) $(DEFS)
+CPFLAGS = $(OPT) -Wall -Wstrict-prototypes -fverbose-asm -Wa,-alms=$(<:.c=.lst) $(DEFS)
# Generate dependency information
CPFLAGS += -MD -MP -MF .dep/$(@F).d
diff --git a/demos/Win32-MinGW/chcore.c b/demos/Win32-MinGW/chcore.c
index a2194336c..081a02753 100644
--- a/demos/Win32-MinGW/chcore.c
+++ b/demos/Win32-MinGW/chcore.c
@@ -98,20 +98,21 @@ void ChkIntSources(void) {
* @param otp the thread to be switched out
* @param ntp the thread to be switched in
*/
-__attribute__((fastcall))
-void port_switch(Thread *otp, Thread *ntp) {
- register struct intctx volatile *esp asm("esp");
-
- asm volatile ("push %ebp \n\t" \
+__attribute__((used))
+static void __dummy(Thread *otp, Thread *ntp) {
+ asm volatile (".globl @port_switch@8 \n\t" \
+ "@port_switch@8: \n\t" \
+ "push %ebp \n\t" \
"push %esi \n\t" \
"push %edi \n\t" \
- "push %ebx");
- otp->p_ctx.esp = esp;
- esp = ntp->p_ctx.esp;
- asm volatile ("pop %ebx \n\t" \
+ "push %ebx \n\t" \
+ "movl %esp, 16(%ecx) \n\t" \
+ "movl 16(%edx), %esp \n\t" \
+ "pop %ebx \n\t" \
"pop %edi \n\t" \
"pop %esi \n\t" \
- "pop %ebp");
+ "pop %ebp \n\t" \
+ "ret");
}
/**