Page MenuHomeFreeBSD

D41132.id125006.diff
No OneTemporary

D41132.id125006.diff

diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -7479,8 +7479,6 @@
pt_entry_t PG_G, PG_RW, PG_V;
vm_page_t mt, pdpg;
- KASSERT(pmap == kernel_pmap || (newpde & PG_W) == 0,
- ("pmap_enter_pde: cannot create wired user mapping"));
PG_G = pmap_global_bit(pmap);
PG_RW = pmap_rw_bit(pmap);
KASSERT((newpde & (pmap_modified_bit(pmap) | PG_RW)) != PG_RW,
@@ -7594,6 +7592,27 @@
}
}
+ /*
+ * Allocate leaf ptpage for wired userspace pages.
+ */
+ if (pmap != kernel_pmap && (newpde & PG_W) != 0) {
+ vm_page_t uwptpg;
+ vm_paddr_t uwptpgpa;
+
+ uwptpg = pmap_alloc_pt_page(pmap, pmap_pde_index(va),
+ VM_ALLOC_WIRED);
+ if (uwptpg == NULL ||
+ pmap_insert_pt_page(pmap, uwptpg, true, true)) {
+ return (KERN_RESOURCE_SHORTAGE);
+ }
+
+ uwptpgpa = VM_PAGE_TO_PHYS(uwptpg);
+ pmap_fill_ptp((pt_entry_t *)PHYS_TO_DMAP(uwptpgpa),
+ newpde & ~(PG_PS));
+
+ uwptpg->ref_count = NPTEPG;
+ }
+
/*
* Increment counters.
*/
diff --git a/sys/vm/vm_fault.c b/sys/vm/vm_fault.c
--- a/sys/vm/vm_fault.c
+++ b/sys/vm/vm_fault.c
@@ -388,7 +388,7 @@
rounddown2(vaddr, pagesizes[m_super->psind]) >= fs->entry->start &&
roundup2(vaddr + 1, pagesizes[m_super->psind]) <= fs->entry->end &&
(vaddr & (pagesizes[m_super->psind] - 1)) == (VM_PAGE_TO_PHYS(m) &
- (pagesizes[m_super->psind] - 1)) && !fs->wired &&
+ (pagesizes[m_super->psind] - 1)) &&
pmap_ps_enabled(fs->map->pmap)) {
flags = PS_ALL_VALID;
if ((fs->prot & VM_PROT_WRITE) != 0) {
@@ -622,7 +622,7 @@
psind = m->psind;
if (psind > 0 && ((vaddr & (pagesizes[psind] - 1)) != 0 ||
pidx + OFF_TO_IDX(pagesizes[psind]) - 1 > pager_last ||
- !pmap_ps_enabled(fs->map->pmap) || fs->wired))
+ !pmap_ps_enabled(fs->map->pmap)))
psind = 0;
npages = atop(pagesizes[psind]);

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 11:27 AM (10 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14534125
Default Alt Text
D41132.id125006.diff (1 KB)

Event Timeline