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
c77c4df3
Commit
c77c4df3
authored
Jan 07, 2002
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocate debug_info structure at the same time as the TEB.
Removed the TEB cleanup service.
parent
50c6b74a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
39 deletions
+14
-39
debugtools.c
dlls/ntdll/debugtools.c
+4
-12
thread.c
scheduler/thread.c
+10
-27
No files found.
dlls/ntdll/debugtools.c
View file @
c77c4df3
...
...
@@ -29,7 +29,7 @@ struct debug_info
char
output
[
1024
];
/* current output line */
};
static
struct
debug_info
tmp
;
static
struct
debug_info
initial_thread_info
;
/* debug info for initial thread */
/* filter for page-fault exceptions */
static
WINE_EXCEPTION_FILTER
(
page_fault
)
...
...
@@ -43,20 +43,12 @@ static WINE_EXCEPTION_FILTER(page_fault)
static
inline
struct
debug_info
*
get_info
(
void
)
{
struct
debug_info
*
info
=
NtCurrentTeb
()
->
debug_info
;
if
(
!
info
)
if
(
!
info
)
NtCurrentTeb
()
->
debug_info
=
info
=
&
initial_thread_info
;
if
(
!
info
->
str_pos
)
{
if
(
!
tmp
.
str_pos
)
{
tmp
.
str_pos
=
tmp
.
strings
;
tmp
.
out_pos
=
tmp
.
output
;
}
if
(
!
GetProcessHeap
())
return
&
tmp
;
/* setup the temp structure in case RtlAllocateHeap wants to print something */
NtCurrentTeb
()
->
debug_info
=
&
tmp
;
info
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
info
)
);
info
->
str_pos
=
info
->
strings
;
info
->
out_pos
=
info
->
output
;
NtCurrentTeb
()
->
debug_info
=
info
;
}
return
info
;
}
...
...
scheduler/thread.c
View file @
c77c4df3
...
...
@@ -22,7 +22,6 @@
#include "selectors.h"
#include "winnt.h"
#include "wine/server.h"
#include "services.h"
#include "stackframe.h"
#include "debugtools.h"
#include "winnls.h"
...
...
@@ -98,20 +97,12 @@ static BOOL THREAD_InitTEB( TEB *teb )
* Free data structures associated with a thread.
* Must be called from the context of another thread.
*/
static
void
CALLBACK
THREAD_FreeTEB
(
TEB
*
teb
)
static
void
THREAD_FreeTEB
(
TEB
*
teb
)
{
TRACE
(
"(%p) called
\n
"
,
teb
);
if
(
teb
->
cleanup
)
SERVICE_Delete
(
teb
->
cleanup
);
/* Free the associated memory */
close
(
teb
->
request_fd
);
close
(
teb
->
reply_fd
);
close
(
teb
->
wait_fd
[
0
]
);
close
(
teb
->
wait_fd
[
1
]
);
if
(
teb
->
stack_sel
)
FreeSelector16
(
teb
->
stack_sel
);
FreeSelector16
(
teb
->
stack_sel
);
FreeSelector16
(
teb
->
teb_sel
);
if
(
teb
->
debug_info
)
HeapFree
(
GetProcessHeap
(),
0
,
teb
->
debug_info
);
VirtualFree
(
teb
->
stack_base
,
0
,
MEM_RELEASE
);
}
...
...
@@ -155,24 +146,22 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size )
* stack_size normal stack
* 64Kb 16-bit stack (optional)
* 1 page TEB (except for initial thread)
* 1 page debug info (except for initial thread)
*/
stack_size
=
(
stack_size
+
(
page_size
-
1
))
&
~
(
page_size
-
1
);
total_size
=
stack_size
+
SIGNAL_STACK_SIZE
+
3
*
page_size
;
total_size
+=
0x10000
;
/* 16-bit stack */
if
(
!
teb
)
total_size
+=
page_size
;
if
(
!
teb
)
total_size
+=
2
*
page_size
;
if
(
!
(
base
=
VirtualAlloc
(
NULL
,
total_size
,
MEM_COMMIT
,
PAGE_EXECUTE_READWRITE
)))
return
NULL
;
if
(
!
teb
)
{
teb
=
(
TEB
*
)((
char
*
)
base
+
total_size
-
page_size
);
if
(
!
THREAD_InitTEB
(
teb
))
{
VirtualFree
(
base
,
0
,
MEM_RELEASE
);
return
NULL
;
}
teb
=
(
TEB
*
)((
char
*
)
base
+
total_size
-
2
*
page_size
);
if
(
!
THREAD_InitTEB
(
teb
))
goto
error
;
teb
->
debug_info
=
(
char
*
)
teb
+
page_size
;
}
teb
->
stack_low
=
base
;
...
...
@@ -196,7 +185,8 @@ TEB *THREAD_InitStack( TEB *teb, DWORD stack_size )
return
teb
;
error:
THREAD_FreeTEB
(
teb
);
FreeSelector16
(
teb
->
teb_sel
);
VirtualFree
(
base
,
0
,
MEM_RELEASE
);
return
NULL
;
}
...
...
@@ -251,16 +241,8 @@ DECL_GLOBAL_CONSTRUCTOR(thread_init) { THREAD_Init(); }
*/
static
void
THREAD_Start
(
void
)
{
HANDLE
cleanup_object
;
LPTHREAD_START_ROUTINE
func
=
(
LPTHREAD_START_ROUTINE
)
NtCurrentTeb
()
->
entry_point
;
/* install cleanup handler */
if
(
DuplicateHandle
(
GetCurrentProcess
(),
GetCurrentThread
(),
GetCurrentProcess
(),
&
cleanup_object
,
0
,
FALSE
,
DUPLICATE_SAME_ACCESS
))
NtCurrentTeb
()
->
cleanup
=
SERVICE_AddObject
(
cleanup_object
,
(
PAPCFUNC
)
THREAD_FreeTEB
,
(
ULONG_PTR
)
NtCurrentTeb
()
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%08lx:Starting thread (entryproc=%p)
\n
"
,
GetCurrentThreadId
(),
func
);
...
...
@@ -323,6 +305,7 @@ HANDLE WINAPI CreateThread( SECURITY_ATTRIBUTES *sa, DWORD stack,
if
(
SYSDEPS_SpawnThread
(
teb
)
==
-
1
)
{
CloseHandle
(
handle
);
close
(
request_pipe
[
1
]
);
THREAD_FreeTEB
(
teb
);
return
0
;
}
...
...
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