ucontext
Konstantin Belousov
kostikbel at gmail.com
Thu Oct 24 14:54:51 UTC 2019
On Thu, Oct 24, 2019 at 02:11:33PM +0300, Nick Kostirya via freebsd-arm wrote:
> Hello.
> I want to port MLton to ARM.
> There are file with access to ucontext_t structure.
>
>
> static void catcher (__attribute__ ((unused)) int signo,
> __attribute__ ((unused)) siginfo_t* info,
> void* context) {
> ucontext_t* ucp = (ucontext_t*)context;
> #if (defined (__x86_64__))
> GC_handleSigProf ((code_pointer) ucp->uc_mcontext.mc_rip);
> #elif (defined (__i386__))
> GC_handleSigProf ((code_pointer) ucp->uc_mcontext.mc_eip);
> #else
> #error Profiling handler is missing for this architecture
> #endif
> }
>
> Please, tell me what should I write for ARM.
>
> #elif (defined (__arm__))
> GC_handleSigProf ((code_pointer) ucp->uc_mcontext.mc_vfp_ptr);
>
> Is it?
I believe you want
uc_context.__gregs[_REG_PC]
on arm (32bit) and
uc_context.mc_gpregs.gp_elr
on arm64 for aarch64.
Sometimes the thumb bit (lowest bit in PC) leaks there, then you should
mask it.
More information about the freebsd-arm
mailing list