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
This commit is contained in:
Andrew Turner 2015-08-20 12:05:42 +00:00
parent 5a2555160f
commit 9a0de24b5e
2 changed files with 37 additions and 0 deletions

View File

@ -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

View File

@ -149,6 +149,9 @@ void pmap_unmapbios(vm_offset_t, vm_size_t);
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 */