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
0c453bc7
Commit
0c453bc7
authored
Jul 21, 2006
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use NtAllocateVirtualMemory to allocate all TEBs except the first one.
parent
b636e4db
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
18 deletions
+16
-18
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-1
thread.c
dlls/ntdll/thread.c
+12
-4
virtual.c
dlls/ntdll/virtual.c
+3
-13
No files found.
dlls/ntdll/ntdll_misc.h
View file @
0c453bc7
...
@@ -106,7 +106,7 @@ extern NTSTATUS DIR_unmount_device( HANDLE handle );
...
@@ -106,7 +106,7 @@ extern NTSTATUS DIR_unmount_device( HANDLE handle );
extern
NTSTATUS
DIR_get_unix_cwd
(
char
**
cwd
);
extern
NTSTATUS
DIR_get_unix_cwd
(
char
**
cwd
);
/* virtual memory */
/* virtual memory */
extern
NTSTATUS
VIRTUAL_alloc_teb
(
void
**
ret
,
size_t
size
,
BOOL
first
);
extern
NTSTATUS
VIRTUAL_alloc_teb
(
void
**
ret
,
size_t
size
);
extern
NTSTATUS
VIRTUAL_HandleFault
(
LPCVOID
addr
);
extern
NTSTATUS
VIRTUAL_HandleFault
(
LPCVOID
addr
);
extern
BOOL
VIRTUAL_HasMapping
(
LPCVOID
addr
);
extern
BOOL
VIRTUAL_HasMapping
(
LPCVOID
addr
);
extern
void
VIRTUAL_UseLargeAddressSpace
(
void
);
extern
void
VIRTUAL_UseLargeAddressSpace
(
void
);
...
...
dlls/ntdll/thread.c
View file @
0c453bc7
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include "config.h"
#include "config.h"
#include "wine/port.h"
#include "wine/port.h"
#include <assert.h>
#include <sys/types.h>
#include <sys/types.h>
#ifdef HAVE_SYS_MMAN_H
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#include <sys/mman.h>
...
@@ -59,6 +60,7 @@ static RTL_BITMAP tls_bitmap;
...
@@ -59,6 +60,7 @@ static RTL_BITMAP tls_bitmap;
static
RTL_BITMAP
tls_expansion_bitmap
;
static
RTL_BITMAP
tls_expansion_bitmap
;
static
LIST_ENTRY
tls_links
;
static
LIST_ENTRY
tls_links
;
static
size_t
sigstack_total_size
;
static
size_t
sigstack_total_size
;
static
ULONG
sigstack_zero_bits
;
struct
wine_pthread_functions
pthread_functions
=
{
NULL
};
struct
wine_pthread_functions
pthread_functions
=
{
NULL
};
...
@@ -225,8 +227,10 @@ HANDLE thread_init(void)
...
@@ -225,8 +227,10 @@ HANDLE thread_init(void)
InitializeListHead
(
&
tls_links
);
InitializeListHead
(
&
tls_links
);
sigstack_total_size
=
get_signal_stack_total_size
();
sigstack_total_size
=
get_signal_stack_total_size
();
while
(
1
<<
sigstack_zero_bits
<
sigstack_total_size
)
sigstack_zero_bits
++
;
assert
(
1
<<
sigstack_zero_bits
==
sigstack_total_size
);
/* must be a power of 2 */
thread_info
.
teb_size
=
sigstack_total_size
;
thread_info
.
teb_size
=
sigstack_total_size
;
VIRTUAL_alloc_teb
(
&
addr
,
thread_info
.
teb_size
,
TRUE
);
VIRTUAL_alloc_teb
(
&
addr
,
thread_info
.
teb_size
);
teb
=
addr
;
teb
=
addr
;
init_teb
(
teb
);
init_teb
(
teb
);
thread_data
=
(
struct
ntdll_thread_data
*
)
teb
->
SystemReserved2
;
thread_data
=
(
struct
ntdll_thread_data
*
)
teb
->
SystemReserved2
;
...
@@ -376,7 +380,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
...
@@ -376,7 +380,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
DWORD
tid
=
0
;
DWORD
tid
=
0
;
int
request_pipe
[
2
];
int
request_pipe
[
2
];
NTSTATUS
status
;
NTSTATUS
status
;
SIZE_T
page_size
=
getpagesize
();
SIZE_T
size
,
page_size
=
getpagesize
();
if
(
!
is_current_process
(
process
)
)
if
(
!
is_current_process
(
process
)
)
{
{
...
@@ -411,9 +415,13 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
...
@@ -411,9 +415,13 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
goto
error
;
goto
error
;
}
}
info
->
pthread_info
.
teb_size
=
sigstack_total_size
;
addr
=
NULL
;
if
((
status
=
VIRTUAL_alloc_teb
(
&
addr
,
info
->
pthread_info
.
teb_size
,
FALSE
)))
goto
error
;
size
=
sigstack_total_size
;
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
sigstack_zero_bits
,
&
size
,
MEM_COMMIT
|
MEM_TOP_DOWN
,
PAGE_READWRITE
)))
goto
error
;
teb
=
addr
;
teb
=
addr
;
info
->
pthread_info
.
teb_size
=
size
;
if
((
status
=
init_teb
(
teb
)))
goto
error
;
if
((
status
=
init_teb
(
teb
)))
goto
error
;
teb
->
ClientId
.
UniqueProcess
=
(
HANDLE
)
GetCurrentProcessId
();
teb
->
ClientId
.
UniqueProcess
=
(
HANDLE
)
GetCurrentProcessId
();
...
...
dlls/ntdll/virtual.c
View file @
0c453bc7
...
@@ -1151,31 +1151,21 @@ static inline void virtual_init(void)
...
@@ -1151,31 +1151,21 @@ static inline void virtual_init(void)
*
*
* Allocate a memory view for a new TEB, properly aligned to a multiple of the size.
* Allocate a memory view for a new TEB, properly aligned to a multiple of the size.
*/
*/
NTSTATUS
VIRTUAL_alloc_teb
(
void
**
ret
,
size_t
size
,
BOOL
first
)
NTSTATUS
VIRTUAL_alloc_teb
(
void
**
ret
,
size_t
size
)
{
{
NTSTATUS
status
;
NTSTATUS
status
;
struct
file_view
*
view
;
struct
file_view
*
view
;
size_t
align_size
;
if
(
first
)
virtual_init
();
virtual_init
();
*
ret
=
NULL
;
*
ret
=
NULL
;
size
=
ROUND_SIZE
(
0
,
size
);
status
=
map_view
(
&
view
,
NULL
,
size
,
size
-
1
,
align_size
=
page_size
;
while
(
align_size
<
size
)
align_size
*=
2
;
if
(
!
first
)
RtlEnterCriticalSection
(
&
csVirtual
);
status
=
map_view
(
&
view
,
NULL
,
align_size
,
align_size
-
1
,
VPROT_READ
|
VPROT_WRITE
|
VPROT_COMMITTED
);
VPROT_READ
|
VPROT_WRITE
|
VPROT_COMMITTED
);
if
(
status
==
STATUS_SUCCESS
)
if
(
status
==
STATUS_SUCCESS
)
{
{
view
->
flags
|=
VFLAG_VALLOC
;
view
->
flags
|=
VFLAG_VALLOC
;
*
ret
=
view
->
base
;
*
ret
=
view
->
base
;
}
}
if
(
!
first
)
RtlLeaveCriticalSection
(
&
csVirtual
);
return
status
;
return
status
;
}
}
...
...
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