xtensa: support coredump by register set alignment

This commit is contained in:
Gao Feng 2024-11-07 13:39:11 +08:00 committed by Xiang Xiao
parent 5cdc6c77cf
commit 9e8e7ace09
2 changed files with 68 additions and 1 deletions

View file

@ -34,4 +34,32 @@
#define R_XTENSA_ASM_EXPAND 11
#define R_XTENSA_SLOT0_OP 20
/* elf header of xtensa core dump */
#define EM_ARCH EM_XTENSA
#define EF_FLAG 0
/* register set to dump status */
typedef uint32_t xtensa_elf_greg_t;
typedef struct
{
xtensa_elf_greg_t pc;
xtensa_elf_greg_t ps;
xtensa_elf_greg_t lbeg;
xtensa_elf_greg_t lend;
xtensa_elf_greg_t lcount;
xtensa_elf_greg_t sar;
xtensa_elf_greg_t windowstart;
xtensa_elf_greg_t windowbase;
xtensa_elf_greg_t threadptr;
xtensa_elf_greg_t reserved[7 + 48];
xtensa_elf_greg_t ar[64];
}
__attribute__((packed)) xtensa_gregset_t;
#define XTENSA_ELF_NGREG (sizeof(xtensa_gregset_t) / sizeof(xtensa_elf_greg_t))
typedef unsigned long elf_gregset_t[XTENSA_ELF_NGREG];
#endif /* __ARCH_XTENSA_INCLUDE_ELF_H */

View file

@ -38,6 +38,33 @@ static const uint16_t g_reg_offs[] =
{
TCB_REG_OFF(REG_PC),
TCB_REG_OFF(REG_PS),
#if XCHAL_HAVE_LOOPS != 0
TCB_REG_OFF(REG_LBEG),
TCB_REG_OFF(REG_LEND),
TCB_REG_OFF(REG_LCOUNT),
#else
UINT16_MAX,
UINT16_MAX,
UINT16_MAX,
#endif
TCB_REG_OFF(REG_SAR),
UINT16_MAX, /* windowstart */
UINT16_MAX, /* windowbase */
UINT16_MAX, /* threadptr */
UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, /* reserved[7 + 48] */
TCB_REG_OFF(REG_A0),
TCB_REG_OFF(REG_A1),
TCB_REG_OFF(REG_A2),
@ -53,7 +80,19 @@ static const uint16_t g_reg_offs[] =
TCB_REG_OFF(REG_A12),
TCB_REG_OFF(REG_A13),
TCB_REG_OFF(REG_A14),
TCB_REG_OFF(REG_A15),
TCB_REG_OFF(REG_A15), /* ar[0:15] */
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX,
UINT16_MAX, UINT16_MAX, UINT16_MAX, UINT16_MAX, /* ar[16:63] */
};
/****************************************************************************