svn commit: r286956 - in head/sys/arm64: arm64 include

Andrew Turner andrew at FreeBSD.org
Thu Aug 20 12:05:44 UTC 2015


Author: andrew
Date: Thu Aug 20 12:05:42 2015
New Revision: 286956
URL: https://svnweb.freebsd.org/changeset/base/286956

Log:
  Add pmap_get_tables to get the page tables for a given virtual address. This
  will be used for minidump support.
  
  Obtained from:	ABT Systems Ltd
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/arm64/arm64/pmap.c
  head/sys/arm64/include/pmap.h

Modified: head/sys/arm64/arm64/pmap.c
==============================================================================
--- head/sys/arm64/arm64/pmap.c	Thu Aug 20 12:05:17 2015	(r286955)
+++ head/sys/arm64/arm64/pmap.c	Thu Aug 20 12:05:42 2015	(r286956)
@@ -314,6 +314,40 @@ pmap_l3(pmap_t pmap, vm_offset_t va)
 	return (pmap_l2_to_l3(l2, va));
 }
 
+bool
+pmap_get_tables(pmap_t pmap, vm_offset_t va, pd_entry_t **l1, pd_entry_t **l2,
+    pt_entry_t **l3)
+{
+	pd_entry_t *l1p, *l2p;
+
+	if (pmap->pm_l1 == NULL)
+		return (false);
+
+	l1p = pmap_l1(pmap, va);
+	*l1 = l1p;
+
+	if ((*l1p & ATTR_DESCR_MASK) == L1_BLOCK) {
+		*l2 = NULL;
+		*l3 = NULL;
+		return (true);
+	}
+
+	if ((*l1p & ATTR_DESCR_MASK) != L1_TABLE)
+		return (false);
+
+	l2p = pmap_l1_to_l2(l1p, va);
+	*l2 = l2p;
+
+	if ((*l2p & ATTR_DESCR_MASK) == L2_BLOCK) {
+		*l3 = NULL;
+		return (true);
+	}
+
+	*l3 = pmap_l2_to_l3(l2p, va);
+
+	return (true);
+}
+
 /*
  * These load the old table data and store the new value.
  * They need to be atomic as the System MMU may write to the table at

Modified: head/sys/arm64/include/pmap.h
==============================================================================
--- head/sys/arm64/include/pmap.h	Thu Aug 20 12:05:17 2015	(r286955)
+++ head/sys/arm64/include/pmap.h	Thu Aug 20 12:05:42 2015	(r286956)
@@ -149,6 +149,9 @@ void	pmap_unmapbios(vm_offset_t, vm_size
 boolean_t pmap_map_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t);
 void	pmap_unmap_io_transient(vm_page_t *, vm_offset_t *, int, boolean_t);
 
+bool	pmap_get_tables(pmap_t, vm_offset_t, pd_entry_t **, pd_entry_t **,
+    pt_entry_t **);
+
 #define	pmap_page_is_mapped(m)	(!TAILQ_EMPTY(&(m)->md.pv_list))
 
 #endif	/* _KERNEL */


More information about the svn-src-head mailing list