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
8a8a94ae
Commit
8a8a94ae
authored
Dec 12, 2005
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel: Moved main stack initialization to process.c.
parent
770c4a15
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
38 deletions
+33
-38
kernel_private.h
dlls/kernel/kernel_private.h
+0
-3
process.c
dlls/kernel/process.c
+33
-7
thread.c
dlls/kernel/thread.c
+0
-28
No files found.
dlls/kernel/kernel_private.h
View file @
8a8a94ae
...
...
@@ -115,9 +115,6 @@ extern LPVOID DOSMEM_MapDosToLinear(UINT); /* linear DOS to Wine */
extern
UINT
DOSMEM_MapLinearToDos
(
LPVOID
);
/* linear Wine to DOS */
extern
void
load_winedos
(
void
);
/* thread.c */
extern
TEB
*
THREAD_InitStack
(
TEB
*
teb
,
DWORD
stack_size
);
/* environ.c */
extern
void
ENV_CopyStartupInformation
(
void
);
...
...
dlls/kernel/process.c
View file @
8a8a94ae
...
...
@@ -967,6 +967,38 @@ static BOOL process_init(void)
/***********************************************************************
* init_stack
*
* Allocate the stack of new process.
*/
static
void
*
init_stack
(
void
)
{
void
*
base
;
SIZE_T
stack_size
,
page_size
=
getpagesize
();
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
);
stack_size
=
max
(
nt
->
OptionalHeader
.
SizeOfStackReserve
,
nt
->
OptionalHeader
.
SizeOfStackCommit
);
stack_size
=
(
stack_size
+
(
page_size
-
1
))
&
~
(
page_size
-
1
);
if
(
stack_size
<
1024
*
1024
)
stack_size
=
1024
*
1024
;
/* Xlib needs a large stack */
if
(
!
(
base
=
VirtualAlloc
(
NULL
,
stack_size
,
MEM_COMMIT
,
PAGE_READWRITE
)))
{
ERR
(
"failed to allocate main process stack
\n
"
);
ExitProcess
(
1
);
}
/* note: limit is lower than base since the stack grows down */
NtCurrentTeb
()
->
DeallocationStack
=
base
;
NtCurrentTeb
()
->
Tib
.
StackBase
=
(
char
*
)
base
+
stack_size
;
NtCurrentTeb
()
->
Tib
.
StackLimit
=
base
;
/* setup guard page */
VirtualProtect
(
base
,
1
,
PAGE_READWRITE
|
PAGE_GUARD
,
NULL
);
return
NtCurrentTeb
()
->
Tib
.
StackBase
;
}
/***********************************************************************
* start_process
*
* Startup routine of a new process. Runs on the new process stack.
...
...
@@ -1010,7 +1042,6 @@ void __wine_kernel_init(void)
{
WCHAR
*
main_exe_name
,
*
p
;
char
error
[
1024
];
DWORD
stack_size
=
0
;
int
file_exists
;
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
...
...
@@ -1130,13 +1161,8 @@ void __wine_kernel_init(void)
set_library_wargv
(
__wine_main_argv
);
if
(
!
build_command_line
(
__wine_main_wargv
))
goto
error
;
stack_size
=
RtlImageNtHeader
(
peb
->
ImageBaseAddress
)
->
OptionalHeader
.
SizeOfStackReserve
;
/* allocate main thread stack */
if
(
!
THREAD_InitStack
(
NtCurrentTeb
(),
stack_size
))
goto
error
;
/* switch to the new stack */
wine_switch_to_stack
(
start_process
,
NULL
,
NtCurrentTeb
()
->
Tib
.
StackBase
);
wine_switch_to_stack
(
start_process
,
NULL
,
init_stack
()
);
error:
ExitProcess
(
GetLastError
()
);
...
...
dlls/kernel/thread.c
View file @
8a8a94ae
...
...
@@ -49,34 +49,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(thread);
WINE_DECLARE_DEBUG_CHANNEL
(
relay
);
/***********************************************************************
* THREAD_InitStack
*
* Allocate the stack of a thread.
*/
TEB
*
THREAD_InitStack
(
TEB
*
teb
,
DWORD
stack_size
)
{
DWORD
old_prot
;
DWORD
page_size
=
getpagesize
();
void
*
base
;
stack_size
=
(
stack_size
+
(
page_size
-
1
))
&
~
(
page_size
-
1
);
if
(
stack_size
<
1024
*
1024
)
stack_size
=
1024
*
1024
;
/* Xlib needs a large stack */
if
(
!
(
base
=
VirtualAlloc
(
NULL
,
stack_size
,
MEM_COMMIT
,
PAGE_READWRITE
)))
return
NULL
;
teb
->
DeallocationStack
=
base
;
teb
->
Tib
.
StackBase
=
(
char
*
)
base
+
stack_size
;
teb
->
Tib
.
StackLimit
=
base
;
/* note: limit is lower than base since the stack grows down */
/* Setup guard pages */
VirtualProtect
(
base
,
1
,
PAGE_READWRITE
|
PAGE_GUARD
,
&
old_prot
);
return
teb
;
}
struct
new_thread_info
{
LPTHREAD_START_ROUTINE
func
;
...
...
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