267 |
"call *"#funcOffset"(%%edx)\n\t" \ |
"call *"#funcOffset"(%%edx)\n\t" \ |
268 |
:"=a"(resultName) /* Output Operands */ \ |
:"=a"(resultName) /* Output Operands */ \ |
269 |
:"c"(thisPtr) /* Input Operands */ \ |
:"c"(thisPtr) /* Input Operands */ \ |
270 |
|
: "%edx" /* Clobbered Registers */ \ |
271 |
); \ |
); \ |
272 |
|
|
273 |
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 ) \ |
#define CALL_VOID_THISCALL_1( thisPtr, funcOffset, param1 ) \ |
277 |
: /* Output Operands */ \ |
: /* Output Operands */ \ |
278 |
:"r"(param1), /* Input Operands */ \ |
:"r"(param1), /* Input Operands */ \ |
279 |
"c"(thisPtr) \ |
"c"(thisPtr) \ |
280 |
|
: "%edx" /* Clobbered Registers */ \ |
281 |
); \ |
); \ |
282 |
|
|
283 |
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 ) \ |
#define CALL_THISCALL_1( resultName, thisPtr, funcOffset, param1 ) \ |
287 |
:"=a"(resultName) /* Output Operands */ \ |
:"=a"(resultName) /* Output Operands */ \ |
288 |
:"r"(param1), /* Input Operands */ \ |
:"r"(param1), /* Input Operands */ \ |
289 |
"c"(thisPtr) \ |
"c"(thisPtr) \ |
290 |
|
: "%edx" /* Clobbered Registers */ \ |
291 |
); \ |
); \ |
292 |
|
|
293 |
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 ) \ |
#define CALL_THISCALL_1_DOUBLE( resultName, thisPtr, funcOffset, param1 ) \ |
294 |
__asm__ __volatile__ ("pushl 4(%1)\n\t" \ |
do { \ |
295 |
"pushl (%1)\n\t" \ |
double param1f64 = param1; /* Cast explicitly to double */ \ |
296 |
"movl (%2), %%edx\n\t" \ |
double *param1f64Ptr = ¶m1f64; /* Make pointer to address */ \ |
297 |
"call *"#funcOffset"(%%edx);\n\t" \ |
__asm__ __volatile__ ("pushl 4(%1)\n\t" \ |
298 |
:"=a"(resultName) /* Output Operands */ \ |
"pushl (%1)\n\t" \ |
299 |
:"a"(¶m1), /* Input Operands */ \ |
"movl (%2), %%edx\n\t" \ |
300 |
/* Note: Using "r" above instead of "a" fails */ \ |
"call *"#funcOffset"(%%edx);\n\t" \ |
301 |
/* when using GCC 3.3.3, and maybe later versions*/\ |
: "=a"(resultName) /* Output Operands */ \ |
302 |
"c"(thisPtr) \ |
: "r"(param1f64Ptr), /* Input Operands */ \ |
303 |
); \ |
"c"(thisPtr), \ |
304 |
|
"m"(*param1f64Ptr) /* Using address */ \ |
305 |
|
: "%edx" /* Clobbered Registers */ \ |
306 |
|
); \ |
307 |
|
} while (0); \ |
308 |
|
|
309 |
|
|
310 |
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 ) \ |
#define CALL_THISCALL_2( resultName, thisPtr, funcOffset, param1, param2 ) \ |
311 |
__asm__ __volatile__ ("pushl %1\n\t" \ |
__asm__ __volatile__ ("pushl %1\n\t" \ |
316 |
:"r"(param2), /* Input Operands */ \ |
:"r"(param2), /* Input Operands */ \ |
317 |
"r"(param1), \ |
"r"(param1), \ |
318 |
"c"(thisPtr) \ |
"c"(thisPtr) \ |
319 |
|
: "%edx" /* Clobbered Registers */ \ |
320 |
); \ |
); \ |
321 |
|
|
322 |
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\ |
#define CALL_THISCALL_4( resultName, thisPtr, funcOffset, param1, param2, param3, param4 )\ |
332 |
"r"(param2), \ |
"r"(param2), \ |
333 |
"r"(param1), \ |
"r"(param1), \ |
334 |
"c"(thisPtr) \ |
"c"(thisPtr) \ |
335 |
|
: "%edx" /* Clobbered Registers */ \ |
336 |
); \ |
); \ |
337 |
|
|
338 |
#endif |
#endif |