Commit b6928d3a authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ntdll: Store exception reporting flags on suspend.

parent 04a2917f
......@@ -4444,7 +4444,7 @@ static void test_wow64_context(void)
{
trace( "in 64-bit mode %04x\n", context.SegCs );
if (ctx.ContextFlags & CONTEXT_EXCEPTION_REPORTING)
todo_wine ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST
ok( ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST
| CONTEXT_EXCEPTION_REPORTING | CONTEXT_SERVICE_ACTIVE)
|| ctx.ContextFlags == (WOW64_CONTEXT_ALL | CONTEXT_EXCEPTION_REQUEST
| CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE),
......@@ -11179,8 +11179,8 @@ static void test_context_exception_request(void)
c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST;
ret = GetThreadContext( thread, &c );
ok( ret, "got error %lu.\n", GetLastError() );
todo_wine ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == (CONTEXT_CONTROL
| CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING)) /* Win7 64 */, "got %#lx.\n", c.ContextFlags );
ok( c.ContextFlags == expected_flags || broken( c.ContextFlags == (CONTEXT_CONTROL
| CONTEXT_EXCEPTION_REQUEST | CONTEXT_EXCEPTION_REPORTING)) /* Win7 64 */, "got %#lx.\n", c.ContextFlags );
p.sync = 0;
ResumeThread(thread);
......@@ -11222,7 +11222,7 @@ static void test_context_exception_request(void)
c.ContextFlags = CONTEXT_CONTROL | CONTEXT_EXCEPTION_REQUEST;
ret = GetThreadContext( thread, &c );
ok( ret, "got error %lu.\n", GetLastError() );
todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
c.ContextFlags = CONTEXT_CONTROL;
ret = SetThreadContext( thread, &c );
......@@ -11232,7 +11232,7 @@ static void test_context_exception_request(void)
| CONTEXT_EXCEPTION_ACTIVE;
ret = GetThreadContext( thread, &c );
ok( ret, "got error %lu.\n", GetLastError() );
todo_wine ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
ok( c.ContextFlags == expected_flags, "got %#lx.\n", c.ContextFlags );
SetEvent( p.event );
......
......@@ -1021,7 +1021,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
if (is_inside_syscall( sigcontext ))
{
context.ContextFlags = CONTEXT_FULL;
context.ContextFlags = CONTEXT_FULL | CONTEXT_EXCEPTION_REQUEST;
NtGetContextThread( GetCurrentThread(), &context );
wait_suspend( &context );
NtSetContextThread( GetCurrentThread(), &context );
......@@ -1029,6 +1029,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
else
{
save_context( &context, sigcontext );
context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING;
wait_suspend( &context );
restore_context( &context, sigcontext );
}
......@@ -1135,7 +1136,11 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB
if (context.Pc & 1) context.Cpsr |= 0x20; /* thumb mode */
if ((ctx = get_cpu_area( IMAGE_FILE_MACHINE_ARMNT ))) *ctx = context;
if (suspend) wait_suspend( &context );
if (suspend)
{
context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE;
wait_suspend( &context );
}
ctx = (CONTEXT *)((ULONG_PTR)context.Sp & ~15) - 1;
*ctx = context;
......
......@@ -1225,7 +1225,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
if (is_inside_syscall( sigcontext ))
{
context.ContextFlags = CONTEXT_FULL;
context.ContextFlags = CONTEXT_FULL | CONTEXT_EXCEPTION_REQUEST;
NtGetContextThread( GetCurrentThread(), &context );
wait_suspend( &context );
NtSetContextThread( GetCurrentThread(), &context );
......@@ -1233,6 +1233,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
else
{
save_context( &context, sigcontext );
context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING;
wait_suspend( &context );
restore_context( &context, sigcontext );
}
......@@ -1418,7 +1419,11 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB
if (arm_context->Pc & 1) arm_context->Cpsr |= 0x20; /* thumb mode */
}
if (suspend) wait_suspend( &context );
if (suspend)
{
context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE;
wait_suspend( &context );
}
ctx = (CONTEXT *)((ULONG_PTR)context.Sp & ~15) - 1;
*ctx = context;
......
......@@ -2130,7 +2130,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
ERR_(seh)( "kernel stack overflow.\n" );
return;
}
context->c.ContextFlags = CONTEXT_FULL;
context->c.ContextFlags = CONTEXT_FULL | CONTEXT_EXCEPTION_REQUEST;
NtGetContextThread( GetCurrentThread(), &context->c );
if (xstate_extended_features())
{
......@@ -2153,6 +2153,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
struct xcontext context;
save_context( &context, ucontext );
context.c.ContextFlags |= CONTEXT_EXCEPTION_REPORTING;
wait_suspend( &context.c );
restore_context( &context, ucontext );
}
......@@ -2514,7 +2515,11 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB
((XSAVE_FORMAT *)context.ExtendedRegisters)->MxCsr = 0x1f80;
if ((ctx = get_cpu_area( IMAGE_FILE_MACHINE_I386 ))) *ctx = context;
if (suspend) wait_suspend( &context );
if (suspend)
{
context.ContextFlags |= CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE;
wait_suspend( &context );
}
ctx = (CONTEXT *)((ULONG_PTR)context.Esp & ~3) - 1;
*ctx = context;
......
......@@ -2172,7 +2172,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
ERR_(seh)( "kernel stack overflow.\n" );
return;
}
context->c.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS;
context->c.ContextFlags = CONTEXT_FULL | CONTEXT_SEGMENTS | CONTEXT_EXCEPTION_REQUEST;
NtGetContextThread( GetCurrentThread(), &context->c );
if (xstate_extended_features())
{
......@@ -2195,6 +2195,8 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
struct xcontext context;
save_context( &context, ucontext );
context.c.ContextFlags |= CONTEXT_EXCEPTION_REPORTING;
if (is_wow64() && context.c.SegCs == cs64_sel) context.c.ContextFlags |= CONTEXT_EXCEPTION_ACTIVE;
wait_suspend( &context.c );
restore_context( &context, ucontext );
}
......@@ -2536,7 +2538,7 @@ void call_init_thunk( LPTHREAD_START_ROUTINE entry, void *arg, BOOL suspend, TEB
# error Please define setting %gs for your architecture
#endif
context.ContextFlags = CONTEXT_ALL;
context.ContextFlags = CONTEXT_ALL | CONTEXT_EXCEPTION_REPORTING | CONTEXT_EXCEPTION_ACTIVE;
context.Rcx = (ULONG_PTR)entry;
context.Rdx = (ULONG_PTR)arg;
context.Rsp = (ULONG_PTR)teb->Tib.StackBase - 0x28;
......
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