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
9650f1d3
Commit
9650f1d3
authored
Apr 28, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move signal stack size computation to the common code.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ffb7c595
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
25 additions
and
57 deletions
+25
-57
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+3
-0
signal_arm.c
dlls/ntdll/signal_arm.c
+2
-12
signal_arm64.c
dlls/ntdll/signal_arm64.c
+0
-1
signal_i386.c
dlls/ntdll/signal_i386.c
+4
-17
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+2
-12
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+2
-15
virtual.c
dlls/ntdll/virtual.c
+12
-0
No files found.
dlls/ntdll/ntdll_misc.h
View file @
9650f1d3
...
...
@@ -77,6 +77,9 @@ extern LPCSTR debugstr_us( const UNICODE_STRING *str ) DECLSPEC_HIDDEN;
extern
LPCSTR
debugstr_ObjectAttributes
(
const
OBJECT_ATTRIBUTES
*
oa
)
DECLSPEC_HIDDEN
;
/* init routines */
extern
SIZE_T
signal_stack_size
DECLSPEC_HIDDEN
;
extern
SIZE_T
signal_stack_mask
DECLSPEC_HIDDEN
;
extern
SIZE_T
signal_stack_align
DECLSPEC_HIDDEN
;
extern
void
signal_init_threading
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
signal_alloc_thread
(
TEB
**
teb
)
DECLSPEC_HIDDEN
;
extern
void
signal_free_thread
(
TEB
*
teb
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/signal_arm.c
View file @
9650f1d3
...
...
@@ -966,22 +966,12 @@ void signal_init_threading(void)
*/
NTSTATUS
signal_alloc_thread
(
TEB
**
teb
)
{
static
size_t
sigstack_alignment
;
SIZE_T
size
;
SIZE_T
size
=
signal_stack_mask
+
1
;
NTSTATUS
status
;
if
(
!
sigstack_alignment
)
{
size_t
min_size
=
page_size
;
/* find the first power of two not smaller than min_size */
while
((
1u
<<
sigstack_alignment
)
<
min_size
)
sigstack_alignment
++
;
assert
(
sizeof
(
TEB
)
<=
min_size
);
}
size
=
1
<<
sigstack_alignment
;
*
teb
=
NULL
;
if
(
!
(
status
=
virtual_alloc_aligned
(
(
void
**
)
teb
,
0
,
&
size
,
MEM_COMMIT
|
MEM_TOP_DOWN
,
PAGE_READWRITE
,
sig
stack_alignment
)))
PAGE_READWRITE
,
sig
nal_stack_align
)))
{
(
*
teb
)
->
Tib
.
Self
=
&
(
*
teb
)
->
Tib
;
(
*
teb
)
->
Tib
.
ExceptionList
=
(
void
*
)
~
0UL
;
...
...
dlls/ntdll/signal_arm64.c
View file @
9650f1d3
...
...
@@ -111,7 +111,6 @@ static DWORD64 get_fault_esr( ucontext_t *sigcontext )
#endif
/* linux */
static
const
size_t
teb_size
=
0x2000
;
/* we reserve two pages for the TEB */
static
const
size_t
signal_stack_size
=
max
(
MINSIGSTKSZ
,
8192
);
/* stack layout when calling an exception raise function */
struct
stack_layout
...
...
dlls/ntdll/signal_i386.c
View file @
9650f1d3
...
...
@@ -474,8 +474,6 @@ struct stack_layout
typedef
int
(
*
wine_signal_handler
)(
unsigned
int
sig
);
static
const
size_t
teb_size
=
4096
;
/* we reserve one page for the TEB */
static
size_t
signal_stack_mask
;
static
size_t
signal_stack_size
;
static
ULONG
first_ldt_entry
=
32
;
...
...
@@ -2592,26 +2590,14 @@ void signal_init_threading(void)
*/
NTSTATUS
signal_alloc_thread
(
TEB
**
teb
)
{
static
size_t
sigstack_alignment
;
struct
x86_thread_data
*
thread_data
;
SIZE_T
size
;
SIZE_T
size
=
signal_stack_mask
+
1
;
void
*
addr
=
NULL
;
NTSTATUS
status
;
int
first_thread
=
!
sigstack_alignment
;
static
int
first_thread
=
1
;
if
(
!
sigstack_alignment
)
{
size_t
min_size
=
teb_size
+
max
(
MINSIGSTKSZ
,
8192
);
/* find the first power of two not smaller than min_size */
sigstack_alignment
=
12
;
while
((
1u
<<
sigstack_alignment
)
<
min_size
)
sigstack_alignment
++
;
signal_stack_mask
=
(
1
<<
sigstack_alignment
)
-
1
;
signal_stack_size
=
(
1
<<
sigstack_alignment
)
-
teb_size
;
}
size
=
signal_stack_mask
+
1
;
if
(
!
(
status
=
virtual_alloc_aligned
(
&
addr
,
0
,
&
size
,
MEM_COMMIT
|
MEM_TOP_DOWN
,
PAGE_READWRITE
,
sig
stack_alignment
)))
PAGE_READWRITE
,
sig
nal_stack_align
)))
{
*
teb
=
addr
;
(
*
teb
)
->
Tib
.
Self
=
&
(
*
teb
)
->
Tib
;
...
...
@@ -2623,6 +2609,7 @@ NTSTATUS signal_alloc_thread( TEB **teb )
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
&
size
,
MEM_RELEASE
);
status
=
STATUS_TOO_MANY_THREADS
;
}
first_thread
=
0
;
}
return
status
;
}
...
...
dlls/ntdll/signal_powerpc.c
View file @
9650f1d3
...
...
@@ -1027,22 +1027,12 @@ void signal_init_threading(void)
*/
NTSTATUS
signal_alloc_thread
(
TEB
**
teb
)
{
static
size_t
sigstack_alignment
;
SIZE_T
size
;
SIZE_T
size
=
signal_stack_mask
+
1
;
NTSTATUS
status
;
if
(
!
sigstack_alignment
)
{
size_t
min_size
=
page_size
;
/* this is just for the TEB, we don't use a signal stack yet */
/* find the first power of two not smaller than min_size */
while
((
1u
<<
sigstack_alignment
)
<
min_size
)
sigstack_alignment
++
;
assert
(
sizeof
(
TEB
)
<=
min_size
);
}
size
=
1
<<
sigstack_alignment
;
*
teb
=
NULL
;
if
(
!
(
status
=
virtual_alloc_aligned
(
(
void
**
)
teb
,
0
,
&
size
,
MEM_COMMIT
|
MEM_TOP_DOWN
,
PAGE_READWRITE
,
sig
stack_alignment
)))
PAGE_READWRITE
,
sig
nal_stack_align
)))
{
(
*
teb
)
->
Tib
.
Self
=
&
(
*
teb
)
->
Tib
;
(
*
teb
)
->
Tib
.
ExceptionList
=
(
void
*
)
~
0UL
;
...
...
dlls/ntdll/signal_x86_64.c
View file @
9650f1d3
...
...
@@ -282,7 +282,6 @@ enum i386_trap_code
};
static
const
size_t
teb_size
=
0x2000
;
/* we reserve two pages for the TEB */
static
size_t
signal_stack_size
;
typedef
void
(
*
raise_func
)(
EXCEPTION_RECORD
*
rec
,
CONTEXT
*
context
);
...
...
@@ -3120,24 +3119,12 @@ void signal_init_threading(void)
*/
NTSTATUS
signal_alloc_thread
(
TEB
**
teb
)
{
static
size_t
sigstack_alignment
;
SIZE_T
size
;
SIZE_T
size
=
signal_stack_mask
+
1
;
NTSTATUS
status
;
if
(
!
sigstack_alignment
)
{
size_t
min_size
=
teb_size
+
max
(
MINSIGSTKSZ
,
8192
);
/* find the first power of two not smaller than min_size */
sigstack_alignment
=
12
;
while
((
1u
<<
sigstack_alignment
)
<
min_size
)
sigstack_alignment
++
;
signal_stack_size
=
(
1
<<
sigstack_alignment
)
-
teb_size
;
assert
(
sizeof
(
TEB
)
<=
teb_size
);
}
size
=
1
<<
sigstack_alignment
;
*
teb
=
NULL
;
if
(
!
(
status
=
virtual_alloc_aligned
(
(
void
**
)
teb
,
0
,
&
size
,
MEM_COMMIT
|
MEM_TOP_DOWN
,
PAGE_READWRITE
,
sig
stack_alignment
)))
PAGE_READWRITE
,
sig
nal_stack_align
)))
{
(
*
teb
)
->
Tib
.
Self
=
&
(
*
teb
)
->
Tib
;
(
*
teb
)
->
Tib
.
ExceptionList
=
(
void
*
)
~
0UL
;
...
...
dlls/ntdll/virtual.c
View file @
9650f1d3
...
...
@@ -31,6 +31,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
# include <sys/socket.h>
...
...
@@ -159,6 +160,10 @@ static void *address_space_start = (void *)0x10000;
#endif
/* __i386__ */
static
const
BOOL
is_win64
=
(
sizeof
(
void
*
)
>
sizeof
(
int
));
SIZE_T
signal_stack_size
=
0
;
SIZE_T
signal_stack_mask
=
0
;
SIZE_T
signal_stack_align
=
0
;
#define ROUND_ADDR(addr,mask) \
((void *)((UINT_PTR)(addr) & ~(UINT_PTR)(mask)))
...
...
@@ -1974,6 +1979,13 @@ void virtual_init(void)
}
}
size
=
ROUND_SIZE
(
0
,
sizeof
(
TEB
)
)
+
max
(
MINSIGSTKSZ
,
8192
);
/* find the first power of two not smaller than size */
signal_stack_align
=
page_shift
;
while
((
1u
<<
signal_stack_align
)
<
size
)
signal_stack_align
++
;
signal_stack_mask
=
(
1
<<
signal_stack_align
)
-
1
;
signal_stack_size
=
(
1
<<
signal_stack_align
)
-
ROUND_SIZE
(
0
,
sizeof
(
TEB
)
);
/* try to find space in a reserved area for the views and pages protection table */
#ifdef _WIN64
pages_vprot_size
=
((
size_t
)
address_space_limit
>>
page_shift
>>
pages_vprot_shift
)
+
1
;
...
...
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