Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2019 17:54:36 +0300
From:      Konstantin Belousov <kostikbel@gmail.com>
To:        Nick Kostirya <nikolay.kostirya@i11.co>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: ucontext
Message-ID:  <20191024145436.GX73312@kib.kiev.ua>
In-Reply-To: <20191024141133.04fb0693@i11.co>
References:  <20191024141133.04fb0693@i11.co>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20191024145436.GX73312>