From: dmitrykos Date: Sun, 11 Apr 2010 16:13:46 +0000 (+0000) Subject: fixed ASIO thiscall resolver for GCC 4.+: CALL_THISCALL_1_DOUBLE was failing due... X-Git-Tag: pa_stable_v19_20110326_r1647~141 X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=0b75c266df642be9964906cfffb3107661e94a73;p=portaudio fixed ASIO thiscall resolver for GCC 4.+: CALL_THISCALL_1_DOUBLE was failing due to strong optimization of GCC compiler, added EDX in clobbered register list to warn GCC that resolver uses it explicitly --- diff --git a/src/hostapi/asio/iasiothiscallresolver.cpp b/src/hostapi/asio/iasiothiscallresolver.cpp index 28f26df..08c55ea 100644 --- a/src/hostapi/asio/iasiothiscallresolver.cpp +++ b/src/hostapi/asio/iasiothiscallresolver.cpp @@ -276,6 +276,7 @@ extern IASIO* theAsioDriver; "call *"#funcOffset"(%%edx)\n\t" \ :"=a"(resultName) /* Output Operands */ \ :"c"(thisPtr) /* Input Operands */ \ + : "%edx" /* Clobbered Registers */ \ ); \ @@ -286,6 +287,7 @@ extern IASIO* theAsioDriver; : /* Output Operands */ \ :"r"(param1), /* Input Operands */ \ "c"(thisPtr) \ + : "%edx" /* Clobbered Registers */ \ ); \ @@ -296,20 +298,25 @@ extern IASIO* theAsioDriver; :"=a"(resultName) /* Output Operands */ \ :"r"(param1), /* Input Operands */ \ "c"(thisPtr) \ + : "%edx" /* Clobbered Registers */ \ ); \ #define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 ) \ - __asm__ __volatile__ ("pushl 4(%1)\n\t" \ - "pushl (%1)\n\t" \ - "movl (%2), %%edx\n\t" \ - "call *"#funcOffset"(%%edx);\n\t" \ - :"=a"(resultName) /* Output Operands */ \ - :"a"(¶m1), /* Input Operands */ \ - /* Note: Using "r" above instead of "a" fails */ \ - /* when using GCC 3.3.3, and maybe later versions*/\ - "c"(thisPtr) \ - ); \ + do { \ + double param1f64 = param1; /* Cast explicitly to double */ \ + double *param1f64Ptr = ¶m1f64; /* Make pointer to address */ \ + __asm__ __volatile__ ("pushl 4(%1)\n\t" \ + "pushl (%1)\n\t" \ + "movl (%2), %%edx\n\t" \ + "call *"#funcOffset"(%%edx);\n\t" \ + : "=a"(resultName) /* Output Operands */ \ + : "r"(param1f64Ptr), /* Input Operands */ \ + "c"(thisPtr), \ + "m"(*param1f64Ptr) /* Using address */ \ + : "%edx" /* Clobbered Registers */ \ + ); \ + } while (0); \ #define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 ) \ @@ -321,6 +328,7 @@ extern IASIO* theAsioDriver; :"r"(param2), /* Input Operands */ \ "r"(param1), \ "c"(thisPtr) \ + : "%edx" /* Clobbered Registers */ \ ); \ @@ -337,6 +345,7 @@ extern IASIO* theAsioDriver; "r"(param2), \ "r"(param1), \ "c"(thisPtr) \ + : "%edx" /* Clobbered Registers */ \ ); \ #endif