- define STATUS_* codes correctly in winnt.h and ntstatus.h
[reactos.git] / reactos / lib / dbghelp / stackframe.h
1 /*
2 * 16-bit and 32-bit mode stack frame layout
3 *
4 * Copyright 1995, 1998 Alexandre Julliard
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #ifndef __WINE_STACKFRAME_H
22 #define __WINE_STACKFRAME_H
23
24 #include <string.h>
25 #define NTOS_MODE_USER
26 #include <ndk/umtypes.h>
27 #include <ndk/extypes.h>
28 #include <ndk/rtlfuncs.h>
29
30 #define SELECTOROF(ptr) (HIWORD(ptr))
31 #define OFFSETOF(ptr) (LOWORD(ptr))
32
33 #include <pshpack1.h>
34
35 /* 32-bit stack layout after CallTo16() */
36 typedef struct _STACK32FRAME
37 {
38 DWORD restore_addr; /* 00 return address for restoring code selector */
39 DWORD codeselector; /* 04 code selector to restore */
40 EXCEPTION_REGISTRATION_RECORD frame; /* 08 Exception frame */
41 SEGPTR frame16; /* 10 16-bit frame from last CallFrom16() */
42 DWORD edi; /* 14 saved registers */
43 DWORD esi; /* 18 */
44 DWORD ebx; /* 1c */
45 DWORD ebp; /* 20 saved 32-bit frame pointer */
46 DWORD retaddr; /* 24 return address */
47 DWORD target; /* 28 target address / CONTEXT86 pointer */
48 DWORD nb_args; /* 2c number of 16-bit argument bytes */
49 } STACK32FRAME;
50
51 /* 16-bit stack layout after CallFrom16() */
52 typedef struct _STACK16FRAME
53 {
54 STACK32FRAME *frame32; /* 00 32-bit frame from last CallTo16() */
55 DWORD edx; /* 04 saved registers */
56 DWORD ecx; /* 08 */
57 DWORD ebp; /* 0c */
58 WORD ds; /* 10 */
59 WORD es; /* 12 */
60 WORD fs; /* 14 */
61 WORD gs; /* 16 */
62 DWORD callfrom_ip; /* 18 callfrom tail IP */
63 DWORD module_cs; /* 1c module code segment */
64 DWORD relay; /* 20 relay function address */
65 WORD entry_ip; /* 22 entry point IP */
66 DWORD entry_point; /* 26 API entry point to call, reused as mutex count */
67 WORD bp; /* 2a 16-bit stack frame chain */
68 WORD ip; /* 2c return address */
69 WORD cs; /* 2e */
70 } STACK16FRAME;
71
72 #include <poppack.h>
73
74 static inline int MapSL(int size)
75 {
76 return -1;
77 }
78
79 #define CURRENT_STACK16 ((STACK16FRAME*)MapSL(NtCurrentTeb()->cur_stack))
80 #define CURRENT_DS (CURRENT_STACK16->ds)
81
82
83 #endif /* __WINE_STACKFRAME_H */