Release 960521
[wine/multimedia.git] / include / stackframe.h
blobe52eb1428b75a7c03efaa705e81b06a5f2c22cb0
1 /*
2 * 16-bit mode stack frame layout
4 * Copyright 1995 Alexandre Julliard
5 */
7 #ifndef WINE_STACKFRAME_H
8 #define WINE_STACKFRAME_H
10 #include <windows.h>
11 #include "ldt.h"
13 #ifndef WINELIB
14 #pragma pack(1)
15 #endif
17 /* 16-bit stack layout after CallFrom16() */
18 typedef struct
20 WORD saved_ss; /* saved previous 16-bit stack */
21 WORD saved_sp;
22 WORD entry_ip; /* ip of entry point */
23 WORD ds; /* ds */
24 WORD entry_cs; /* cs of entry point */
25 WORD es; /* es */
26 DWORD entry_point WINE_PACKED; /* 32-bit entry point to call */
27 WORD bp; /* 16-bit bp */
28 WORD ip; /* return address */
29 WORD cs;
30 WORD args[1]; /* arguments to API function */
31 } STACK16FRAME;
33 /* 32-bit stack layout after CallTo16() */
34 typedef struct
36 DWORD saved_esp; /* saved previous 32-bit stack */
37 DWORD edi; /* saved registers */
38 DWORD esi;
39 DWORD edx;
40 DWORD ecx;
41 DWORD ebx;
42 DWORD ebp; /* saved 32-bit frame pointer */
43 DWORD retaddr; /* return address */
44 DWORD codeselector; /* code selector for return address */
45 DWORD args[1]; /* arguments to 16-bit function */
46 } STACK32FRAME;
48 #ifndef WINELIB
49 #pragma pack(4)
50 #endif
52 /* Saved 16-bit stack for current process (Win16 only) */
53 extern WORD IF1632_Saved16_ss;
54 extern WORD IF1632_Saved16_sp;
56 /* Saved 32-bit stack for current process (Win16 only) */
57 extern DWORD IF1632_Saved32_esp;
58 extern SEGPTR IF1632_Stack32_base;
60 /* Original Unix stack */
61 extern DWORD IF1632_Original32_esp;
63 #ifndef WINELIB
64 #define CURRENT_STACK16 \
65 ((STACK16FRAME *)PTR_SEG_OFF_TO_LIN(IF1632_Saved16_ss,IF1632_Saved16_sp))
67 #define CURRENT_DS (CURRENT_STACK16->ds)
69 /* Make a segmented pointer from a pointer to a variable located */
70 /* on the 32-bit stack for the current task. */
71 #if 0
72 #define MAKE_SEGPTR(ptr) \
73 ((SEGPTR)IF1632_Stack32_base + \
74 ((DWORD)(ptr) - (DWORD)PTR_SEG_TO_LIN(IF1632_Stack32_base)))
75 #endif
76 SEGPTR MAKE_SEGPTR(void *ptr);
77 #else
78 #define CURRENT_STACK16 error.error
79 #define CURRENT_DS ((WORD)GetTaskDS())
80 #define MAKE_SEGPTR(ptr) ((SEGPTR)ptr)
81 #endif
83 #endif /* WINE_STACKFRAME_H */