linux-user/aarch64: Expand target_elf_gregset_t
Make use of the fact that target_elf_gregset_t is a proper structure by using target_user_pt_regs. 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
7ee71b02fb
commit
ff22166d3f
2 changed files with 12 additions and 10 deletions
|
|
@ -349,13 +349,12 @@ const char *get_elf_platform(CPUState *cs)
|
|||
return TARGET_BIG_ENDIAN ? "aarch64_be" : "aarch64";
|
||||
}
|
||||
|
||||
#define tswapreg(ptr) tswapal(ptr)
|
||||
|
||||
void elf_core_copy_regs(target_elf_gregset_t *r, const CPUARMState *env)
|
||||
{
|
||||
for (int i = 0; i < 32; i++) {
|
||||
r->regs[i] = tswapreg(env->xregs[i]);
|
||||
for (int i = 0; i < 31; i++) {
|
||||
r->pt.regs[i] = tswap64(env->xregs[i]);
|
||||
}
|
||||
r->regs[32] = tswapreg(env->pc);
|
||||
r->regs[33] = tswapreg(pstate_read((CPUARMState *)env));
|
||||
r->pt.sp = tswap64(env->xregs[31]);
|
||||
r->pt.pc = tswap64(env->pc);
|
||||
r->pt.pstate = tswap64(pstate_read((CPUARMState *)env));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,16 +8,19 @@
|
|||
#ifndef AARCH64_TARGET_ELF_H
|
||||
#define AARCH64_TARGET_ELF_H
|
||||
|
||||
#include "target_ptrace.h"
|
||||
|
||||
#define HAVE_ELF_HWCAP 1
|
||||
#define HAVE_ELF_HWCAP2 1
|
||||
#define HAVE_ELF_PLATFORM 1
|
||||
#define HAVE_ELF_CORE_DUMP 1
|
||||
|
||||
typedef abi_ulong target_elf_greg_t;
|
||||
|
||||
#define ELF_NREG 34
|
||||
/*
|
||||
* See linux kernel: arch/arm64/include/asm/elf.h, where
|
||||
* elf_gregset_t is mapped to struct user_pt_regs via 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