ntdll: Add support for unwinding the signal stack on x86_64.

This commit is contained in:
Alexandre Julliard 2009-08-28 18:24:06 +02:00
parent ec07811056
commit af22daf72b

View File

@ -975,6 +975,17 @@ static inline void *get_signal_stack(void)
return (char *)NtCurrentTeb() + teb_size;
}
/***********************************************************************
* is_inside_signal_stack
*
* Check if pointer is inside the signal stack.
*/
static inline int is_inside_signal_stack( void *ptr )
{
return ((char *)ptr >= (char *)get_signal_stack() &&
(char *)ptr < (char *)get_signal_stack() + signal_stack_size);
}
/***********************************************************************
* save_context
*
@ -1316,8 +1327,7 @@ static EXCEPTION_RECORD *setup_exception( ucontext_t *sigcontext, raise_func fun
/* stack sanity checks */
if ((char *)stack >= (char *)get_signal_stack() &&
(char *)stack < (char *)get_signal_stack() + signal_stack_size)
if (is_inside_signal_stack( stack ))
{
ERR( "nested exception on signal stack in thread %04x eip %016lx esp %016lx stack %p-%p\n",
GetCurrentThreadId(), RIP_sig(sigcontext), RSP_sig(sigcontext),
@ -2424,6 +2434,14 @@ void WINAPI RtlUnwindEx( ULONG64 end_frame, ULONG64 target_ip, EXCEPTION_RECORD
if (!dispatch.EstablisherFrame) break;
if (is_inside_signal_stack( (void *)dispatch.EstablisherFrame ))
{
TRACE( "frame %lx is inside signal stack (%p-%p)\n", dispatch.EstablisherFrame,
get_signal_stack(), (char *)get_signal_stack() + signal_stack_size );
context = new_context;
continue;
}
if ((dispatch.EstablisherFrame & 7) ||
dispatch.EstablisherFrame < (ULONG64)NtCurrentTeb()->Tib.StackLimit ||
dispatch.EstablisherFrame > (ULONG64)NtCurrentTeb()->Tib.StackBase)