linux-user/xtensa: Expand target_elf_gregset_t
Make use of the fact that target_elf_gregset_t is a proper structure. Drop ELF_NREG, target_elf_greg_t, and tswapreg. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
parent
b90e368616
commit
abfa6c7c2a
2 changed files with 19 additions and 32 deletions
|
|
@ -11,36 +11,21 @@ const char *get_elf_cpu_model(uint32_t eflags)
|
|||
return XTENSA_DEFAULT_CPU_MODEL;
|
||||
}
|
||||
|
||||
#define tswapreg(ptr) tswapal(ptr)
|
||||
|
||||
enum {
|
||||
TARGET_REG_PC,
|
||||
TARGET_REG_PS,
|
||||
TARGET_REG_LBEG,
|
||||
TARGET_REG_LEND,
|
||||
TARGET_REG_LCOUNT,
|
||||
TARGET_REG_SAR,
|
||||
TARGET_REG_WINDOWSTART,
|
||||
TARGET_REG_WINDOWBASE,
|
||||
TARGET_REG_THREADPTR,
|
||||
TARGET_REG_AR0 = 64,
|
||||
};
|
||||
|
||||
void elf_core_copy_regs(target_elf_gregset_t *r, const CPUXtensaState *env)
|
||||
{
|
||||
unsigned i;
|
||||
r->pt.pc = tswap32(env->pc);
|
||||
r->pt.ps = tswap32(env->sregs[PS] & ~PS_EXCM);
|
||||
r->pt.lbeg = tswap32(env->sregs[LBEG]);
|
||||
r->pt.lend = tswap32(env->sregs[LEND]);
|
||||
r->pt.lcount = tswap32(env->sregs[LCOUNT]);
|
||||
r->pt.sar = tswap32(env->sregs[SAR]);
|
||||
r->pt.windowstart = tswap32(env->sregs[WINDOW_START]);
|
||||
r->pt.windowbase = tswap32(env->sregs[WINDOW_BASE]);
|
||||
r->pt.threadptr = tswap32(env->uregs[THREADPTR]);
|
||||
|
||||
r->regs[TARGET_REG_PC] = tswapreg(env->pc);
|
||||
r->regs[TARGET_REG_PS] = tswapreg(env->sregs[PS] & ~PS_EXCM);
|
||||
r->regs[TARGET_REG_LBEG] = tswapreg(env->sregs[LBEG]);
|
||||
r->regs[TARGET_REG_LEND] = tswapreg(env->sregs[LEND]);
|
||||
r->regs[TARGET_REG_LCOUNT] = tswapreg(env->sregs[LCOUNT]);
|
||||
r->regs[TARGET_REG_SAR] = tswapreg(env->sregs[SAR]);
|
||||
r->regs[TARGET_REG_WINDOWSTART] = tswapreg(env->sregs[WINDOW_START]);
|
||||
r->regs[TARGET_REG_WINDOWBASE] = tswapreg(env->sregs[WINDOW_BASE]);
|
||||
r->regs[TARGET_REG_THREADPTR] = tswapreg(env->uregs[THREADPTR]);
|
||||
xtensa_sync_phys_from_window((CPUXtensaState *)env);
|
||||
for (i = 0; i < env->config->nareg; ++i) {
|
||||
r->regs[TARGET_REG_AR0 + i] = tswapreg(env->phys_regs[i]);
|
||||
|
||||
for (unsigned i = 0; i < env->config->nareg; ++i) {
|
||||
r->pt.a[i] = tswap32(env->phys_regs[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,14 +8,16 @@
|
|||
#ifndef XTENSA_TARGET_ELF_H
|
||||
#define XTENSA_TARGET_ELF_H
|
||||
|
||||
#include "target_ptrace.h"
|
||||
|
||||
#define HAVE_ELF_CORE_DUMP 1
|
||||
|
||||
typedef abi_ulong target_elf_greg_t;
|
||||
|
||||
/* See linux kernel: arch/xtensa/include/asm/elf.h. */
|
||||
#define ELF_NREG 128
|
||||
/*
|
||||
* See linux kernel: arch/xtensa/include/asm/elf.h, where elf_gregset_t
|
||||
* is mapped to struct user_pt_regs via typedef and sizeof.
|
||||
*/
|
||||
typedef struct target_elf_gregset_t {
|
||||
target_elf_greg_t regs[ELF_NREG];
|
||||
struct target_user_pt_regs pt;
|
||||
} target_elf_gregset_t;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue