Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
6fe15e6c
Commit
6fe15e6c
authored
Dec 26, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Round the pthread stack size to a page boundary.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
f75d5625
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
6 deletions
+8
-6
loader.c
dlls/ntdll/loader.c
+1
-1
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-1
thread.c
dlls/ntdll/thread.c
+3
-2
virtual.c
dlls/ntdll/virtual.c
+3
-2
No files found.
dlls/ntdll/loader.c
View file @
6fe15e6c
...
...
@@ -3149,7 +3149,7 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
RemoveEntryList
(
&
wm
->
ldr
.
InMemoryOrderModuleList
);
InsertHeadList
(
&
peb
->
LdrData
->
InMemoryOrderModuleList
,
&
wm
->
ldr
.
InMemoryOrderModuleList
);
if
((
status
=
virtual_alloc_thread_stack
(
NtCurrentTeb
(),
0
,
0
,
0
))
!=
STATUS_SUCCESS
)
if
((
status
=
virtual_alloc_thread_stack
(
NtCurrentTeb
(),
0
,
0
,
NULL
))
!=
STATUS_SUCCESS
)
{
ERR
(
"Main exe initialization for %s failed, status %x
\n
"
,
debugstr_w
(
peb
->
ProcessParameters
->
ImagePathName
.
Buffer
),
status
);
...
...
dlls/ntdll/ntdll_misc.h
View file @
6fe15e6c
...
...
@@ -168,7 +168,7 @@ extern NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S
extern
void
virtual_get_system_info
(
SYSTEM_BASIC_INFORMATION
*
info
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_create_builtin_view
(
void
*
base
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
virtual_alloc_thread_stack
(
TEB
*
teb
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
,
SIZE_T
extra
_size
)
DECLSPEC_HIDDEN
;
SIZE_T
commit_size
,
SIZE_T
*
pthread
_size
)
DECLSPEC_HIDDEN
;
extern
void
virtual_clear_thread_stack
(
void
*
stack_end
)
DECLSPEC_HIDDEN
;
extern
BOOL
virtual_handle_stack_fault
(
void
*
addr
)
DECLSPEC_HIDDEN
;
extern
BOOL
virtual_is_valid_code_address
(
const
void
*
addr
,
SIZE_T
size
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/thread.c
View file @
6fe15e6c
...
...
@@ -540,6 +540,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
DWORD
tid
=
0
;
int
request_pipe
[
2
];
NTSTATUS
status
;
SIZE_T
extra_stack
=
PTHREAD_STACK_MIN
;
if
(
process
!=
NtCurrentProcess
())
{
...
...
@@ -618,7 +619,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
info
->
entry_point
=
start
;
info
->
entry_arg
=
param
;
if
((
status
=
virtual_alloc_thread_stack
(
teb
,
stack_reserve
,
stack_commit
,
PTHREAD_STACK_MIN
)))
if
((
status
=
virtual_alloc_thread_stack
(
teb
,
stack_reserve
,
stack_commit
,
&
extra_stack
)))
goto
error
;
thread_data
=
(
struct
ntdll_thread_data
*
)
&
teb
->
GdiTebBatch
;
...
...
@@ -630,7 +631,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
pthread_attr_init
(
&
attr
);
pthread_attr_setstack
(
&
attr
,
teb
->
DeallocationStack
,
(
char
*
)
teb
->
Tib
.
StackBase
+
PTHREAD_STACK_MIN
-
(
char
*
)
teb
->
DeallocationStack
);
(
char
*
)
teb
->
Tib
.
StackBase
+
extra_stack
-
(
char
*
)
teb
->
DeallocationStack
);
pthread_attr_setscope
(
&
attr
,
PTHREAD_SCOPE_SYSTEM
);
/* force creating a kernel thread */
interlocked_xchg_add
(
&
nb_threads
,
1
);
if
(
pthread_create
(
&
pthread_id
,
&
attr
,
(
void
*
(
*
)(
void
*
))
start_thread
,
info
))
...
...
dlls/ntdll/virtual.c
View file @
6fe15e6c
...
...
@@ -1758,12 +1758,12 @@ NTSTATUS virtual_create_builtin_view( void *module )
/***********************************************************************
* virtual_alloc_thread_stack
*/
NTSTATUS
virtual_alloc_thread_stack
(
TEB
*
teb
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
,
SIZE_T
extra
_size
)
NTSTATUS
virtual_alloc_thread_stack
(
TEB
*
teb
,
SIZE_T
reserve_size
,
SIZE_T
commit_size
,
SIZE_T
*
pthread
_size
)
{
struct
file_view
*
view
;
NTSTATUS
status
;
sigset_t
sigset
;
SIZE_T
size
;
SIZE_T
size
,
extra_size
=
0
;
if
(
!
reserve_size
||
!
commit_size
)
{
...
...
@@ -1775,6 +1775,7 @@ NTSTATUS virtual_alloc_thread_stack( TEB *teb, SIZE_T reserve_size, SIZE_T commi
size
=
max
(
reserve_size
,
commit_size
);
if
(
size
<
1024
*
1024
)
size
=
1024
*
1024
;
/* Xlib needs a large stack */
size
=
(
size
+
0xffff
)
&
~
0xffff
;
/* round to 64K boundary */
if
(
pthread_size
)
*
pthread_size
=
extra_size
=
max
(
page_size
,
ROUND_SIZE
(
0
,
*
pthread_size
));
server_enter_uninterrupted_section
(
&
csVirtual
,
&
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