Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Support PMAP_FAULTINFO on arm
details: https://anonhg.NetBSD.org/src/rev/0b855800706a
branches: trunk
changeset: 1008622:0b855800706a
user: skrll <skrll%NetBSD.org@localhost>
date: Sun Mar 29 09:10:26 2020 +0000
description:
Support PMAP_FAULTINFO on arm
diffstat:
sys/arch/arm/arm32/fault.c | 31 +++++++++++++++++++++++++++++--
sys/arch/arm/arm32/pmap.c | 10 ++++++++--
sys/arch/arm/include/pcb.h | 9 +++++++++
3 files changed, 46 insertions(+), 4 deletions(-)
diffs (109 lines):
diff -r ce605eabff6b -r 0b855800706a sys/arch/arm/arm32/fault.c
--- a/sys/arch/arm/arm32/fault.c Sun Mar 29 09:06:38 2020 +0000
+++ b/sys/arch/arm/arm32/fault.c Sun Mar 29 09:10:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fault.c,v 1.110 2020/02/24 12:38:57 rin Exp $ */
+/* $NetBSD: fault.c,v 1.111 2020/03/29 09:10:26 skrll Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -81,7 +81,7 @@
#include "opt_kgdb.h"
#include <sys/types.h>
-__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.110 2020/02/24 12:38:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fault.c,v 1.111 2020/03/29 09:10:26 skrll Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -468,6 +468,33 @@
dab_fatal(tf, fsr, far, l, NULL);
}
+#ifdef PMAP_FAULTINFO
+ struct pcb_faultinfo * const pfi = &pcb->pcb_faultinfo;
+ struct proc * const p = curproc;
+
+ if (p->p_pid == pfi->pfi_lastpid && va == pfi->pfi_faultaddr) {
+ if (++pfi->pfi_repeats > 4) {
+ tlb_asid_t asid = tlb_get_asid();
+ pt_entry_t *ptep = pfi->pfi_faultptep;
+
+ printf("%s: fault #%u (%x/%s) for %#" PRIxVADDR
+ "(%#x) at pc %#" PRIxREGISTER " curpid=%u/%u "
+ "ptep@%p=%#" PRIxPTE ")\n", __func__,
+ pfi->pfi_repeats, fsr & FAULT_TYPE_MASK,
+ data_aborts[fsr & FAULT_TYPE_MASK].desc, va,
+ far, tf->tf_pc, map->pmap->pm_pai[0].pai_asid,
+ asid, ptep, ptep ? *ptep : 0);
+ cpu_Debugger();
+ }
+ } else {
+ pfi->pfi_lastpid = p->p_pid;
+ pfi->pfi_faultaddr = va;
+ pfi->pfi_repeats = 0;
+ pfi->pfi_faultptep = NULL;
+ pfi->pfi_faulttype = fsr & FAULT_TYPE_MASK;
+ }
+#endif /* PMAP_FAULTINFO */
+
onfault = pcb->pcb_onfault;
pcb->pcb_onfault = NULL;
error = uvm_fault(map, va, ftype);
diff -r ce605eabff6b -r 0b855800706a sys/arch/arm/arm32/pmap.c
--- a/sys/arch/arm/arm32/pmap.c Sun Mar 29 09:06:38 2020 +0000
+++ b/sys/arch/arm/arm32/pmap.c Sun Mar 29 09:10:26 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.400 2020/03/23 16:38:29 skrll Exp $ */
+/* $NetBSD: pmap.c,v 1.401 2020/03/29 09:10:26 skrll Exp $ */
/*
* Copyright 2003 Wasabi Systems, Inc.
@@ -198,7 +198,7 @@
#endif
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.400 2020/03/23 16:38:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.401 2020/03/29 09:10:26 skrll Exp $");
#include <sys/atomic.h>
#include <sys/param.h>
@@ -3466,6 +3466,12 @@
UVMHIST_LOG(maphist, " (pm=%#jx, sva=%#jx, eva=%#jx)",
(uintptr_t)pm, sva, eva, 0);
+#ifdef PMAP_FAULTINFO
+ curpcb->pcb_faultinfo.pfi_faultaddr = 0;
+ curpcb->pcb_faultinfo.pfi_repeats = 0;
+ curpcb->pcb_faultinfo.pfi_faultptep = NULL;
+#endif
+
SLIST_INIT(&opv_list);
/*
* we lock in the pmap => pv_head direction
diff -r ce605eabff6b -r 0b855800706a sys/arch/arm/include/pcb.h
--- a/sys/arch/arm/include/pcb.h Sun Mar 29 09:06:38 2020 +0000
+++ b/sys/arch/arm/include/pcb.h Sun Mar 29 09:10:26 2020 +0000
@@ -41,6 +41,14 @@
#include <arm/arm32/pte.h>
#include <arm/reg.h>
+struct pcb_faultinfo {
+ void *pfi_faultptep;
+ vaddr_t pfi_faultaddr;
+ u_int pfi_repeats;
+ pid_t pfi_lastpid;
+ uint8_t pfi_faulttype;
+};
+
#define pcb_ksp pcb_sp
struct pcb {
@@ -68,6 +76,7 @@
void * pcb_onfault; /* On fault handler */
struct vfpreg pcb_vfp; /* VFP registers */
struct vfpreg pcb_kernel_vfp; /* kernel VFP state */
+ struct pcb_faultinfo pcb_faultinfo;
};
/*
Home |
Main Index |
Thread Index |
Old Index