CallTo16... / CallFrom16... Wine thunks reorganized:

- Cleaner separation between core and glue code.
- Argument conversion glue code now in C.
- Glue code needed for 16-bit .spec files inlined.
This commit is contained in:
Ulrich Weigand 1999-08-15 12:43:17 +00:00 committed by Alexandre Julliard
parent 684ee2ce21
commit 6ab0fb18b0
3 changed files with 387 additions and 430 deletions

View File

@ -8,20 +8,70 @@
#define __WINE_BUILTIN16_H
#include "windef.h"
#include "ldt.h"
struct _CONTEXT86;
struct _STACK16FRAME;
extern BOOL BUILTIN_Init(void);
extern HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL force );
extern LPCSTR BUILTIN_GetEntryPoint16( struct _STACK16FRAME *frame, LPSTR name, WORD *pOrd );
extern void RELAY_Unimplemented16(void);
extern WORD CallFrom16Word();
extern LONG CallFrom16Long();
extern void CallFrom16Register();
extern void CallFrom16Thunk();
extern WORD CALLBACK CallTo16Word( FARPROC16 target, INT nArgs );
extern LONG CALLBACK CallTo16Long( FARPROC16 target, INT nArgs );
extern LONG CALLBACK CallTo16RegisterShort( const struct _CONTEXT86 *context, INT nArgs );
extern LONG CALLBACK CallTo16RegisterLong ( const struct _CONTEXT86 *context, INT nArgs );
#include "pshpack1.h"
typedef struct
{
WORD pushw_bp; /* pushw %bp */
BYTE pushl; /* pushl $target */
BYTE pushl; /* pushl $target */
void (*target)();
BYTE lcall; /* lcall __FLATCS__:relay */
void (*relay)();
WORD flatcs;
WORD call; /* call CALLFROM16 */
WORD callfrom16;
} ENTRYPOINT16;
#define EP(target,relay) { 0x5566, 0x68, (target), 0x9a, (relay), __FLATCS__ }
#define EP(target, offset) { 0x5566, 0x68, (target), 0xe866, (offset) }
typedef struct
{
BYTE pushl; /* pushl $relay */
DWORD relay;
BYTE lcall; /* lcall __FLATCS__:glue */
DWORD glue;
WORD flatcs;
BYTE prefix; /* lret $nArgs */
BYTE lret;
WORD nArgs;
LPCSTR profile; /* profile string */
} CALLFROM16;
#define CF16_WORD( relay, nArgs, profile ) \
{ 0x68, (DWORD)(relay), \
0x9a, (DWORD)CallFrom16Word, __FLATCS__, \
0x66, (nArgs)? 0xca : 0xcb, (nArgs)? (nArgs) : 0x9090, \
(profile) }
#define CF16_LONG( relay, nArgs, profile ) \
{ 0x68, (DWORD)(relay), \
0x9a, (DWORD)CallFrom16Long, __FLATCS__, \
0x66, (nArgs)? 0xca : 0xcb, (nArgs)? (nArgs) : 0x9090, \
(profile) }
#define CF16_REGS( relay, nArgs, profile ) \
{ 0x68, (DWORD)(relay), \
0x9a, (DWORD)CallFrom16Register, __FLATCS__, \
0x66, (nArgs)? 0xca : 0xcb, (nArgs)? (nArgs) : 0x9090, \
(profile) }
#include "poppack.h"
@ -35,7 +85,4 @@ typedef struct
} WIN16_DESCRIPTOR;
extern void RELAY_Unimplemented16(void);
#endif /* __WINE_BUILTIN16_H */

View File

@ -25,13 +25,13 @@ typedef struct _STACK32FRAME
DWORD ecx; /* 18 */
DWORD ebx; /* 1c */
DWORD ebp; /* 20 saved 32-bit frame pointer */
DWORD relay; /* 24 return address to relay stub */
DWORD retaddr; /* 28 actual return address */
DWORD args[1]; /* 2c arguments to 16-bit function */
DWORD retaddr; /* 24 return address */
DWORD target; /* 28 target address / CONTEXT86 pointer */
DWORD nb_args; /* 2c number of 16-bit argument bytes */
} STACK32FRAME;
/* 16-bit stack layout after CallFrom16() */
typedef struct
typedef struct _STACK16FRAME
{
STACK32FRAME *frame32; /* 00 32-bit frame from last CallTo16() */
DWORD edx; /* 04 saved registers */
@ -41,13 +41,14 @@ typedef struct
WORD es; /* 12 */
WORD fs; /* 14 */
WORD gs; /* 16 */
DWORD relay; /* 18 address of argument relay stub */
DWORD entry_ip; /* 1c ip of entry point */
DWORD entry_cs; /* 20 cs of entry point */
DWORD entry_point; /* 24 API entry point to call, reused as mutex count */
WORD bp; /* 28 16-bit stack frame chain */
WORD ip; /* 2a return address */
WORD cs; /* 2c */
DWORD callfrom_ip; /* 18 callfrom tail IP */
DWORD module_cs; /* 1c module code segment */
DWORD relay; /* 20 relay function address */
WORD entry_ip; /* 22 entry point IP */
DWORD entry_point; /* 26 API entry point to call, reused as mutex count */
WORD bp; /* 2a 16-bit stack frame chain */
WORD ip; /* 2c return address */
WORD cs; /* 2e */
} STACK16FRAME;
#include "poppack.h"

File diff suppressed because it is too large Load Diff