On Wed, 26 Feb 2025 at 17:03, Aleksandar Rakic <aleksandar.ra...@htecgroup.com> wrote: > > From: Aleksandar Rakic <aleksandar.ra...@htecgroup.com> > > Skip NaN mode check for soft-float since NaN mode is irrelevant if an ELF > binary's FPU mode is soft-float, i.e. it doesn't utilize a FPU. > > Cherry-picked 63492a56485f6b755fccf7ad623f7a189bfc79b6 > from https://github.com/MIPS/gnutools-qemu > > Signed-off-by: Faraz Shahbazker <fshahbaz...@wavecomp.com> > Signed-off-by: Aleksandar Rakic <aleksandar.ra...@htecgroup.com> > --- > linux-user/mips/cpu_loop.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/linux-user/mips/cpu_loop.c b/linux-user/mips/cpu_loop.c > index 462387a073..07c1ebe287 100644 > --- a/linux-user/mips/cpu_loop.c > +++ b/linux-user/mips/cpu_loop.c > @@ -304,8 +304,10 @@ void target_cpu_copy_regs(CPUArchState *env, struct > target_pt_regs *regs) > if (env->insn_flags & ISA_NANOMIPS32) { > return; > } > - if (((info->elf_flags & EF_MIPS_NAN2008) != 0) != > - ((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) != 0)) { > + if (info->fp_abi != MIPS_ABI_FP_SOFT > + && ((info->elf_flags & EF_MIPS_NAN2008) != 0) != > + ((env->active_fpu.fcr31 & (1 << FCR31_NAN2008)) != 0)) > + { > if ((env->active_fpu.fcr31_rw_bitmask & > (1 << FCR31_NAN2008)) == 0) { > fprintf(stderr, "ELF binary's NaN mode not supported by CPU\n");
Unless I'm misreading the code, the kernel's MIPS ELF loader does not look at the fp_abi to decide how to handle the NAN2008 bit: https://elixir.bootlin.com/linux/v6.13.6/source/arch/mips/kernel/elf.c#L154 I think QEMU should handle this bit the same way as the kernel's loader. thanks -- PMM