From 6d94c6689fe3112227595ac6796cb8004b646d15 Mon Sep 17 00:00:00 2001 From: Navarrop Date: Thu, 23 Jun 2011 16:08:43 +0200 Subject: [PATCH] ASM on mac is not the same as linux. --- buildtools/Cmake/gras_config.h.in | 1 + src/simix/smx_context_raw.c | 28 ++++++++++++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/buildtools/Cmake/gras_config.h.in b/buildtools/Cmake/gras_config.h.in index ed0517f623..32496eea97 100644 --- a/buildtools/Cmake/gras_config.h.in +++ b/buildtools/Cmake/gras_config.h.in @@ -33,6 +33,7 @@ #cmakedefine _WIN64 @_WIN64@ //this variable is set if it is a 64 bits windows platform #cmakedefine __VISUALC__ @__VISUALC__@ #cmakedefine __BORLANDC__ @__BORLANDC__@ +#cmakedefine APPLE @APPLE@ #ifdef _XBT_WIN32 #ifndef __GNUC__ #cmakedefine __GNUC__ @__GNUC__@ diff --git a/src/simix/smx_context_raw.c b/src/simix/smx_context_raw.c index e22ac1f2be..0284d5e05b 100644 --- a/src/simix/smx_context_raw.c +++ b/src/simix/smx_context_raw.c @@ -38,10 +38,16 @@ extern void raw_swapcontext(raw_stack_t* old, raw_stack_t new); #ifdef PROCESSOR_i686 __asm__ ( +#ifdef APPLE + ".text\n" + ".globl _raw_makecontext\n" + "_raw_makecontext:\n" +#else ".text\n" ".globl raw_makecontext\n" ".type raw_makecontext,@function\n" "raw_makecontext:\n" +#endif " movl 4(%esp),%eax\n" /* stack */ " addl 8(%esp),%eax\n" /* size */ " movl 12(%esp),%ecx\n" /* func */ @@ -58,10 +64,16 @@ __asm__ ( ); __asm__ ( +#ifdef APPLE + ".text\n" + ".globl _raw_swapcontext\n" + "_raw_swapcontext:\n" +#else ".text\n" ".globl raw_swapcontext\n" ".type raw_swapcontext,@function\n" "raw_swapcontext:\n" +#endif " movl 4(%esp),%eax\n" /* old */ " movl 8(%esp),%edx\n" /* new */ " pushl %ebp\n" @@ -78,10 +90,16 @@ __asm__ ( ); #elif PROCESSOR_x86_64 __asm__ ( +#ifdef APPLE + ".text\n" + ".globl _raw_makecontext\n" + "_raw_makecontext:\n" +#else ".text\n" ".globl raw_makecontext\n" ".type raw_makecontext,@function\n" - "raw_makecontext:\n" /* Calling convention sets the arguments in rdi, rsi, rdx and rcx, respectively */ + "raw_makecontext:\n"/* Calling convention sets the arguments in rdi, rsi, rdx and rcx, respectively */ +#endif " movq %rdi,%rax\n" /* stack */ " addq %rsi,%rax\n" /* size */ " movq $0, -8(%rax)\n" /* @return for func */ @@ -103,10 +121,16 @@ __asm__ ( ); __asm__ ( +#ifdef APPLE + ".text\n" + ".globl _raw_swapcontext\n" + "_raw_swapcontext:\n" +#else ".text\n" ".globl raw_swapcontext\n" ".type raw_swapcontext,@function\n" - "raw_swapcontext:\n" /* Calling convention sets the arguments in rdi and rsi, respectively */ + "raw_swapcontext:\n" /* Calling convention sets the arguments in rdi and rsi, respectively */ +#endif " pushq %rdi\n" " pushq %rsi\n" " pushq %rdx\n" -- 2.20.1