From: deller@kernel.org
To: Richard Henderson <richard.henderson@linaro.org>, qemu-devel@nongnu.org
Cc: Helge Deller <deller@gmx.de>
Subject: [PATCH 1/3] target/hppa: Copy instruction code into fr1 on FPU assist fault
Date: Sat, 17 May 2025 14:00:51 +0200 [thread overview]
Message-ID: <20250517120053.18231-2-deller@kernel.org> (raw)
In-Reply-To: <20250517120053.18231-1-deller@kernel.org>
From: Helge Deller <deller@gmx.de>
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 <deller@gmx.de>
---
target/hppa/int_helper.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/target/hppa/int_helper.c b/target/hppa/int_helper.c
index 7d48643bb6..191ae19404 100644
--- a/target/hppa/int_helper.c
+++ b/target/hppa/int_helper.c
@@ -177,6 +177,10 @@ void hppa_cpu_do_interrupt(CPUState *cs)
}
}
env->cr[CR_IIR] = ldl_phys(cs->as, paddr);
+ if (i == EXCP_ASSIST) {
+ /* stuff insn code into bits of FP exception register #1 */
+ env->fr[0] |= (env->cr[CR_IIR] & 0x03ffffff);
+ }
}
break;
--
2.47.0
next prev parent reply other threads:[~2025-05-17 12:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-17 12:00 [PATCH 0/3] target/hppa: Fix FP exception handling deller
2025-05-17 12:00 ` deller [this message]
2025-05-17 12:00 ` [PATCH 2/3] linux-user/hppa: Send proper si_code on SIGFPE exception deller
2025-05-17 12:00 ` [PATCH 3/3] target/hppa: Fix FPE exceptions deller
2025-10-16 17:23 ` Peter Maydell
2025-10-16 22:43 ` Helge Deller
2025-05-24 10:26 ` [PATCH 0/3] target/hppa: Fix FP exception handling Michael Tokarev
2025-05-25 0:42 ` Helge Deller
2025-05-25 8:23 ` Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250517120053.18231-2-deller@kernel.org \
--to=deller@kernel.org \
--cc=deller@gmx.de \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).