From 5d374c633e69ae84bc8e02fc3bb3d0cbeded201e Mon Sep 17 00:00:00 2001 From: gdisirio Date: Mon, 30 Apr 2012 09:40:21 +0000 Subject: [PATCH] Fixed bug 3522301. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4151 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/ports/GCC/SIMIA32/chcore.c | 34 ++++++++++++++++++---------------- readme.txt | 2 ++ test/coverage/Makefile | 7 +++++-- test/coverage/main.c | 1 + 4 files changed, 26 insertions(+), 18 deletions(-) diff --git a/os/ports/GCC/SIMIA32/chcore.c b/os/ports/GCC/SIMIA32/chcore.c index 2850882df..dadf44291 100644 --- a/os/ports/GCC/SIMIA32/chcore.c +++ b/os/ports/GCC/SIMIA32/chcore.c @@ -36,26 +36,28 @@ __attribute__((used)) static void __dummy(Thread *ntp, Thread *otp) { (void)ntp; (void)otp; + + asm volatile ( #if defined(WIN32) - asm volatile (".globl @port_switch@8 \n\t" \ - "@port_switch@8:"); + ".globl @port_switch@8 \n\t" + "@port_switch@8:" #elif defined(__APPLE__) - asm volatile (".globl _port_switch \n\t" \ - "_port_switch:"); + ".globl _port_switch \n\t" + "_port_switch:" #else - asm volatile (".globl port_switch \n\t" \ - "port_switch:"); + ".globl port_switch \n\t" + "port_switch:" #endif - asm volatile ("push %ebp \n\t" \ - "push %esi \n\t" \ - "push %edi \n\t" \ - "push %ebx \n\t" \ - "movl %esp, 12(%edx) \n\t" \ - "movl 12(%ecx), %esp \n\t" \ - "pop %ebx \n\t" \ - "pop %edi \n\t" \ - "pop %esi \n\t" \ - "pop %ebp \n\t" \ + "push %ebp \n\t" + "push %esi \n\t" + "push %edi \n\t" + "push %ebx \n\t" + "movl %esp, 12(%edx) \n\t" + "movl 12(%ecx), %esp \n\t" + "pop %ebx \n\t" + "pop %edi \n\t" + "pop %esi \n\t" + "pop %ebp \n\t" "ret"); } diff --git a/readme.txt b/readme.txt index 118027638..cc6f5fc92 100644 --- a/readme.txt +++ b/readme.txt @@ -79,6 +79,8 @@ ***************************************************************************** *** 2.5.0 *** +- FIX: Fixed code coverage crashes with Linux/gcc-4.4.5 (bug 3522301) + (backported to 2.4.1). - FIX: Fixed macro dmaWaitCompletion() fails to compile in STM32 HAL (bug 3519202)(backported to 2.4.1). - FIX: Fixed ARM addresses generated in vectors table (bug 3519037)(backported diff --git a/test/coverage/Makefile b/test/coverage/Makefile index 82dda4737..d19014202 100644 --- a/test/coverage/Makefile +++ b/test/coverage/Makefile @@ -35,6 +35,9 @@ DLIBDIR = # List all default libraries here DLIBS = -lws2_32 + +# Must be a directory in ${CHIBIOS}/os/hal/platforms +HOST_TYPE = Win32 # # End of default section @@ -60,7 +63,7 @@ UADEFS = CHIBIOS = ../.. include $(CHIBIOS)/boards/simulator/board.mk include ${CHIBIOS}/os/hal/hal.mk -include ${CHIBIOS}/os/hal/platforms/Win32/platform.mk +include ${CHIBIOS}/os/hal/platforms/$(HOST_TYPE)/platform.mk include ${CHIBIOS}/os/ports/GCC/SIMIA32/port.mk include ${CHIBIOS}/os/kernel/kernel.mk include ${CHIBIOS}/test/test.mk @@ -72,7 +75,7 @@ SRC = ${PORTSRC} \ ${HALSRC} \ ${PLATFORMSRC} \ $(BOARDSRC) \ - ${CHIBIOS}/os/hal/platforms/Win32/console.c \ + ${CHIBIOS}/os/hal/platforms/$(HOST_TYPE)/console.c \ main.c # List ASM source files here diff --git a/test/coverage/main.c b/test/coverage/main.c index 4d8249483..16c2702ec 100644 --- a/test/coverage/main.c +++ b/test/coverage/main.c @@ -20,6 +20,7 @@ #include #include +#include #include "ch.h" #include "hal.h"