diff --git a/linux-user/alpha/elfload.c b/linux-user/alpha/elfload.c index 1e44475c47..1969f620a5 100644 --- a/linux-user/alpha/elfload.c +++ b/linux-user/alpha/elfload.c @@ -3,8 +3,20 @@ #include "qemu/osdep.h" #include "qemu.h" #include "loader.h" +#include "target_elf.h" +void elf_core_copy_regs(target_elf_gregset_t *r, const CPUAlphaState *env) +{ + int i; + + for (i = 0; i < 31; i++) { + r->regs[i] = tswap64(env->ir[i]); + } + r->pc = tswap64(env->pc); + r->unique = tswap64(env->unique); +} + const char *get_elf_cpu_model(uint32_t eflags) { return "ev67"; diff --git a/linux-user/alpha/target_elf.h b/linux-user/alpha/target_elf.h index 864dc6e2e6..4987ae3944 100644 --- a/linux-user/alpha/target_elf.h +++ b/linux-user/alpha/target_elf.h @@ -11,4 +11,17 @@ #define ELF_CLASS ELFCLASS64 #define ELF_MACHINE EM_ALPHA +#define HAVE_ELF_CORE_DUMP 1 + +/* + * Matches the kernel's elf_gregset_t (ELF_NGREG = 33): + * r0-r30 at indices 0-30, pc at 31, ps at 32. + * r31 (hardwired zero) is not stored; pc occupies index 31. + */ +typedef struct target_elf_gregset_t { + abi_ulong regs[31]; /* integer registers r0-r30 [0..30] */ + abi_ulong pc; /* program counter [31] */ + abi_ulong unique; /* thread's UNIQUE field [32] */ +} target_elf_gregset_t; + #endif