[PATCH 4/4] ntdll: Implement arm64 sigcontext access for macOS
André Hentschel
nerv at dawncrow.de
Fri Aug 14 12:13:19 CDT 2020
Am 14.08.20 um 13:54 schrieb Martin Storsjo:
> Signed-off-by: Martin Storsjo <martin at martin.st>
> ---
> dlls/ntdll/unix/signal_arm64.c | 46 ++++++++++++++++++++++++++++++++++
> 1 file changed, 46 insertions(+)
>
> diff --git a/dlls/ntdll/unix/signal_arm64.c b/dlls/ntdll/unix/signal_arm64.c
> index cc34690f96..f1c6cdc5fa 100644
> --- a/dlls/ntdll/unix/signal_arm64.c
> +++ b/dlls/ntdll/unix/signal_arm64.c
> @@ -110,6 +110,20 @@ static DWORD64 get_fault_esr( ucontext_t *sigcontext )
> return 0;
> }
>
> +#elif defined(__APPLE__)
> +
> +/* Special Registers access */
> +# define SP_sig(context) ((context)->uc_mcontext->__ss.__sp) /* Stack pointer */
> +# define PC_sig(context) ((context)->uc_mcontext->__ss.__pc) /* Program counter */
> +# define PSTATE_sig(context) ((context)->uc_mcontext->__ss.__cpsr) /* Current State Register */
> +# define FP_sig(context) ((context)->uc_mcontext->__ss.__fp) /* Frame pointer */
> +# define LR_sig(context) ((context)->uc_mcontext->__ss.__lr) /* Link Register */
> +
> +static DWORD64 get_fault_esr( ucontext_t *sigcontext )
> +{
> + return sigcontext->uc_mcontext->__es.__esr;
> +}
> +
> #endif /* linux */
>
> static pthread_key_t teb_key;
> @@ -299,7 +313,11 @@ static void save_context( CONTEXT *context, const ucontext_t *sigcontext )
> context->Sp = SP_sig(sigcontext); /* Stack pointer */
> context->Pc = PC_sig(sigcontext); /* Program Counter */
> context->Cpsr = PSTATE_sig(sigcontext); /* Current State Register */
> +#ifdef linux
> for (i = 0; i <= 28; i++) context->u.X[i] = REGn_sig( i, sigcontext );
> +#elif defined(__APPLE__)
> + for (i = 0; i <= 28; i++) context->u.X[i] = sigcontext->uc_mcontext->__ss.__x[i];
> +#endif
> }
Hi Martin!
maybe I miss something, but isn't it possible to write an Apple version of the REGn_sig() macro?
More information about the wine-devel
mailing list