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
3ac808e4
Commit
3ac808e4
authored
Aug 16, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Set Wow64 user space limit based on LARGE_ADDRESS_AWARE.
Based on a patch by Billy Laws.
parent
5f1b91e5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
6 deletions
+7
-6
env.c
dlls/ntdll/unix/env.c
+1
-0
thread.c
dlls/ntdll/unix/thread.c
+1
-1
unix_private.h
dlls/ntdll/unix/unix_private.h
+2
-1
virtual.c
dlls/ntdll/unix/virtual.c
+3
-4
No files found.
dlls/ntdll/unix/env.c
View file @
3ac808e4
...
...
@@ -1864,6 +1864,7 @@ static void init_peb( RTL_USER_PROCESS_PARAMETERS *params, void *module )
NtCurrentTeb
()
->
WowTebOffset
=
teb_offset
;
NtCurrentTeb
()
->
Tib
.
ExceptionList
=
(
void
*
)((
char
*
)
NtCurrentTeb
()
+
teb_offset
);
wow_peb
=
(
PEB32
*
)((
char
*
)
peb
+
page_size
);
user_space_wow_limit
=
((
main_image_info
.
ImageCharacteristics
&
IMAGE_FILE_LARGE_ADDRESS_AWARE
)
?
limit_4g
:
limit_2g
)
-
1
;
set_thread_id
(
NtCurrentTeb
(),
GetCurrentProcessId
(),
GetCurrentThreadId
()
);
ERR
(
"starting %s in experimental wow64 mode
\n
"
,
debugstr_us
(
&
params
->
ImagePathName
)
);
break
;
...
...
dlls/ntdll/unix/thread.c
View file @
3ac808e4
...
...
@@ -1201,7 +1201,7 @@ NTSTATUS init_thread_stack( TEB *teb, ULONG_PTR limit, SIZE_T reserve_size, SIZE
teb
->
DeallocationStack
=
stack
.
DeallocationStack
;
/* 32-bit stack */
if
(
!
limit
||
limit
>
=
limit_2g
)
limit
=
limit_2g
-
1
;
if
(
!
limit
||
limit
>
user_space_wow_limit
)
limit
=
user_space_wow_limit
;
if
((
status
=
virtual_alloc_thread_stack
(
&
stack
,
0
,
limit
,
reserve_size
,
commit_size
,
TRUE
)))
return
status
;
wow_teb
->
Tib
.
StackBase
=
PtrToUlong
(
stack
.
StackBase
);
...
...
dlls/ntdll/unix/unix_private.h
View file @
3ac808e4
...
...
@@ -63,6 +63,7 @@ static inline TEB64 *NtCurrentTeb64(void) { return (TEB64 *)NtCurrentTeb()->GdiB
#endif
extern
WOW_PEB
*
wow_peb
DECLSPEC_HIDDEN
;
extern
ULONG_PTR
user_space_wow_limit
DECLSPEC_HIDDEN
;
static
inline
WOW_TEB
*
get_wow_teb
(
TEB
*
teb
)
{
...
...
@@ -516,7 +517,7 @@ static inline NTSTATUS map_section( HANDLE mapping, void **ptr, SIZE_T *size, UL
{
*
ptr
=
NULL
;
*
size
=
0
;
return
NtMapViewOfSection
(
mapping
,
NtCurrentProcess
(),
ptr
,
is_win64
&&
wow_peb
?
limit_2g
-
1
:
0
,
return
NtMapViewOfSection
(
mapping
,
NtCurrentProcess
(),
ptr
,
user_space_wow_limit
,
0
,
NULL
,
size
,
ViewShare
,
0
,
protect
);
}
...
...
dlls/ntdll/unix/virtual.c
View file @
3ac808e4
...
...
@@ -181,6 +181,7 @@ static void *working_set_limit = (void *)0x7fff0000;
static
struct
file_view
*
arm64ec_view
;
ULONG_PTR
user_space_wow_limit
=
0
;
struct
_KUSER_SHARED_DATA
*
user_shared_data
=
(
void
*
)
0x7ffe0000
;
/* TEB allocation blocks */
...
...
@@ -568,8 +569,7 @@ static void mmap_init( const struct preload_info *preload_info )
static
void
*
get_wow_user_space_limit
(
void
)
{
#ifdef _WIN64
if
(
main_image_info
.
ImageCharacteristics
&
IMAGE_FILE_LARGE_ADDRESS_AWARE
)
return
(
void
*
)
0xffff0000
;
return
(
void
*
)
0x7fff0000
;
return
(
void
*
)(
user_space_wow_limit
&
~
granularity_mask
);
#endif
return
user_space_limit
;
}
...
...
@@ -3422,8 +3422,7 @@ NTSTATUS virtual_alloc_teb( TEB **ret_teb )
{
SIZE_T
total
=
32
*
block_size
;
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
is_win64
&&
is_wow64
()
?
limit_2g
-
1
:
0
,
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
ptr
,
user_space_wow_limit
,
&
total
,
MEM_RESERVE
,
PAGE_READWRITE
)))
{
server_leave_uninterrupted_section
(
&
virtual_mutex
,
&
sigset
);
...
...
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