Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b636f981
Commit
b636f981
authored
Nov 26, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
krnl386: Move the 16-bit stack out of the WOW32Reserved field.
Based on a patch by Sebastian Lackner. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f87262ea
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
14 additions
and
13 deletions
+14
-13
cpu_i386.c
dlls/dbghelp/cpu_i386.c
+3
-3
kernel16_private.h
dlls/krnl386.exe16/kernel16_private.h
+1
-0
thunk.c
dlls/krnl386.exe16/thunk.c
+2
-2
wowthunk.c
dlls/krnl386.exe16/wowthunk.c
+1
-1
signal_i386.c
dlls/ntdll/unix/signal_i386.c
+1
-1
toolhelp.c
dlls/toolhelp.dll16/toolhelp.c
+2
-2
winbase16.h
include/wine/winbase16.h
+3
-3
relay.c
tools/winebuild/relay.c
+1
-1
No files found.
dlls/dbghelp/cpu_i386.c
View file @
b636f981
...
...
@@ -213,16 +213,16 @@ static BOOL i386_stack_walk(struct cpu_stack_walk *csw, STACKFRAME64 *frame,
/* Init done */
set_curr_mode
((
frame
->
AddrPC
.
Mode
==
AddrModeFlat
)
?
stm_32bit
:
stm_16bit
);
/* cur_switch holds address of
WOW32Reserved
field in TEB in debuggee
/* cur_switch holds address of
SystemReserved1[0]
field in TEB in debuggee
* address space
*/
if
(
NtQueryInformationThread
(
csw
->
hThread
,
ThreadBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
)
==
STATUS_SUCCESS
)
{
curr_switch
=
(
DWORD_PTR
)
info
.
TebBaseAddress
+
FIELD_OFFSET
(
TEB
,
WOW32Reserved
);
curr_switch
=
(
DWORD_PTR
)
info
.
TebBaseAddress
+
FIELD_OFFSET
(
TEB
,
SystemReserved1
);
if
(
!
sw_read_mem
(
csw
,
curr_switch
,
&
p
,
sizeof
(
p
)))
{
WARN
(
"Can't read TEB:
WOW32Reserved
\n
"
);
WARN
(
"Can't read TEB:
SystemReserved1
\n
"
);
goto
done_err
;
}
next_switch
=
p
;
...
...
dlls/krnl386.exe16/kernel16_private.h
View file @
b636f981
...
...
@@ -298,6 +298,7 @@ struct tagSYSLEVEL;
struct
kernel_thread_data
{
SEGPTR
stack
;
/* 16-bit stack pointer */
WORD
stack_sel
;
/* 16-bit stack selector */
WORD
htask16
;
/* Win16 task handle */
DWORD
sys_count
[
4
];
/* syslevel mutex entry counters */
...
...
dlls/krnl386.exe16/thunk.c
View file @
b636f981
...
...
@@ -1229,7 +1229,7 @@ void WINAPI __regs_K32Thk1632Prolog( CONTEXT *context )
DWORD
argSize
=
context
->
Ebp
-
context
->
Esp
;
char
*
stack16
=
(
char
*
)
context
->
Esp
-
4
;
STACK16FRAME
*
frame16
=
(
STACK16FRAME
*
)
stack16
-
1
;
STACK32FRAME
*
frame32
=
NtCurrentTeb
()
->
WOW32Reserved
;
STACK32FRAME
*
frame32
=
(
STACK32FRAME
*
)
kernel_get_thread_data
()
->
stack
;
char
*
stack32
=
(
char
*
)
frame32
-
argSize
;
WORD
stackSel
=
SELECTOROF
(
frame32
->
frame16
);
DWORD
stackBase
=
GetSelectorBase
(
stackSel
);
...
...
@@ -1282,7 +1282,7 @@ void WINAPI __regs_K32Thk1632Epilog( CONTEXT *context )
TRACE
(
"before SYSTHUNK hack: EBP: %08x ESP: %08x cur_stack: %04x:%04x
\n
"
,
context
->
Ebp
,
context
->
Esp
,
CURRENT_SS
,
CURRENT_SP
);
NtCurrentTeb
()
->
WOW32Reserved
=
frame16
->
frame32
;
kernel_get_thread_data
()
->
stack
=
(
SEGPTR
)
frame16
->
frame32
;
context
->
Esp
=
(
DWORD
)
stack16
+
nArgsPopped
;
context
->
Ebp
=
frame16
->
ebp
;
...
...
dlls/krnl386.exe16/wowthunk.c
View file @
b636f981
...
...
@@ -127,7 +127,7 @@ static DWORD call16_handler( EXCEPTION_RECORD *record, EXCEPTION_REGISTRATION_RE
{
/* unwinding: restore the stack pointer in the TEB, and leave the Win16 mutex */
STACK32FRAME
*
frame32
=
CONTAINING_RECORD
(
frame
,
STACK32FRAME
,
frame
);
NtCurrentTeb
()
->
WOW32Reserved
=
(
void
*
)
frame32
->
frame16
;
kernel_get_thread_data
()
->
stack
=
frame32
->
frame16
;
_LeaveWin16Lock
();
}
else
if
(
record
->
ExceptionCode
==
EXCEPTION_ACCESS_VIOLATION
||
...
...
dlls/ntdll/unix/signal_i386.c
View file @
b636f981
...
...
@@ -630,7 +630,7 @@ static inline void *init_handler( const ucontext_t *sigcontext )
* SS is still non-system segment. This is why both CS and SS
* are checked.
*/
return
teb
->
WOW32Reserved
;
return
teb
->
SystemReserved1
[
0
]
;
}
return
(
void
*
)(
ESP_sig
(
sigcontext
)
&
~
3
);
}
...
...
dlls/toolhelp.dll16/toolhelp.c
View file @
b636f981
...
...
@@ -491,8 +491,8 @@ BOOL16 WINAPI TaskNext16( TASKENTRY *lpte )
lpte
->
hTaskParent
=
pTask
->
hParent
;
lpte
->
hInst
=
pTask
->
hInstance
;
lpte
->
hModule
=
pTask
->
hModule
;
lpte
->
wSS
=
SELECTOROF
(
pTask
->
teb
->
WOW32Reserved
);
lpte
->
wSP
=
OFFSETOF
(
pTask
->
teb
->
WOW32Reserved
);
lpte
->
wSS
=
SELECTOROF
(
pTask
->
teb
->
SystemReserved1
[
0
]
);
lpte
->
wSP
=
OFFSETOF
(
pTask
->
teb
->
SystemReserved1
[
0
]
);
lpte
->
wStackTop
=
pInstData
->
stacktop
;
lpte
->
wStackMinimum
=
pInstData
->
stackmin
;
lpte
->
wStackBottom
=
pInstData
->
stackbottom
;
...
...
include/wine/winbase16.h
View file @
b636f981
...
...
@@ -562,9 +562,9 @@ BOOL16 WINAPI WritePrivateProfileSection16(LPCSTR,LPCSTR,LPCSTR);
BOOL16
WINAPI
WritePrivateProfileStruct16
(
LPCSTR
,
LPCSTR
,
LPVOID
,
UINT16
,
LPCSTR
);
BOOL16
WINAPI
WriteProfileSection16
(
LPCSTR
,
LPCSTR
);
#define CURRENT_STACK16 ((STACK16FRAME *)MapSL((SEGPTR)NtCurrentTeb()->
WOW32Reserved
))
#define CURRENT_STACK16 ((STACK16FRAME *)MapSL((SEGPTR)NtCurrentTeb()->
SystemReserved1[0]
))
#define CURRENT_DS (CURRENT_STACK16->ds)
#define CURRENT_SP (((WORD *)
&NtCurrentTeb()->WOW32Reserved
)[0])
#define CURRENT_SS (((WORD *)
&NtCurrentTeb()->WOW32Reserved
)[1])
#define CURRENT_SP (((WORD *)
NtCurrentTeb()->SystemReserved1
)[0])
#define CURRENT_SS (((WORD *)
NtCurrentTeb()->SystemReserved1
)[1])
#endif
/* __WINE_WINE_WINBASE16_H */
tools/winebuild/relay.c
View file @
b636f981
...
...
@@ -31,7 +31,7 @@
#include "build.h"
/* offset of the stack pointer relative to %fs:(0) */
#define STACKOFFSET 0x
c0
/* FIELD_OFFSET(TEB,WOW32Reserved
) */
#define STACKOFFSET 0x
10c
/* FIELD_OFFSET(TEB,SystemReserved1
) */
/* fix this if the x86_thread_data structure is changed */
#define GS_OFFSET 0x1d8
/* FIELD_OFFSET(TEB,SystemReserved2) + FIELD_OFFSET(struct x86_thread_data,gs) */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment