svn commit: r193489 - head/sys/powerpc/booke
Rafal Jaworowski
raj at FreeBSD.org
Fri Jun 5 09:09:47 UTC 2009
Author: raj
Date: Fri Jun 5 09:09:46 2009
New Revision: 193489
URL: http://svn.freebsd.org/changeset/base/193489
Log:
Fill PTEs covering kernel code and data.
Without this fix pte_vatopa() was not able to retrieve physical address of
data structures inside kernel, for example EFAULT was reported while acessing
/dev/kmem ('netstat -nr').
Submitted by: Piotr Ziecik
Obtained from: Semihalf
Modified:
head/sys/powerpc/booke/pmap.c
Modified: head/sys/powerpc/booke/pmap.c
==============================================================================
--- head/sys/powerpc/booke/pmap.c Fri Jun 5 09:08:53 2009 (r193488)
+++ head/sys/powerpc/booke/pmap.c Fri Jun 5 09:09:46 2009 (r193489)
@@ -966,8 +966,9 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset
u_int s, e, sz;
u_int phys_avail_count;
vm_size_t physsz, hwphyssz, kstack0_sz;
- vm_offset_t kernel_pdir, kstack0;
+ vm_offset_t kernel_pdir, kstack0, va;
vm_paddr_t kstack0_phys;
+ pte_t *pte;
debugf("mmu_booke_bootstrap: entered\n");
@@ -1216,6 +1217,19 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset
/* Initialize each CPU's tidbusy entry 0 with kernel_pmap */
tidbusy[i][0] = kernel_pmap;
}
+
+ /*
+ * Fill in PTEs covering kernel code and data. They are not required
+ * for address translation, as this area is covered by static TLB1
+ * entries, but for pte_vatopa() to work correctly with kernel area
+ * addresses.
+ */
+ for (va = KERNBASE; va < data_end; va += PAGE_SIZE) {
+ pte = &(kernel_pmap->pm_pdir[PDIR_IDX(va)][PTBL_IDX(va)]);
+ pte->rpn = kernload + (va - KERNBASE);
+ pte->flags = PTE_M | PTE_SR | PTE_SW | PTE_SX | PTE_WIRED |
+ PTE_VALID;
+ }
/* Mark kernel_pmap active on all CPUs */
kernel_pmap->pm_active = ~0;
More information about the svn-src-head
mailing list