linux-user/xtensa: Convert target_elf_gregset_t to a struct

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson
2025-08-30 07:03:58 +10:00
parent f2accdfac4
commit 8caa662110
+14 -12
View File
@@ -873,7 +873,9 @@ static bool init_guest_commpage(void)
/* See linux kernel: arch/xtensa/include/asm/elf.h. */
#define ELF_NREG 128
typedef target_elf_greg_t target_elf_gregset_t[ELF_NREG];
typedef struct target_elf_gregset_t {
target_elf_greg_t regs[ELF_NREG];
} target_elf_gregset_t;
enum {
TARGET_REG_PC,
@@ -888,23 +890,23 @@ enum {
TARGET_REG_AR0 = 64,
};
static void elf_core_copy_regs(target_elf_gregset_t *regs,
static void elf_core_copy_regs(target_elf_gregset_t *r,
const CPUXtensaState *env)
{
unsigned i;
(*regs)[TARGET_REG_PC] = tswapreg(env->pc);
(*regs)[TARGET_REG_PS] = tswapreg(env->sregs[PS] & ~PS_EXCM);
(*regs)[TARGET_REG_LBEG] = tswapreg(env->sregs[LBEG]);
(*regs)[TARGET_REG_LEND] = tswapreg(env->sregs[LEND]);
(*regs)[TARGET_REG_LCOUNT] = tswapreg(env->sregs[LCOUNT]);
(*regs)[TARGET_REG_SAR] = tswapreg(env->sregs[SAR]);
(*regs)[TARGET_REG_WINDOWSTART] = tswapreg(env->sregs[WINDOW_START]);
(*regs)[TARGET_REG_WINDOWBASE] = tswapreg(env->sregs[WINDOW_BASE]);
(*regs)[TARGET_REG_THREADPTR] = tswapreg(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) {
(*regs)[TARGET_REG_AR0 + i] = tswapreg(env->phys_regs[i]);
r->regs[TARGET_REG_AR0 + i] = tswapreg(env->phys_regs[i]);
}
}