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
f124c7cc
Commit
f124c7cc
authored
Jun 18, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Simplify the thread startup routine and make it CPU-specific.
parent
d17f3fe8
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
76 deletions
+90
-76
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-0
signal_i386.c
dlls/ntdll/signal_i386.c
+31
-0
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+17
-0
signal_sparc.c
dlls/ntdll/signal_sparc.c
+17
-0
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+18
-0
thread.c
dlls/ntdll/thread.c
+6
-76
No files found.
dlls/ntdll/ntdll_misc.h
View file @
f124c7cc
...
...
@@ -48,6 +48,7 @@ extern void set_cpu_context( const CONTEXT *context );
extern
void
copy_context
(
CONTEXT
*
to
,
const
CONTEXT
*
from
,
DWORD
flags
);
extern
NTSTATUS
context_to_server
(
context_t
*
to
,
const
CONTEXT
*
from
);
extern
NTSTATUS
context_from_server
(
CONTEXT
*
to
,
const
context_t
*
from
);
extern
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
DECLSPEC_NORETURN
;
/* debug helpers */
extern
LPCSTR
debugstr_us
(
const
UNICODE_STRING
*
str
);
...
...
dlls/ntdll/signal_i386.c
View file @
f124c7cc
...
...
@@ -2264,6 +2264,37 @@ void WINAPI __regs_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
DEFINE_REGS_ENTRYPOINT
(
RtlRaiseException
,
1
)
/* wrapper for apps that don't declare the thread function correctly */
extern
void
DECLSPEC_NORETURN
call_thread_func
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
);
__ASM_GLOBAL_FUNC
(
call_thread_func
,
"pushl %ebp
\n\t
"
"movl %esp,%ebp
\n\t
"
"subl $4,%esp
\n\t
"
"pushl 12(%ebp)
\n\t
"
"call *8(%ebp)
\n\t
"
"leal -4(%ebp),%esp
\n\t
"
"pushl %eax
\n\t
"
"call "
__ASM_NAME
(
"RtlExitUserThread"
)
"
\n\t
"
"int $3"
)
/***********************************************************************
* call_thread_entry_point
*/
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
{
__TRY
{
call_thread_func
(
entry
,
arg
);
}
__EXCEPT
(
unhandled_exception_filter
)
{
NtTerminateThread
(
GetCurrentThread
(),
GetExceptionCode
()
);
}
__ENDTRY
abort
();
/* should not be reached */
}
/**********************************************************************
* DbgBreakPoint (NTDLL.@)
*/
...
...
dlls/ntdll/signal_powerpc.c
View file @
f124c7cc
...
...
@@ -1086,6 +1086,23 @@ void WINAPI RtlRaiseException( EXCEPTION_RECORD *rec )
if
(
status
)
raise_status
(
status
,
rec
);
}
/***********************************************************************
* call_thread_entry_point
*/
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
{
__TRY
{
RtlExitUserThread
(
entry
(
arg
));
}
__EXCEPT
(
unhandled_exception_filter
)
{
NtTerminateThread
(
GetCurrentThread
(),
GetExceptionCode
()
);
}
__ENDTRY
abort
();
/* should not be reached */
}
/**********************************************************************
* DbgBreakPoint (NTDLL.@)
*/
...
...
dlls/ntdll/signal_sparc.c
View file @
f124c7cc
...
...
@@ -828,6 +828,23 @@ void WINAPI RtlRaiseException( EXCEPTION_RECORD *rec )
if
(
status
)
raise_status
(
status
,
rec
);
}
/***********************************************************************
* call_thread_entry_point
*/
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
{
__TRY
{
RtlExitUserThread
(
entry
(
arg
));
}
__EXCEPT
(
unhandled_exception_filter
)
{
NtTerminateThread
(
GetCurrentThread
(),
GetExceptionCode
()
);
}
__ENDTRY
abort
();
/* should not be reached */
}
/**********************************************************************
* DbgBreakPoint (NTDLL.@)
*/
...
...
dlls/ntdll/signal_x86_64.c
View file @
f124c7cc
...
...
@@ -2551,6 +2551,24 @@ void WINAPI __regs_RtlRaiseException( EXCEPTION_RECORD *rec, CONTEXT *context )
DEFINE_REGS_ENTRYPOINT
(
RtlRaiseException
,
1
)
/***********************************************************************
* call_thread_entry_point
*/
void
call_thread_entry_point
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
)
{
__TRY
{
RtlExitUserThread
(
entry
(
arg
));
}
__EXCEPT
(
unhandled_exception_filter
)
{
NtTerminateThread
(
GetCurrentThread
(),
GetExceptionCode
()
);
}
__ENDTRY
abort
();
/* should not be reached */
}
/**********************************************************************
* __wine_enter_vm86 (NTDLL.@)
*/
...
...
dlls/ntdll/thread.c
View file @
f124c7cc
...
...
@@ -388,66 +388,6 @@ static void DECLSPEC_NORETURN exit_thread( int status )
}
#ifdef __i386__
/* wrapper for apps that don't declare the thread function correctly */
extern
DWORD
call_thread_entry_point
(
PRTL_THREAD_START_ROUTINE
entry
,
void
*
arg
);
__ASM_GLOBAL_FUNC
(
call_thread_entry_point
,
"pushl %ebp
\n\t
"
"movl %esp,%ebp
\n\t
"
"subl $4,%esp
\n\t
"
"pushl 12(%ebp)
\n\t
"
"movl 8(%ebp),%eax
\n\t
"
"call *%eax
\n\t
"
"leave
\n\t
"
"ret"
)
#else
static
inline
DWORD
call_thread_entry_point
(
PRTL_THREAD_START_ROUTINE
entry
,
void
*
arg
)
{
LPTHREAD_START_ROUTINE
func
=
(
LPTHREAD_START_ROUTINE
)
entry
;
return
func
(
arg
);
}
#endif
/***********************************************************************
* call_thread_func
*
* Hack to make things compatible with the thread procedures used by kernel32.CreateThread.
*/
static
void
DECLSPEC_NORETURN
call_thread_func
(
PRTL_THREAD_START_ROUTINE
rtl_func
,
void
*
arg
)
{
DWORD
exit_code
;
BOOL
last
;
MODULE_DllThreadAttach
(
NULL
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04x:Starting thread proc %p (arg=%p)
\n
"
,
GetCurrentThreadId
(),
rtl_func
,
arg
);
exit_code
=
call_thread_entry_point
(
rtl_func
,
arg
);
/* send the exit code to the server */
SERVER_START_REQ
(
terminate_thread
)
{
req
->
handle
=
wine_server_obj_handle
(
GetCurrentThread
()
);
req
->
exit_code
=
exit_code
;
wine_server_call
(
req
);
last
=
reply
->
last
;
}
SERVER_END_REQ
;
if
(
last
)
{
LdrShutdownProcess
();
exit
(
exit_code
);
}
else
{
LdrShutdownThread
();
exit_thread
(
exit_code
);
}
}
/***********************************************************************
* start_thread
*
...
...
@@ -474,22 +414,12 @@ static void start_thread( struct startup_info *info )
InsertHeadList
(
&
tls_links
,
&
teb
->
TlsLinks
);
RtlReleasePebLock
();
/* NOTE: Windows does not have an exception handler around the call to
* the thread attach. We do for ease of debugging */
if
(
unhandled_exception_filter
)
{
__TRY
{
call_thread_func
(
func
,
arg
);
}
__EXCEPT
(
unhandled_exception_filter
)
{
NtTerminateThread
(
GetCurrentThread
(),
GetExceptionCode
()
);
}
__ENDTRY
}
else
call_thread_func
(
func
,
arg
);
MODULE_DllThreadAttach
(
NULL
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04x:Starting thread proc %p (arg=%p)
\n
"
,
GetCurrentThreadId
(),
func
,
arg
);
call_thread_entry_point
(
(
LPTHREAD_START_ROUTINE
)
func
,
arg
);
}
...
...
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