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

This commit is contained in:
dmitrykos 2010-04-11 16:13:46 +00:00
commit 0b75c266df

View file

@ -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"(&param1), /* 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 = &param1f64; /* 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