Commit f1ef8a4d authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add platform-specific versions of the thread data structure.

parent 6effc483
...@@ -308,6 +308,18 @@ typedef int (*wine_signal_handler)(unsigned int sig); ...@@ -308,6 +308,18 @@ typedef int (*wine_signal_handler)(unsigned int sig);
static wine_signal_handler handlers[256]; static wine_signal_handler handlers[256];
struct amd64_thread_data
{
void *exit_frame; /* exit frame pointer */
};
C_ASSERT( sizeof(struct amd64_thread_data) <= sizeof(((TEB *)0)->SpareBytes1) );
static inline struct amd64_thread_data *amd64_thread_data(void)
{
return (struct amd64_thread_data *)NtCurrentTeb()->SpareBytes1;
}
/*********************************************************************** /***********************************************************************
* Dynamic unwind table * Dynamic unwind table
*/ */
...@@ -3992,7 +4004,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer, ...@@ -3992,7 +4004,7 @@ USHORT WINAPI RtlCaptureStackBackTrace( ULONG skip, ULONG count, PVOID *buffer,
*/ */
void call_thread_func( LPTHREAD_START_ROUTINE entry, void *arg, void *frame ) void call_thread_func( LPTHREAD_START_ROUTINE entry, void *arg, void *frame )
{ {
ntdll_get_thread_data()->exit_frame = frame; amd64_thread_data()->exit_frame = frame;
__TRY __TRY
{ {
RtlExitUserThread( entry( arg )); RtlExitUserThread( entry( arg ));
...@@ -4041,8 +4053,8 @@ __ASM_GLOBAL_FUNC( call_thread_exit_func, ...@@ -4041,8 +4053,8 @@ __ASM_GLOBAL_FUNC( call_thread_exit_func,
*/ */
void WINAPI RtlExitUserThread( ULONG status ) void WINAPI RtlExitUserThread( ULONG status )
{ {
if (!ntdll_get_thread_data()->exit_frame) exit_thread( status ); if (!amd64_thread_data()->exit_frame) exit_thread( status );
call_thread_exit_func( status, exit_thread, ntdll_get_thread_data()->exit_frame ); call_thread_exit_func( status, exit_thread, amd64_thread_data()->exit_frame );
} }
/*********************************************************************** /***********************************************************************
...@@ -4050,8 +4062,8 @@ void WINAPI RtlExitUserThread( ULONG status ) ...@@ -4050,8 +4062,8 @@ void WINAPI RtlExitUserThread( ULONG status )
*/ */
void abort_thread( int status ) void abort_thread( int status )
{ {
if (!ntdll_get_thread_data()->exit_frame) terminate_thread( status ); if (!amd64_thread_data()->exit_frame) terminate_thread( status );
call_thread_exit_func( status, terminate_thread, ntdll_get_thread_data()->exit_frame ); call_thread_exit_func( status, terminate_thread, amd64_thread_data()->exit_frame );
} }
/********************************************************************** /**********************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment