/* * platforms/Cross/plugins/IA32ABI/ia32abi.h * * Written by Eliot Miranda 11/2007. * Updated 5/2011 to cope with Cog stack direction. * * Call foreign functions returning results in either %eax, %edx (Integral) * or %f0 (Float, Double). * * The primitive will have signatures of the form * * primFFIResult: result call: functionAddress * with: firstArg ... with: lastArg * * * result primFFICall: functionAddress * with: firstArg ... with: lastArg * * * functionAddress primFFICallResult: result * with: firstArg ... with: lastArg * * * N.B. In Cog Stack and Cogit VMs numArgs is negative to access args from * the downward-growing stack. */ #define SIGNATURE sqInt *argVector/* call args on stack or in array */, \ int numArgs, /* arg count of function to call (*) */ \ int funcOffset, /* stack offset of func Alien */ \ int resultOffset/* stack offset of result Alien */ extern sqInt callIA32IntegralReturn(SIGNATURE); extern sqInt callIA32FloatReturn (SIGNATURE); extern sqInt callIA32DoubleReturn (SIGNATURE); extern long thunkEntry (void *thunkp, long *stackp); extern void *allocateExecutablePage(long *pagesize); extern VMCallbackContext *getMostRecentCallbackContext(void); /* Use the most minimal setjmp/longjmp pair available; no signal handling * wanted or necessary. */ #if !defined(WIN32) # define setjmp _setjmp # define longjmp _longjmp #endif