Skip to content

Commit

Permalink
xtensa: support coredump by register set alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
sdc-g committed Dec 13, 2024
1 parent 5cdc6c7 commit 24b3eb1
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 1 deletion.
28 changes: 28 additions & 0 deletions arch/xtensa/include/elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
41 changes: 40 additions & 1 deletion arch/xtensa/src/common/xtensa_tcbinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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] */
};

/****************************************************************************
Expand Down

0 comments on commit 24b3eb1

Please sign in to comment.