diff options
author | Rafal Jaworowski <raj@FreeBSD.org> | 2009-06-05 09:09:46 +0000 |
---|---|---|
committer | Rafal Jaworowski <raj@FreeBSD.org> | 2009-06-05 09:09:46 +0000 |
commit | 29794416db9d20f409d1e8548359845b742822e8 (patch) | |
tree | 2a41d344cb7749168b017ddc4c0578c0b08b223a /sys/powerpc | |
parent | 22da50cfc88081e487465042b96f969349ecb6c5 (diff) | |
download | src-29794416db9d20f409d1e8548359845b742822e8.tar.gz src-29794416db9d20f409d1e8548359845b742822e8.zip |
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
Notes
Notes:
svn path=/head/; revision=193489
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/booke/pmap.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/powerpc/booke/pmap.c b/sys/powerpc/booke/pmap.c index 961836cdeaa7..5eaa2efc9903 100644 --- a/sys/powerpc/booke/pmap.c +++ b/sys/powerpc/booke/pmap.c @@ -966,8 +966,9 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_offset_t kernelend) 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_t start, vm_offset_t kernelend) /* 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; |