Branch: refs/heads/staging-9.2
  Home:   https://github.com/qemu/qemu
  Commit: f54592ac3a318139703f3d409df13ce652269fe2
      
https://github.com/qemu/qemu/commit/f54592ac3a318139703f3d409df13ce652269fe2
  Author: Helge Deller <[email protected]>
  Date:   2025-05-25 (Sun, 25 May 2025)

  Changed paths:
    M target/hppa/int_helper.c

  Log Message:
  -----------
  target/hppa: Copy instruction code into fr1 on FPU assist fault

The hardware stores the instruction code in the lower bits of the FP
exception register #1 on FP assist traps.
This fixes the FP exception handler on Linux, as the Linux kernel uses
the value to decide on the correct signal which should be pushed into
userspace (see decode_fpu() in Linux kernel).

Signed-off-by: Helge Deller <[email protected]>
(cherry picked from commit 923976dfe367b0bfed45ff660c369f3fe65604a7)
Signed-off-by: Michael Tokarev <[email protected]>


  Commit: c1b28b447b96251bbe3c5cd963523747d5e17dd8
      
https://github.com/qemu/qemu/commit/c1b28b447b96251bbe3c5cd963523747d5e17dd8
  Author: Helge Deller <[email protected]>
  Date:   2025-05-25 (Sun, 25 May 2025)

  Changed paths:
    M linux-user/hppa/cpu_loop.c

  Log Message:
  -----------
  linux-user/hppa: Send proper si_code on SIGFPE exception

Improve the linux-user emulation to send the correct si_code depending
on overflow (TARGET_FPE_FLTOVF), underflow (TARGET_FPE_FLTUND), ...
Note that the hardware stores the relevant flags in FP exception
register #1, which is actually the lower 32-bits of the 64-bit fr[0]
register in qemu.

Signed-off-by: Helge Deller <[email protected]>
(cherry picked from commit b4b49cf39dba5f993ad925f204cb820aacfc8e45)
Signed-off-by: Michael Tokarev <[email protected]>


  Commit: 84ecaf22731201ca494595ab0e4d6eb8c7399775
      
https://github.com/qemu/qemu/commit/84ecaf22731201ca494595ab0e4d6eb8c7399775
  Author: Helge Deller <[email protected]>
  Date:   2025-05-25 (Sun, 25 May 2025)

  Changed paths:
    M target/hppa/fpu_helper.c

  Log Message:
  -----------
  target/hppa: Fix FPE exceptions

Implement FP exception register #1 (lower 32-bits of 64-bit fr[0]).
A proper implementation is necessary to allow the Linux kernel in
system mode and the qemu linux-user to send proper si_code values
on SIGFPE signal.

Always set the T-bit on taken exception, and merge over- and underflow
in system mode to just set overflow bit to mimic the behaviour I tested
on a physical machine.

The test program below can be used to verify correct behaviour. Note
that behaviour on SIGFPE may vary on different platforms. The program
should always detect the correct signal, but it may or may not be able
to sucessfully continue afterwards.

 #define _GNU_SOURCE
 #include <signal.h>
 #include <stdio.h>
 #include <fenv.h>
 #include <float.h>

 static void fpe_func(int sig, siginfo_t *i, void *v) {
    sigset_t set;
    sigemptyset(&set);
    sigaddset(&set, SIGFPE);
    sigprocmask(SIG_UNBLOCK, &set, NULL);
    printf("GOT signal %d with si_code %ld\n", sig, i->si_code);
 }

 int main(int argc, char *argv[]) {
    struct sigaction action = {
        .sa_sigaction = fpe_func,
        .sa_flags = SA_RESTART|SA_SIGINFO };
    sigaction(SIGFPE, &action, 0);
    feenableexcept(FE_OVERFLOW | FE_UNDERFLOW);
    double x = DBL_MIN;
    return printf("%lf\n", argc > 1
        ? 1.7976931348623158E308*1.7976931348623158E308
        : x / 10);
 }

Signed-off-by: Helge Deller <[email protected]>
(cherry picked from commit ebd394948de4e868cb8fc5b265a8a18f0935dce1)
Signed-off-by: Michael Tokarev <[email protected]>


Compare: https://github.com/qemu/qemu/compare/9b9907695da9...84ecaf227312

To unsubscribe from these emails, change your notification settings at 
https://github.com/qemu/qemu/settings/notifications

Reply via email to