Module Name:    src
Committed By:   riastradh
Date:           Sun May 23 11:56:28 UTC 2021

Modified Files:
        src/sys/arch/i386/i386: db_disasm.c

Log Message:
ddb/i386: Don't go out of the way to detect invalid addresses.

db_read_bytes already does this better (but didn't at the time this
check was originally added back in 1998).  Not sure if this code had
the same mistake as the amd64 code causing it to trip over its own
shoelaces, but there should be no need for it here.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/i386/i386/db_disasm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/db_disasm.c
diff -u src/sys/arch/i386/i386/db_disasm.c:1.48 src/sys/arch/i386/i386/db_disasm.c:1.49
--- src/sys/arch/i386/i386/db_disasm.c:1.48	Sat Mar  9 08:42:25 2019
+++ src/sys/arch/i386/i386/db_disasm.c	Sun May 23 11:56:28 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_disasm.c,v 1.48 2019/03/09 08:42:25 maxv Exp $	*/
+/*	$NetBSD: db_disasm.c,v 1.49 2021/05/23 11:56:28 riastradh Exp $	*/
 
 /* 
  * Mach Operating System
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.48 2019/03/09 08:42:25 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.49 2021/05/23 11:56:28 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -1132,26 +1132,6 @@ db_disasm(db_addr_t loc, bool altfmt)
 	int	len;
 	struct i_addr	address;
 
-#ifdef _KERNEL
-	pt_entry_t *pte, *pde;
-
-	/*
-	 * Don't try to disassemble the location if the mapping is invalid.
-	 * If we do, we'll fault, and end up debugging the debugger!
-	 * in the case of largepages, "pte" is really the pde and "pde" is
-	 * really the entry for the pdp itself.
-	 */
-	if ((vaddr_t)loc >= VM_MIN_KERNEL_ADDRESS)
-		pte = kvtopte((vaddr_t)loc);
-	else
-		pte = vtopte((vaddr_t)loc);
-	pde = vtopte((vaddr_t)pte);
-	if ((*pde & PTE_P) == 0 || (*pte & PTE_P) == 0) {
-		db_printf("invalid address\n");
-		return (loc);
-	}
-#endif
-
 	get_value_inc(inst, loc, 1, false);
 	short_addr = false;
 	size = LONG;

Reply via email to