From owner-svn-src-stable@freebsd.org Wed Sep 28 09:41:02 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 44C3FC00EA2; Wed, 28 Sep 2016 09:41:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1C068DD2; Wed, 28 Sep 2016 09:41:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8S9f1Gs077878; Wed, 28 Sep 2016 09:41:01 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8S9f17L077876; Wed, 28 Sep 2016 09:41:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201609280941.u8S9f17L077876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 28 Sep 2016 09:41:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306401 - in stable/11/sys/amd64: amd64 include X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2016 09:41:02 -0000 Author: kib Date: Wed Sep 28 09:41:00 2016 New Revision: 306401 URL: https://svnweb.freebsd.org/changeset/base/306401 Log: MFC r306087: Export the pmap_cache_bits() and pmap_pinit_pml4() functions from the amd64 pmap. Modified: stable/11/sys/amd64/amd64/pmap.c stable/11/sys/amd64/include/pmap.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/amd64/pmap.c ============================================================================== --- stable/11/sys/amd64/amd64/pmap.c Wed Sep 28 09:36:03 2016 (r306400) +++ stable/11/sys/amd64/amd64/pmap.c Wed Sep 28 09:41:00 2016 (r306401) @@ -1324,7 +1324,7 @@ pmap_swap_pat(pmap_t pmap, pt_entry_t en * Determine the appropriate bits to set in a PTE or PDE for a specified * caching mode. */ -static int +int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde) { int cache_bits, pat_flag, pat_idx; @@ -2345,6 +2345,29 @@ pmap_pinit0(pmap_t pmap) CPU_FILL(&kernel_pmap->pm_active); } +void +pmap_pinit_pml4(vm_page_t pml4pg) +{ + pml4_entry_t *pm_pml4; + int i; + + pm_pml4 = (pml4_entry_t *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(pml4pg)); + + /* Wire in kernel global address entries. */ + for (i = 0; i < NKPML4E; i++) { + pm_pml4[KPML4BASE + i] = (KPDPphys + ptoa(i)) | X86_PG_RW | + X86_PG_V | PG_U; + } + for (i = 0; i < ndmpdpphys; i++) { + pm_pml4[DMPML4I + i] = (DMPDPphys + ptoa(i)) | X86_PG_RW | + X86_PG_V | PG_U; + } + + /* install self-referential address mapping entry(s) */ + pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | X86_PG_V | X86_PG_RW | + X86_PG_A | X86_PG_M; +} + /* * Initialize a preallocated and zeroed pmap structure, * such as one in a vmspace structure. @@ -2381,20 +2404,7 @@ pmap_pinit_type(pmap_t pmap, enum pmap_t */ if ((pmap->pm_type = pm_type) == PT_X86) { pmap->pm_cr3 = pml4phys; - - /* Wire in kernel global address entries. */ - for (i = 0; i < NKPML4E; i++) { - pmap->pm_pml4[KPML4BASE + i] = (KPDPphys + ptoa(i)) | - X86_PG_RW | X86_PG_V | PG_U; - } - for (i = 0; i < ndmpdpphys; i++) { - pmap->pm_pml4[DMPML4I + i] = (DMPDPphys + ptoa(i)) | - X86_PG_RW | X86_PG_V | PG_U; - } - - /* install self-referential address mapping entry(s) */ - pmap->pm_pml4[PML4PML4I] = VM_PAGE_TO_PHYS(pml4pg) | - X86_PG_V | X86_PG_RW | X86_PG_A | X86_PG_M; + pmap_pinit_pml4(pml4pg); } pmap->pm_root.rt_root = 0; Modified: stable/11/sys/amd64/include/pmap.h ============================================================================== --- stable/11/sys/amd64/include/pmap.h Wed Sep 28 09:36:03 2016 (r306400) +++ stable/11/sys/amd64/include/pmap.h Wed Sep 28 09:41:00 2016 (r306401) @@ -391,6 +391,7 @@ struct thread; void pmap_activate_sw(struct thread *); void pmap_bootstrap(vm_paddr_t *); +int pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); int pmap_change_attr(vm_offset_t, vm_size_t, int); void pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); void pmap_init_pat(void); @@ -403,6 +404,7 @@ void *pmap_mapdev(vm_paddr_t, vm_size_t) void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); boolean_t pmap_page_is_mapped(vm_page_t m); void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); +void pmap_pinit_pml4(vm_page_t); void pmap_unmapdev(vm_offset_t, vm_size_t); void pmap_invalidate_page(pmap_t, vm_offset_t); void pmap_invalidate_range(pmap_t, vm_offset_t, vm_offset_t);