diff --git a/arch/xtensa/include/elf.h b/arch/xtensa/include/elf.h index f6f75c2dd9551..2390f63146de7 100644 --- a/arch/xtensa/include/elf.h +++ b/arch/xtensa/include/elf.h @@ -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 */ diff --git a/arch/xtensa/src/common/xtensa_tcbinfo.c b/arch/xtensa/src/common/xtensa_tcbinfo.c index 9738ab0553910..31ca7ba7e3365 100644 --- a/arch/xtensa/src/common/xtensa_tcbinfo.c +++ b/arch/xtensa/src/common/xtensa_tcbinfo.c @@ -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] */ }; /****************************************************************************