diff options
Diffstat (limited to 'demos')
-rw-r--r-- | demos/Win32-MinGW/Makefile | 4 | ||||
-rw-r--r-- | demos/Win32-MinGW/chcore.c | 21 |
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");
}
/**
|