Files
qemu/linux-user/alpha/elfload.c
Matt Turner 2304a65529 linux-user/alpha: write the floating-point registers to a core dump
A guest core carried only the general-purpose registers, so a debugger
opening one reported every floating-point register as unavailable --
including the arguments of the function that crashed.

Implement HAVE_ELF_CORE_FPREGS for Alpha: define target_elf_fpregset_t
to match the kernel's layout ($f0-$f30 plus the control register in the
slot $f31 would occupy) and fill it from elf_core_copy_fpregs().

Checked with lldb on a core from a program that faults with live values
in $f16 and $f17: both read back correctly, as does the control register.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Helge Deller <deller@gmx.de>
Signed-off-by: Helge Deller <deller@gmx.de>
2026-08-07 18:14:13 +02:00

45 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "qemu/osdep.h"
#include "qemu.h"
#include "loader.h"
#include "target_elf.h"
abi_ulong get_elf_hwcap(CPUState *cs)
{
/*
* The Linux kernel computes ELF_HWCAP as ~amask(-1), which clears a bit
* for each supported ISA extension. env->amask stores exactly those bits
* set for the extensions supported by the emulated CPU model, matching
* the kernel's convention: bit set in AT_HWCAP ↔ extension present.
*/
return cpu_env(cs)->amask;
}
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";
}
void elf_core_copy_fpregs(target_elf_fpregset_t *r, const CPUAlphaState *env)
{
int i;
for (i = 0; i < 31; i++) {
r->fpr[i] = tswap64(env->fir[i]);
}
r->fpcr = tswap64(cpu_alpha_load_fpcr((CPUAlphaState *)env));
}