From owner-svn-src-head@FreeBSD.ORG Fri Jun 5 09:09:46 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7DD2F1065672; Fri, 5 Jun 2009 09:09:46 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6BD3B8FC1D; Fri, 5 Jun 2009 09:09:46 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5599kNa019893; Fri, 5 Jun 2009 09:09:46 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5599kOe019892; Fri, 5 Jun 2009 09:09:46 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200906050909.n5599kOe019892@svn.freebsd.org> From: Rafal Jaworowski Date: Fri, 5 Jun 2009 09:09:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193489 - head/sys/powerpc/booke X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Jun 2009 09:09:47 -0000 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;