target/hppa: Work around Fast TLB insert instruction for HP-UX 9
PATCH 1/1 target/hppa: Work around Fast TLB insert instruction for HP-UX 9
From: Helge Deller <[email protected]>
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).
--- target/hppa/insns.decode | 4 ++-- target/hppa/translate.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)
target/hppa/insns.decode +2 -2
@@ -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
target/hppa/translate.c +11 -0
@@ -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 ();
Signature · 1 line
2.54.0
Quoted 38 lines · Helge Deller
From: Helge Deller <[email protected]>
The HP-UX 9 kernel uses two TLB insert instructions (
0x05315440and0x05385400), 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 <[email protected]>--- target/hppa/insns.decode | 4 ++-- target/hppa/translate.c | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)target/hppa/insns.decode +2
-2@@ -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 # idtlbttarget/hppa/translate.c +0
-0
target/hppa/translate.c static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a) · line 2674
Quoted 9 lines
target/hppa/translate.c +6
-0@@ -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.
Typo "generate".
target/hppa/translate.c static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a) · line 2676
Quoted 2 lines
target/hppa/translate.c +2
-0+*/ +if (a->b !=0 && a->b !=9 ) {
s/&&/||/?
But since @b is not consumed otherwise, what about dropping it from the decoder instead?
ixtlbxf 000001 00000 r:5 0- 0 data:1 01000 addr:1 0 00000
ixtlbxf 000001 01001 r:5 0- 0 data:1 01000 addr:1 0 00000
Quoted 6 lines
target/hppa/translate.c +3
-0+return gen_illegal (ctx); + } + atl =tcg_temp_new_i64 (); stl =tcg_temp_new_i64 (); addr =tcg_temp_new_i64 ();
Quoted 51 lines · Philippe Mathieu-Daudé
Quoted 36 lines · Helge Deller
From: Helge Deller <[email protected]>
The HP-UX 9 kernel uses two TLB insert instructions (
0x05315440and0x05385400), 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 <[email protected]>---
target/hppa/insns.decode | 4 ++--
target/hppa/translate.c | 11 +++++++++++2 files changed, 13 insertions(+), 2 deletions(-)target/hppa/insns.decode +0
-0@@ -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
target/hppa/insns.decode +2
-2-# 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 # idtlbttarget/hppa/translate.c +0
-0target/hppa/translate.c static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a) · line 2673
Quoted 8 lines
target/hppa/translate.c +6
-0@@ -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. Typo "generate".
target/hppa/translate.c static bool trans_ixtlbxf(DisasContext *ctx, arg_ixtlbxf *a) · line 2676
Quoted 2 lines
target/hppa/translate.c +2
-0+*/ + if (a->b != 0 && a->b != 9) {
Quoted 7 lines
s/&&/||/?
But since @b is not consumed otherwise, what about dropping it from the decoder instead?
ixtlbxf 000001 00000 r:5 0- 0 data:1 01000 addr:1 0 00000 ixtlbxf 000001 01001 r:5 0- 0 data:1 01000 addr:1 0 00000
Yes, that's better.
I'll fix it accordingly.
Thanks!
Helge