[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 3/9] disas/hppa: implement mfdiag/mtdiag disassembly
From: |
deller |
Subject: |
[PULL 3/9] disas/hppa: implement mfdiag/mtdiag disassembly |
Date: |
Thu, 30 Jan 2025 14:29:08 +0100 |
From: Helge Deller <deller@gmx.de>
The various PA-RISC CPUs implement different CPU-specific diag
instructions (mfdiag, mtdiag, mfcpu, mtcpu, ...) to access CPU-internal
diagnose/configuration registers, e.g. for cache control, managing space
register hashing, control front panel LEDs and read status of the
hardware reset button.
Those instructions are mostly undocumented, but are used by ODE, HP-UX
and Linux.
This patch adds some neccessary instructions for PCXL and PCXU CPUs.
Signed-off-by: Helge Deller <deller@gmx.de>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
---
disas/hppa.c | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/disas/hppa.c b/disas/hppa.c
index 49e2231ae6..2b58434966 100644
--- a/disas/hppa.c
+++ b/disas/hppa.c
@@ -606,7 +606,7 @@ struct pa_opcode
In the args field, the following characters are unused:
- ' " - / 34 6789:; '
+ ' " - / 34 678 :; '
'@ C M [\] '
'` e g } '
@@ -650,6 +650,7 @@ Also these:
| 6 bit field length at 19,27:31 (fixed extract/deposit)
A 13 bit immediate at 18 (to support the BREAK instruction)
^ like b, but describes a control register
+ 9 like b, but describes a diagnose register
! sar (cr11) register
D 26 bit immediate at 31 (to support the DIAG instruction)
$ 9 bit immediate at 28 (to support POPBTS)
@@ -1322,13 +1323,19 @@ static const struct pa_opcode pa_opcodes[] =
{ "fdce", 0x040012c0, 0xfc00ffdf, "cZx(b)", pa10, 0},
{ "fdce", 0x040012c0, 0xfc003fdf, "cZx(s,b)", pa10, 0},
{ "fice", 0x040002c0, 0xfc001fdf, "cZx(S,b)", pa10, 0},
-{ "diag", 0x14000000, 0xfc000000, "D", pa10, 0},
{ "idtlbt", 0x04001800, 0xfc00ffff, "x,b", pa20, FLAG_STRICT},
{ "iitlbt", 0x04000800, 0xfc00ffff, "x,b", pa20, FLAG_STRICT},
+/* completely undocumented, but used by ODE, HP-UX and Linux: */
+{ "mfcpu_pcxu", 0x140008a0, 0xfc9fffe0, "9,t", pa20, 0}, /* PCXU:
mfdiag */
+{ "mtcpu_pcxu", 0x14001840, 0xfc00ffff, "x,9", pa20, 0},
+
/* These may be specific to certain versions of the PA. Joel claimed
they were 72000 (7200?) specific. However, I'm almost certain the
mtcpu/mfcpu were undocumented, but available in the older 700 machines. */
+{ "mfcpu_c", 0x14000600, 0xfc00ffff, "9,x", pa10, 0}, /* PCXL: for dr0 and
dr8 only */
+{ "mfcpu_t", 0x14001400, 0xfc9fffe0, "9,t", pa10, 0}, /* PCXL: all dr
except dr0 and dr8 */
+{ "mtcpu_pcxl", 0x14000240, 0xfc00ffff, "x,9", pa11, 0}, /* PCXL: mtcpu
for dr0 and dr8 */
{ "mtcpu", 0x14001600, 0xfc00ffff, "x,^", pa10, 0},
{ "mfcpu", 0x14001A00, 0xfc00ffff, "^,x", pa10, 0},
{ "tocen", 0x14403600, 0xffffffff, "", pa10, 0},
@@ -1336,6 +1343,9 @@ static const struct pa_opcode pa_opcodes[] =
{ "shdwgr", 0x14402600, 0xffffffff, "", pa10, 0},
{ "grshdw", 0x14400620, 0xffffffff, "", pa10, 0},
+/* instead of showing D only, show all other registers too */
+{ "diag", 0x14000000, 0xfc000000, "D x,9,t", pa10, 0},
+
/* gfw and gfr are not in the HP PA 1.1 manual, but they are in either
the Timex FPU or the Mustang ERS (not sure which) manual. */
{ "gfw", 0x04001680, 0xfc00ffdf, "cZx(b)", pa11, 0},
@@ -1801,6 +1811,12 @@ fput_creg (unsigned reg, disassemble_info *info)
(*info->fprintf_func) (info->stream, "%s", control_reg[reg]);
}
+static void
+fput_dreg (unsigned reg, disassemble_info *info)
+{
+ (*info->fprintf_func) (info->stream, "dr%d", reg);
+}
+
/* Print constants with sign. */
static void
@@ -2007,6 +2023,9 @@ print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
case '^':
fput_creg (GET_FIELD (insn, 6, 10), info);
break;
+ case '9':
+ fput_dreg (GET_FIELD (insn, 6, 10), info);
+ break;
case 't':
fput_reg (GET_FIELD (insn, 27, 31), info);
break;
--
2.47.0
- [PULL 0/9] Hppa system mfdiag for v10 patches, deller, 2025/01/30
- [PULL 1/9] MAINTAINERS: Add myself as HPPA maintainer, deller, 2025/01/30
- [PULL 2/9] hppa: Sync contents of hppa_hardware.h header file with SeaBIOS-hppa, deller, 2025/01/30
- [PULL 3/9] disas/hppa: implement mfdiag/mtdiag disassembly,
deller <=
- [PULL 4/9] target/hppa: Add CPU diagnose registers, deller, 2025/01/30
- [PULL 5/9] target/hppa: Drop diag_getshadowregs_pa2 and diag_putshadowregs_pa2, deller, 2025/01/30
- [PULL 6/9] target/hppa: Add instruction decoding for mfdiag and mtdiag, deller, 2025/01/30
- [PULL 7/9] target/hppa: 64-bit CPUs start with space register hashing enabled, deller, 2025/01/30
- [PULL 8/9] target/hppa: Implement space register hashing for 64-bit HP-UX, deller, 2025/01/30
- [PULL 9/9] target/hppa: Update SeaBIOS-hppa to version 18, deller, 2025/01/30