Page MenuHomeFreeBSD

D34267.diff
No OneTemporary

D34267.diff

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
@@ -1231,12 +1231,20 @@
CPU_ZERO(&pmap->pm_active);
+ /*
+ * Copy L1 entries from the kernel pmap. This must be done with the
+ * allpmaps lock held to avoid races with pmap_distribute_l1().
+ */
mtx_lock(&allpmaps_lock);
LIST_INSERT_HEAD(&allpmaps, pmap, pm_list);
+ for (size_t i = pmap_l1_index(VM_MIN_KERNEL_ADDRESS);
+ i < pmap_l1_index(VM_MAX_KERNEL_ADDRESS); i++)
+ pmap->pm_l1[i] = kernel_pmap->pm_l1[i];
+ for (size_t i = pmap_l1_index(DMAP_MIN_ADDRESS);
+ i < pmap_l1_index(DMAP_MAX_ADDRESS); i++)
+ pmap->pm_l1[i] = kernel_pmap->pm_l1[i];
mtx_unlock(&allpmaps_lock);
- memcpy(pmap->pm_l1, kernel_pmap->pm_l1, PAGE_SIZE);
-
vm_radix_init(&pmap->pm_root);
return (1);

File Metadata

Mime Type
text/plain
Expires
Mon, Jan 13, 11:57 PM (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15788912
Default Alt Text
D34267.diff (831 B)

Event Timeline