Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips add a "special3 offset" type of decode to ddb ...
details: https://anonhg.NetBSD.org/src/rev/8a1226791b03
branches: trunk
changeset: 1012964:8a1226791b03
user: mrg <mrg%NetBSD.org@localhost>
date: Mon Aug 17 03:14:08 2020 +0000
description:
add a "special3 offset" type of decode to ddb disasm so we see the
offsets properly decoded. add mips r6 "cache" insn.
avoid signed/unsigned compare and ufetch_32() for upcoming crash(8).
diffstat:
sys/arch/mips/include/mips_opcode.h | 23 +++++++++++++++++-
sys/arch/mips/mips/db_disasm.c | 47 +++++++++++++++++++++++++++++++-----
2 files changed, 62 insertions(+), 8 deletions(-)
diffs (144 lines):
diff -r 71fdccbe91ee -r 8a1226791b03 sys/arch/mips/include/mips_opcode.h
--- a/sys/arch/mips/include/mips_opcode.h Mon Aug 17 01:52:59 2020 +0000
+++ b/sys/arch/mips/include/mips_opcode.h Mon Aug 17 03:14:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_opcode.h,v 1.23 2020/08/15 04:27:28 simonb Exp $ */
+/* $NetBSD: mips_opcode.h,v 1.24 2020/08/17 03:14:08 mrg Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -79,6 +79,16 @@
unsigned : 1; /* always '1' */
unsigned op: 6; /* always '0x11' */
} FRType;
+
+ struct {
+ unsigned func: 6;
+ unsigned zero: 1; /* always '0' */
+ unsigned offset: 9;
+ unsigned rt: 5;
+ unsigned rs: 5;
+ unsigned op: 6;
+ } S3OType; /* has "special3 offset" type */
+
#endif
#if BYTE_ORDER == BIG_ENDIAN
struct {
@@ -111,6 +121,16 @@
unsigned fd: 5;
unsigned func: 6;
} FRType;
+
+ struct {
+ unsigned op: 6;
+ unsigned rs: 5;
+ unsigned rt: 5;
+ unsigned offset: 9;
+ unsigned zero: 1; /* always '0' */
+ unsigned func: 6;
+ } S3OType; /* has "special3 offset" type */
+
#endif
} InstFmt;
@@ -323,6 +343,7 @@
#define OP_SWRE 042 /* EVA */
#define OP_PREFE 043 /* EVA */
#define OP_DBSHFL 044 /* MIPS32/64 r2 */
+#define OP_CACHE_R6 045 /* MIPS32/64 r6 */
#define OP_LBUE 050 /* EVA */
#define OP_LHUE 051 /* EVA */
#define OP_LBE 054 /* EVA */
diff -r 71fdccbe91ee -r 8a1226791b03 sys/arch/mips/mips/db_disasm.c
--- a/sys/arch/mips/mips/db_disasm.c Mon Aug 17 01:52:59 2020 +0000
+++ b/sys/arch/mips/mips/db_disasm.c Mon Aug 17 03:14:08 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_disasm.c,v 1.32 2019/04/06 03:06:26 thorpej Exp $ */
+/* $NetBSD: db_disasm.c,v 1.33 2020/08/17 03:14:08 mrg Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.32 2019/04/06 03:06:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.33 2020/08/17 03:14:08 mrg Exp $");
#include <sys/param.h>
#include <sys/cpu.h>
@@ -47,6 +47,7 @@
#include <machine/db_machdep.h>
+#include <ddb/db_user.h>
#include <ddb/db_interface.h>
#include <ddb/db_output.h>
#include <ddb/db_extern.h>
@@ -131,6 +132,7 @@
[OP_SWRE] = "swre",
[OP_PREFE] = "prefe",
[OP_DBSHFL] = "dbshfl",
+ [OP_CACHE_R6] = "cache",
[OP_LBUE] = "lbue",
[OP_LHUE] = "lhue",
[OP_LBE] = "lbe",
@@ -225,11 +227,15 @@
* Take some care with addresses to not UTLB here as it
* loses the current debugging context. KSEG2 not checked.
*/
- if (loc < MIPS_KSEG0_START) {
+ if (loc < (db_addr_t)MIPS_KSEG0_START) {
+#ifdef _KERNEL
if (ufetch_32((void *)loc, &instr) != 0) {
db_printf("invalid address.\n");
return loc;
}
+#else
+ return loc;
+#endif
} else {
instr = *(uint32_t *)loc;
}
@@ -507,10 +513,37 @@
}
break;
}
- db_printf("%s\t%s,%s",
- spec3_name[i.RType.func],
- reg_name[i.RType.rs],
- reg_name[i.RType.rt]);
+ switch (i.RType.func) {
+ case OP_LWLE:
+ case OP_LWRE:
+ case OP_CACHEE:
+ case OP_SBE:
+ case OP_SHE:
+ case OP_SCE:
+ case OP_SWE:
+ case OP_SWLE:
+ case OP_SWRE:
+ case OP_PREFE:
+ case OP_CACHE_R6:
+ case OP_LBUE:
+ case OP_LHUE:
+ case OP_LBE:
+ case OP_LHE:
+ case OP_LLE:
+ case OP_LWE:
+ db_printf("%s\t%s,%d(%s)",
+ spec3_name[i.RType.func],
+ reg_name[i.RType.rs],
+ i.S3OType.offset > 255 ?
+ -i.S3OType.offset : i.S3OType.offset,
+ reg_name[i.RType.rt]);
+ break;
+ default:
+ db_printf("%s\t%s,%s",
+ spec3_name[i.RType.func],
+ reg_name[i.RType.rs],
+ reg_name[i.RType.rt]);
+ }
break;
case OP_REGIMM:
Home |
Main Index |
Thread Index |
Old Index