Module: wine Branch: master Commit: 94a98cf5a23e38824384a3412687b840c9d6b5c8 URL: https://source.winehq.org/git/wine.git/?a=commit;h=94a98cf5a23e38824384a3412...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Aug 13 14:53:07 2019 +0200
ntdll: Implement setting the thread context on ARM64.
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/signal_arm64.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/signal_arm64.c b/dlls/ntdll/signal_arm64.c index 648a140..1531a0e 100644 --- a/dlls/ntdll/signal_arm64.c +++ b/dlls/ntdll/signal_arm64.c @@ -252,7 +252,8 @@ __ASM_STDCALL_FUNC( RtlCaptureContext, 8, */ static void set_cpu_context( const CONTEXT *context ) { - FIXME( "Not implemented on ARM64\n" ); + interlocked_xchg_ptr( (void **)&arm64_thread_data()->context, (void *)context ); + raise( SIGUSR2 ); }
/*********************************************************************** @@ -861,6 +862,21 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext ) }
+/********************************************************************** + * usr2_handler + * + * Handler for SIGUSR2, used to set a thread context. + */ +static void usr2_handler( int signal, siginfo_t *siginfo, void *sigcontext ) +{ + CONTEXT *context = interlocked_xchg_ptr( (void **)&arm64_thread_data()->context, NULL ); + if (!context) return; + if ((context->ContextFlags & ~CONTEXT_ARM64) & CONTEXT_FLOATING_POINT) + restore_fpu( context, sigcontext ); + restore_context( context, sigcontext ); +} + + /*********************************************************************** * __wine_set_signal_handler (NTDLL.@) */ @@ -955,6 +971,8 @@ void signal_init_process(void) if (sigaction( SIGQUIT, &sig_act, NULL ) == -1) goto error; sig_act.sa_sigaction = usr1_handler; if (sigaction( SIGUSR1, &sig_act, NULL ) == -1) goto error; + sig_act.sa_sigaction = usr2_handler; + if (sigaction( SIGUSR2, &sig_act, NULL ) == -1) goto error;
sig_act.sa_sigaction = segv_handler; if (sigaction( SIGSEGV, &sig_act, NULL ) == -1) goto error;