ntdll: Unwind the syscall frame in NtSetContextThread().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2020-08-20 18:23:24 +02:00
parent a686759f1d
commit 77fbf3a9fd
4 changed files with 15 additions and 1 deletions

View File

@ -461,7 +461,12 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
context_to_server( &server_context, context ); context_to_server( &server_context, context );
ret = set_thread_context( handle, &server_context, &self ); ret = set_thread_context( handle, &server_context, &self );
if (self && ret == STATUS_SUCCESS) set_cpu_context( context ); if (self && ret == STATUS_SUCCESS)
{
struct syscall_frame *frame = arm_thread_data()->syscall_frame;
arm_thread_data()->syscall_frame = frame->prev_frame;
set_cpu_context( context );
}
return ret; return ret;
} }

View File

@ -520,6 +520,8 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
} }
if (self && ret == STATUS_SUCCESS) if (self && ret == STATUS_SUCCESS)
{ {
struct syscall_frame *frame = arm64_thread_data()->syscall_frame;
arm64_thread_data()->syscall_frame = frame->prev_frame;
InterlockedExchangePointer( (void **)&arm64_thread_data()->context, (void *)context ); InterlockedExchangePointer( (void **)&arm64_thread_data()->context, (void *)context );
raise( SIGUSR2 ); raise( SIGUSR2 );
} }

View File

@ -870,6 +870,9 @@ static inline void restore_context( const CONTEXT *context, ucontext_t *sigconte
*/ */
extern void set_full_cpu_context( const CONTEXT *context ); extern void set_full_cpu_context( const CONTEXT *context );
__ASM_GLOBAL_FUNC( set_full_cpu_context, __ASM_GLOBAL_FUNC( set_full_cpu_context,
"movl %fs:0x1f8,%eax\n\t" /* x86_thread_data()->syscall_frame */
"movl (%eax),%eax\n\t" /* frame->prev_frame */
"movl %eax,%fs:0x1f8\n\t"
"movl 4(%esp),%ecx\n\t" "movl 4(%esp),%ecx\n\t"
"movw 0x8c(%ecx),%gs\n\t" /* SegGs */ "movw 0x8c(%ecx),%gs\n\t" /* SegGs */
"movw 0x90(%ecx),%fs\n\t" /* SegFs */ "movw 0x90(%ecx),%fs\n\t" /* SegFs */

View File

@ -1708,7 +1708,11 @@ NTSTATUS WINAPI NtSetContextThread( HANDLE handle, const CONTEXT *context )
if (!(flags & CONTEXT_CONTROL)) if (!(flags & CONTEXT_CONTROL))
FIXME( "setting partial context (%x) not supported\n", flags ); FIXME( "setting partial context (%x) not supported\n", flags );
else else
{
struct syscall_frame *frame = amd64_thread_data()->syscall_frame;
amd64_thread_data()->syscall_frame = frame->prev_frame;
set_full_cpu_context( context ); set_full_cpu_context( context );
}
} }
return ret; return ret;
} }