All of lore.kernel.org
 help / color / mirror / Atom feed
From: Helge Deller <deller@kernel.org>
To: richard.henderson@linaro.org, qemu-devel@nongnu.org
Cc: deller@gmx.de
Subject: [PATCH] target/hppa: Work around Fast TLB insert instruction for HP-UX 9
Date: Fri,  3 Jul 2026 00:42:41 +0200	[thread overview]
Message-ID: <20260702224241.29866-1-deller@kernel.org> (raw)

From: Helge Deller <deller@gmx.de>

The HP-UX 9 kernel uses two TLB insert instructions (0x05315440 and
0x05385400), which seem to be wrongly encoded fast TLB instructions, but
similiar to the non-fast instructions idtlba r17,(r9) and
idtlbp r24,(r9).

It's not clear, if those undocumented instructions were used by mistake,
or intentionally. Either way, this patch allows qemu to handle those
instructions, so that a HP-UX 9 boot-CD can now boot somewhat further (but
still crashes due to other reasons afterwards).

Signed-off-by: Helge Deller <deller@gmx.de>
---
 target/hppa/insns.decode |  4 ++--
 target/hppa/translate.c  | 11 +++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/target/hppa/insns.decode b/target/hppa/insns.decode
index 13c6a55bf2..837a0b73e6 100644
--- a/target/hppa/insns.decode
+++ b/target/hppa/insns.decode
@@ -162,8 +162,8 @@ ixtlbx          000001 b:5 r:5 sp:2 0100000 addr:1 0 00000      data=1
 ixtlbx          000001 b:5 r:5 ... 000000 addr:1 0 00000        \
                 sp=%assemble_sr3x data=0
 
-# pcxl and pcxl2 Fast TLB Insert instructions
-ixtlbxf         000001 00000 r:5 00 0 data:1 01000 addr:1 0 00000
+# pcxl and pcxl2 Fast TLB Insert instructions (with HP-UX 9 workaround)
+ixtlbxf           000001 b:5 r:5 0- 0 data:1 01000 addr:1 0 00000
 
 # pa2.0 tlb insert idtlbt and iitlbt instructions
 ixtlbt          000001 r2:5 r1:5 000 data:1 100000 0 00000    # idtlbt
diff --git a/target/hppa/translate.c b/target/hppa/translate.c
index 4e34822565..72bc881784 100644
--- a/target/hppa/translate.c
+++ b/target/hppa/translate.c
@@ -2666,6 +2666,17 @@ static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a)
      *    return gen_illegal(ctx);
      */
 
+    /*
+     * The HP-UX 9 kernel uses two undocumented instructions 0x05315440 and
+     * 0x05385400, which seem to be wrongly encoded fast TLB instructions,
+     * similiar to idtlba r17,(r9) and idtlbp r24,(r9).
+     * To support HP-UX 9, check b against 0 (documented) and 9 (to allow the
+     * r9 case), and genenerate an illegal instruction trap otherwise.
+     */
+    if (a->b != 0 && a->b != 9) {
+        return gen_illegal(ctx);
+    }
+
     atl = tcg_temp_new_i64();
     stl = tcg_temp_new_i64();
     addr = tcg_temp_new_i64();
-- 
2.54.0



             reply	other threads:[~2026-07-02 22:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 22:42 Helge Deller [this message]
2026-07-03  1:58 ` [PATCH] target/hppa: Work around Fast TLB insert instruction for HP-UX 9 Philippe Mathieu-Daudé
2026-07-03 12:53   ` Helge Deller

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=20260702224241.29866-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.