linux-unwind.h (_sig_ucontext_t): Remove.
2018-11-13 Xianmiao Qu <xianmiao_qu@c-sky.com> libgcc/ * config/csky/linux-unwind.h (_sig_ucontext_t): Remove. (csky_fallback_frame_state): Modify the check of the instructions to adapt to changes in the kernel From-SVN: r266060
This commit is contained in:
parent
77ece7f52e
commit
b2a71af6e2
|
@ -1,3 +1,9 @@
|
||||||
|
2018-11-13 Xianmiao Qu <xianmiao_qu@c-sky.com>
|
||||||
|
|
||||||
|
* config/csky/linux-unwind.h (_sig_ucontext_t): Remove.
|
||||||
|
(csky_fallback_frame_state): Modify the check of the
|
||||||
|
instructions to adapt to changes in the kernel
|
||||||
|
|
||||||
2018-11-09 Stafford Horne <shorne@gmail.com>
|
2018-11-09 Stafford Horne <shorne@gmail.com>
|
||||||
Richard Henderson <rth@twiddle.net>
|
Richard Henderson <rth@twiddle.net>
|
||||||
|
|
||||||
|
|
|
@ -25,22 +25,33 @@
|
||||||
|
|
||||||
#ifndef inhibit_libc
|
#ifndef inhibit_libc
|
||||||
|
|
||||||
/* Do code reading to identify a signal frame, and set the frame
|
/*
|
||||||
state data appropriately. See unwind-dw2.c for the structs. */
|
* Do code reading to identify a signal frame, and set the frame state data
|
||||||
|
* appropriately. See unwind-dw2.c for the structs.
|
||||||
|
*/
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <asm/unistd.h>
|
#include <asm/unistd.h>
|
||||||
|
|
||||||
/* The third parameter to the signal handler points to something with
|
#define TRAP0_V1 0x0008
|
||||||
this structure defined in asm/ucontext.h, but the name clashes with
|
#define MOVI_R1_119_V1 (0x6000 + (119 << 4) + 1)
|
||||||
struct ucontext from sys/ucontext.h so this private copy is used. */
|
#define MOVI_R1_127_V1 (0x6000 + (127 << 4) + 1)
|
||||||
typedef struct _sig_ucontext {
|
#define ADDI_R1_32_V1 (0x2000 + (31 << 4) + 1)
|
||||||
unsigned long uc_flags;
|
#define ADDI_R1_14_V1 (0x2000 + (13 << 4) + 1)
|
||||||
struct _sig_ucontext *uc_link;
|
#define ADDI_R1_12_V1 (0x2000 + (11 << 4) + 1)
|
||||||
stack_t uc_stack;
|
|
||||||
struct sigcontext uc_mcontext;
|
#define TRAP0_V2_PART0 0xc000
|
||||||
sigset_t uc_sigmask;
|
#define TRAP0_V2_PART1 0x2020
|
||||||
} _sig_ucontext_t;
|
#define MOVI_R7_119_V2_PART0 0xea07
|
||||||
|
#define MOVI_R7_119_V2_PART1 119
|
||||||
|
#define MOVI_R7_173_V2_PART0 0xea07
|
||||||
|
#define MOVI_R7_173_V2_PART1 173
|
||||||
|
#define MOVI_R7_139_V2_PART0 0xea07
|
||||||
|
#define MOVI_R7_139_V2_PART1 139
|
||||||
|
|
||||||
|
#define sc_pt_regs(x) (sc->sc_##x)
|
||||||
|
#define sc_pt_regs_lr (sc->sc_r15)
|
||||||
|
#define sc_pt_regs_tls(x) (sc->sc_exregs[15])
|
||||||
|
|
||||||
#define MD_FALLBACK_FRAME_STATE_FOR csky_fallback_frame_state
|
#define MD_FALLBACK_FRAME_STATE_FOR csky_fallback_frame_state
|
||||||
|
|
||||||
|
@ -54,22 +65,9 @@ csky_fallback_frame_state (struct _Unwind_Context *context,
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* movi r7, __NR_rt_sigreturn; trap 0 */
|
/* movi r7, __NR_rt_sigreturn; trap 0 */
|
||||||
if ((*(pc+0) == 0xea07) && (*(pc+1) == 119)
|
if ((*(pc + 0) == MOVI_R7_139_V2_PART0)
|
||||||
&& (*(pc+2) == 0xc000) && (*(pc+3) == 0x2020))
|
&& (*(pc + 1) == MOVI_R7_139_V2_PART1) && (*(pc + 2) == TRAP0_V2_PART0)
|
||||||
{
|
&& (*(pc + 3) == TRAP0_V2_PART1))
|
||||||
struct sigframe
|
|
||||||
{
|
|
||||||
int sig;
|
|
||||||
int code;
|
|
||||||
struct sigcontext *psc;
|
|
||||||
unsigned long extramask[2]; /* _NSIG_WORDS */
|
|
||||||
struct sigcontext sc;
|
|
||||||
} *_rt = context->cfa;
|
|
||||||
sc = _rt->psc; // &(_rt->sc);
|
|
||||||
}
|
|
||||||
/* movi r7, __NR_rt_sigreturn; trap 0 */
|
|
||||||
else if ((*(pc+0) == 0xea07) && (*(pc+1) == 173)
|
|
||||||
&& (*(pc+2) == 0xc000) && (*(pc+3) == 0x2020))
|
|
||||||
{
|
{
|
||||||
struct rt_sigframe
|
struct rt_sigframe
|
||||||
{
|
{
|
||||||
|
@ -77,55 +75,56 @@ csky_fallback_frame_state (struct _Unwind_Context *context,
|
||||||
struct siginfo *pinfo;
|
struct siginfo *pinfo;
|
||||||
void *puc;
|
void *puc;
|
||||||
siginfo_t info;
|
siginfo_t info;
|
||||||
struct ucontext uc;
|
ucontext_t uc;
|
||||||
} *_rt = context->cfa;
|
} *_rt = context->cfa;
|
||||||
sc = &(_rt->uc.uc_mcontext);
|
sc = &(_rt->uc.uc_mcontext);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return _URC_END_OF_STACK;
|
return _URC_END_OF_STACK;
|
||||||
|
|
||||||
new_cfa = (_Unwind_Ptr) sc->sc_usp;
|
new_cfa = (_Unwind_Ptr) sc_pt_regs (usp);
|
||||||
fs->regs.cfa_how = CFA_REG_OFFSET;
|
fs->regs.cfa_how = CFA_REG_OFFSET;
|
||||||
fs->regs.cfa_reg = STACK_POINTER_REGNUM;
|
fs->regs.cfa_reg = STACK_POINTER_REGNUM;
|
||||||
fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
|
fs->regs.cfa_offset = new_cfa - (_Unwind_Ptr) context->cfa;
|
||||||
|
|
||||||
fs->regs.reg[0].how = REG_SAVED_OFFSET;
|
fs->regs.reg[0].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[0].loc.offset = (_Unwind_Ptr)&(sc->sc_a0) - new_cfa;
|
fs->regs.reg[0].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a0) - new_cfa;
|
||||||
|
|
||||||
fs->regs.reg[1].how = REG_SAVED_OFFSET;
|
fs->regs.reg[1].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[1].loc.offset = (_Unwind_Ptr)&(sc->sc_a1) - new_cfa;
|
fs->regs.reg[1].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a1) - new_cfa;
|
||||||
|
|
||||||
fs->regs.reg[2].how = REG_SAVED_OFFSET;
|
fs->regs.reg[2].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[2].loc.offset = (_Unwind_Ptr)&(sc->sc_a2) - new_cfa;
|
fs->regs.reg[2].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a2) - new_cfa;
|
||||||
|
|
||||||
fs->regs.reg[3].how = REG_SAVED_OFFSET;
|
fs->regs.reg[3].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[3].loc.offset = (_Unwind_Ptr)&(sc->sc_a3) - new_cfa;
|
fs->regs.reg[3].loc.offset = (_Unwind_Ptr) & sc_pt_regs (a3) - new_cfa;
|
||||||
|
|
||||||
for (i = 4; i < 14; i++)
|
for (i = 4; i < 14; i++)
|
||||||
{
|
{
|
||||||
fs->regs.reg[i].how = REG_SAVED_OFFSET;
|
fs->regs.reg[i].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[i].loc.offset = ((_Unwind_Ptr)&(sc->sc_regs[i - 4])
|
fs->regs.reg[i].loc.offset =
|
||||||
- new_cfa);
|
(_Unwind_Ptr) & sc_pt_regs (regs[i - 4]) - new_cfa;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 16; i < 32; i++)
|
for (i = 16; i < 31; i++)
|
||||||
{
|
{
|
||||||
fs->regs.reg[i].how = REG_SAVED_OFFSET;
|
fs->regs.reg[i].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[i].loc.offset = ((_Unwind_Ptr)&(sc->sc_exregs[i - 16])
|
fs->regs.reg[i].loc.offset =
|
||||||
- new_cfa);
|
(_Unwind_Ptr) & sc_pt_regs (exregs[i - 16]) - new_cfa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fs->regs.reg[31].loc.offset =
|
||||||
|
(_Unwind_Ptr) & sc_pt_regs_tls (tls) - new_cfa;
|
||||||
/* FIXME : hi lo ? */
|
/* FIXME : hi lo ? */
|
||||||
fs->regs.reg[15].how = REG_SAVED_OFFSET;
|
fs->regs.reg[15].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[15].loc.offset = (_Unwind_Ptr)&(sc->sc_r15) - new_cfa;
|
fs->regs.reg[15].loc.offset = (_Unwind_Ptr) & sc_pt_regs_lr - new_cfa;
|
||||||
|
|
||||||
fs->regs.reg[56].how = REG_SAVED_OFFSET;
|
fs->regs.reg[32].how = REG_SAVED_OFFSET;
|
||||||
fs->regs.reg[56].loc.offset = (_Unwind_Ptr)&(sc->sc_pc) - new_cfa;
|
fs->regs.reg[32].loc.offset = (_Unwind_Ptr) & sc_pt_regs (pc) - new_cfa;
|
||||||
fs->retaddr_column = 56;
|
fs->retaddr_column = 32;
|
||||||
fs->signal_frame = 1;
|
fs->signal_frame = 1;
|
||||||
|
|
||||||
return _URC_NO_REASON;
|
return _URC_NO_REASON;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue