summaryrefslogtreecommitdiffstats
path: root/private/mvdm/wow32/fastwow.h
blob: bbadc1293462b1f3cac88a8823a8528328e8c33c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*++ BUILD Version: 0003
 *
 *  WOW v1.0
 *
 *  Copyright (c) 1991, 1992, 1993 Microsoft Corporation
 *
 *  FASTWOW.H
 *  WOW32 x86 fast callback/API support
 *
 *  History:
 *  Created 4-Dec-1992  by barry bradie (barryb)
--*/

#if defined(i386) && !defined(DEBUG_OR_WOWPROFILE)

#define FASTBOPPING     1

#else

#define FASTBOPPING     0

#endif

#if FASTBOPPING
extern BYTE fKernelCSIPFixed;
// Used by the monitor to dispatch interupts. Updated for callbacks and bops
extern DECLSPEC_IMPORT PVOID CurrentMonitorTeb;
#endif

#if FASTBOPPING
VOID    WOWBopEntry(VOID);
VPVOID  FastBopVDMStack(void);
VOID    FastBopSetVDMStack(VPVOID vp);
VOID    FastWOWCallbackCall(VOID);
VOID    FastWOWCallbackRet(VOID);
#define FASTVDMSTACK()      FastBopVDMStack()
#define SETFASTVDMSTACK(vp) FastBopSetVDMStack(vp)
#endif

//#if FASTBOPPING
//
// Used to put lock prefixes in appropriate places for MP machines
//
extern VOID FastWowFirstCode(VOID);
extern VOID FixLocks(VOID);
//#endif

#if 0

How to set a 16-bit register from the 32-bit side:

WOW16Call is called by all API thunks.  this routine sets up a stack
frame (the VDMFRAME) before getting over to WOW32.  the VDMFRAME is where
all the registers are stored - whenever a task has crossed over to WOW32
either via an API call or by returning from a callback, it saves
its registers in the frame.  immediately upon returning from WOW32
it pops the stuff off the stack back into the registers.  the way
to get a value into a specific register when the task starts executing
16-bit code again is to put it in the frame.

 ***   do not use the setAX(), setDX(), etc.  functions for this purpose  ***

those routines update a context block.  when the app re-enters 16-bit
code the registers will have the requested values but will be
immediately overwritten by the values on the stack.

similarly, to retrieve a value that was in a register at the time
of the API call you should fetch it out of the frame.
note that this is only valid for a few registers, because the
validation layer may modify the general-purpose registers.

upon returning from a callback everything on the 16-bit stack
should be valid.  to get the value that was in a register
after a callback, pull it out of the callback frame.  note that
there are general-purpose words in the callback frame for passing
extra data from the 16-bit callback routine to WOW32.


  ***  do not use the getAX(), getDX(), etc. functions for this purpose ***

#endif