> I'm trying to understand what you mean, but your comments are rather
> obscure. Which file do you think I should change? Just tell me where to
> look and I'll do it.
glibc/ports/sysdeps/unix/sysv/linux/arm/eabi/sigrestorer.S Currently has:
.fnstart
.save {r0-r15}
.pad #32
nop
ENTRY(__default_sa_restorer_v2)
mov r7, $SYS_ify(sigreturn)
swi 0x0
.fnend
This needs changing to:
.fnstart
.personality __gnu_personality_sigframe
nop
ENTRY(__default_sa_restorer_v2)
mov r7, $SYS_ify(sigreturn)
swi 0x0
.fnend
The implementation of __gnu_personality_sigframe looks something like:
#include <unwind.h>
static void adjust_sp(context, int n)
{
_Unwind_Word sp;
_Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, &sp);
sp += n;
_Unwind_VRS_Set (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, &sp);
}
static uint32_t get_cpsr(context)
{
return sp[...];
}
_Unwind_Reason_Code
__gnu_personality_sigframe (_Unwind_State state,
_Unwind_Control_Block *ucbp,
_Unwind_Context *context)
{
int reg;
uint32_t cpsr;
uint32_t pc;
uint32_t *sp;
/* We never have any handlers or cleanups.
Just Unwind the signal frame and keep going. */
_Unwind_VRS_Get (context, _UVRSC_CORE, R_SP, _UVRSD_UINT32, &sp);
sp -= ...;
if (GLRO (dl_hwcap) & HWCAP_ARM_VFP)
{
foreach(vfp_reg)
_Unwind_VRS_Set(context, _UVRSC_VFP, ..., _UVRSD_DOUBLE, &sp[...]);
/* Don't forget about VFP3 (i.e. D16-D31 if they exist). */
}
foreach(core_reg)
_Unwind_VRS_Set (context, _UVRSC_CORE, ..., _UVRSD_UINT32, &sp[...]);
pc = sp[...];
cpsr = sp[...];
/* Set mode bit from saved CPSR. */
pc &= ~1;
if (cpsr & CPSR_T)
pc |= 1;
/* Advance PC past the faulting instruction. */
if ((cpsr & CPSR_T) && (*(uint16_t *)(pc & ~1) < 0xe800))
pc += 2;
else
pc += 4;
_Unwind_VRS_Set (context, _UVRSC_CORE, R_PC, _UVRSD_UINT32, &pc);
/* We don't/can't restore CPSR and FPSR. However the EABI requires these
have fixed values at public entry points. Hope that subsequent
catch/cleanup handlers are ok with that value. */
return _URC_CONTINUE_UNWIND;
}
For bonus points have __gnu_personality_sigframe automagically handle bit old
and new layouts, removing the _v1/_v2 hacks.
Paul