Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F143896888
D36885.id111467.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36885.id111467.diff
View Options
diff --git a/sys/riscv/riscv/pmap.c b/sys/riscv/riscv/pmap.c
--- a/sys/riscv/riscv/pmap.c
+++ b/sys/riscv/riscv/pmap.c
@@ -3146,6 +3146,24 @@
PMAP_ENTER_NOREPLACE | PMAP_ENTER_NORECLAIM, NULL, lockp));
}
+/*
+ * Returns true if every page table entry in the specified page table is
+ * zero.
+ */
+static bool
+pmap_every_pte_zero(vm_paddr_t pa)
+{
+ pt_entry_t *pt_end, *pte;
+
+ KASSERT((pa & PAGE_MASK) == 0, ("pa is misaligned"));
+ pte = (pt_entry_t *)PHYS_TO_DMAP(pa);
+ for (pt_end = pte + Ln_ENTRIES; pte < pt_end; pte++) {
+ if (*pte != 0)
+ return (false);
+ }
+ return (true);
+}
+
/*
* Tries to create the specified 2MB page mapping. Returns KERN_SUCCESS if
* the mapping was created, and one of KERN_FAILURE, KERN_NO_SPACE, or
@@ -3191,7 +3209,8 @@
"pmap_enter_l2: no space for va %#lx"
" in pmap %p", va, pmap);
return (KERN_NO_SPACE);
- } else {
+ } else if (va < VM_MAXUSER_ADDRESS ||
+ !pmap_every_pte_zero(L2PTE_TO_PHYS(oldl2))) {
CTR2(KTR_PMAP, "pmap_enter_l2:"
" failed to replace existing mapping"
" for va %#lx in pmap %p", va, pmap);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Feb 2, 4:16 PM (7 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28414977
Default Alt Text
D36885.id111467.diff (1 KB)
Attached To
Mode
D36885: riscv: handle kernel PTE edge-case in pmap_enter_l2()
Attached
Detach File
Event Timeline
Log In to Comment