forked from Mirrors/wine-wine
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.oldstable
parent
684ee2ce21
commit
6ab0fb18b0
|
@ -8,20 +8,70 @@
|
||||||
#define __WINE_BUILTIN16_H
|
#define __WINE_BUILTIN16_H
|
||||||
|
|
||||||
#include "windef.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"
|
#include "pshpack1.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
WORD pushw_bp; /* pushw %bp */
|
WORD pushw_bp; /* pushw %bp */
|
||||||
BYTE pushl; /* pushl $target */
|
BYTE pushl; /* pushl $target */
|
||||||
void (*target)();
|
void (*target)();
|
||||||
BYTE lcall; /* lcall __FLATCS__:relay */
|
WORD call; /* call CALLFROM16 */
|
||||||
void (*relay)();
|
WORD callfrom16;
|
||||||
WORD flatcs;
|
|
||||||
} ENTRYPOINT16;
|
} 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"
|
#include "poppack.h"
|
||||||
|
|
||||||
|
@ -35,7 +85,4 @@ typedef struct
|
||||||
} WIN16_DESCRIPTOR;
|
} WIN16_DESCRIPTOR;
|
||||||
|
|
||||||
|
|
||||||
extern void RELAY_Unimplemented16(void);
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* __WINE_BUILTIN16_H */
|
#endif /* __WINE_BUILTIN16_H */
|
||||||
|
|
|
@ -25,13 +25,13 @@ typedef struct _STACK32FRAME
|
||||||
DWORD ecx; /* 18 */
|
DWORD ecx; /* 18 */
|
||||||
DWORD ebx; /* 1c */
|
DWORD ebx; /* 1c */
|
||||||
DWORD ebp; /* 20 saved 32-bit frame pointer */
|
DWORD ebp; /* 20 saved 32-bit frame pointer */
|
||||||
DWORD relay; /* 24 return address to relay stub */
|
DWORD retaddr; /* 24 return address */
|
||||||
DWORD retaddr; /* 28 actual return address */
|
DWORD target; /* 28 target address / CONTEXT86 pointer */
|
||||||
DWORD args[1]; /* 2c arguments to 16-bit function */
|
DWORD nb_args; /* 2c number of 16-bit argument bytes */
|
||||||
} STACK32FRAME;
|
} STACK32FRAME;
|
||||||
|
|
||||||
/* 16-bit stack layout after CallFrom16() */
|
/* 16-bit stack layout after CallFrom16() */
|
||||||
typedef struct
|
typedef struct _STACK16FRAME
|
||||||
{
|
{
|
||||||
STACK32FRAME *frame32; /* 00 32-bit frame from last CallTo16() */
|
STACK32FRAME *frame32; /* 00 32-bit frame from last CallTo16() */
|
||||||
DWORD edx; /* 04 saved registers */
|
DWORD edx; /* 04 saved registers */
|
||||||
|
@ -41,13 +41,14 @@ typedef struct
|
||||||
WORD es; /* 12 */
|
WORD es; /* 12 */
|
||||||
WORD fs; /* 14 */
|
WORD fs; /* 14 */
|
||||||
WORD gs; /* 16 */
|
WORD gs; /* 16 */
|
||||||
DWORD relay; /* 18 address of argument relay stub */
|
DWORD callfrom_ip; /* 18 callfrom tail IP */
|
||||||
DWORD entry_ip; /* 1c ip of entry point */
|
DWORD module_cs; /* 1c module code segment */
|
||||||
DWORD entry_cs; /* 20 cs of entry point */
|
DWORD relay; /* 20 relay function address */
|
||||||
DWORD entry_point; /* 24 API entry point to call, reused as mutex count */
|
WORD entry_ip; /* 22 entry point IP */
|
||||||
WORD bp; /* 28 16-bit stack frame chain */
|
DWORD entry_point; /* 26 API entry point to call, reused as mutex count */
|
||||||
WORD ip; /* 2a return address */
|
WORD bp; /* 2a 16-bit stack frame chain */
|
||||||
WORD cs; /* 2c */
|
WORD ip; /* 2c return address */
|
||||||
|
WORD cs; /* 2e */
|
||||||
} STACK16FRAME;
|
} STACK16FRAME;
|
||||||
|
|
||||||
#include "poppack.h"
|
#include "poppack.h"
|
||||||
|
|
731
tools/build.c
731
tools/build.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue