Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch clean up a little
details: https://anonhg.NetBSD.org/src/rev/49fe801fa0ba
branches: trunk
changeset: 366496:49fe801fa0ba
user: maxv <maxv%NetBSD.org@localhost>
date: Wed Aug 29 16:26:25 2018 +0000
description:
clean up a little
diffstat:
sys/arch/amd64/amd64/machdep.c | 5 +-
sys/arch/x86/include/pmap.h | 3 +-
sys/arch/x86/x86/pmap.c | 302 +++++++++-------------------------------
3 files changed, 76 insertions(+), 234 deletions(-)
diffs (truncated from 876 to 300 lines):
diff -r c63e3cf20ca3 -r 49fe801fa0ba sys/arch/amd64/amd64/machdep.c
--- a/sys/arch/amd64/amd64/machdep.c Wed Aug 29 15:52:27 2018 +0000
+++ b/sys/arch/amd64/amd64/machdep.c Wed Aug 29 16:26:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.317 2018/08/29 06:17:26 maxv Exp $ */
+/* $NetBSD: machdep.c,v 1.318 2018/08/29 16:26:25 maxv Exp $ */
/*
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.317 2018/08/29 06:17:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.318 2018/08/29 16:26:25 maxv Exp $");
#include "opt_modular.h"
#include "opt_user_ldt.h"
@@ -1610,7 +1610,6 @@
void __noasan
init_slotspace(void)
{
- vaddr_t slotspace_rand(int, size_t, size_t);
vaddr_t va;
memset(&slotspace, 0, sizeof(slotspace));
diff -r c63e3cf20ca3 -r 49fe801fa0ba sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h Wed Aug 29 15:52:27 2018 +0000
+++ b/sys/arch/x86/include/pmap.h Wed Aug 29 16:26:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.87 2018/08/29 06:28:50 maxv Exp $ */
+/* $NetBSD: pmap.h,v 1.88 2018/08/29 16:26:25 maxv Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -357,6 +357,7 @@
#ifndef __HAVE_DIRECT_MAP
void pmap_vpage_cpu_init(struct cpu_info *);
#endif
+vaddr_t slotspace_rand(int, size_t, size_t);
vaddr_t reserve_dumppages(vaddr_t); /* XXX: not a pmap fn */
diff -r c63e3cf20ca3 -r 49fe801fa0ba sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Wed Aug 29 15:52:27 2018 +0000
+++ b/sys/arch/x86/x86/pmap.c Wed Aug 29 16:26:25 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.306 2018/08/29 06:17:26 maxv Exp $ */
+/* $NetBSD: pmap.c,v 1.307 2018/08/29 16:26:25 maxv Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -70,31 +70,6 @@
*/
/*
- * Copyright (c) 1997 Charles D. Cranor and Washington University.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
* Copyright 2001 (c) Wasabi Systems, Inc.
* All rights reserved.
*
@@ -130,34 +105,32 @@
*/
/*
- * pmap.c: i386 pmap module rewrite
- * Chuck Cranor <chuck@netbsd>
- * 11-Aug-97
- *
- * history of this pmap module: in addition to my own input, i used
- * the following references for this rewrite of the i386 pmap:
+ * Copyright (c) 1997 Charles D. Cranor and Washington University.
+ * All rights reserved.
*
- * [1] the NetBSD i386 pmap. this pmap appears to be based on the
- * BSD hp300 pmap done by Mike Hibler at University of Utah.
- * it was then ported to the i386 by William Jolitz of UUNET
- * Technologies, Inc. Then Charles M. Hannum of the NetBSD
- * project fixed some bugs and provided some speed ups.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
*
- * [2] the FreeBSD i386 pmap. this pmap seems to be the
- * Hibler/Jolitz pmap, as modified for FreeBSD by John S. Dyson
- * and David Greenman.
- *
- * [3] the Mach pmap. this pmap, from CMU, seems to have migrated
- * between several processors. the VAX version was done by
- * Avadis Tevanian, Jr., and Michael Wayne Young. the i386
- * version was done by Lance Berc, Mike Kupfer, Bob Baron,
- * David Golub, and Richard Draves. the alpha version was
- * done by Alessandro Forin (CMU/Mach) and Chris Demetriou
- * (NetBSD/alpha).
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.306 2018/08/29 06:17:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.307 2018/08/29 16:26:25 maxv Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -203,7 +176,7 @@
/*
* general info:
*
- * - for an explanation of how the i386 MMU hardware works see
+ * - for an explanation of how the x86 MMU hardware works see
* the comments in <machine/pte.h>.
*
* - for an explanation of the general memory structure used by
@@ -236,69 +209,33 @@
*
* - struct pmap: describes the address space of one thread
* - struct pmap_page: describes one pv-tracked page, without
- * necessarily a corresponding vm_page
+ * necessarily a corresponding vm_page
* - struct pv_entry: describes one <PMAP,VA> mapping of a PA
* - struct pv_head: there is one pv_head per pv-tracked page of
- * physical memory. the pv_head points to a list of pv_entry
- * structures which describe all the <PMAP,VA> pairs that this
- * page is mapped in. this is critical for page based operations
- * such as pmap_page_protect() [change protection on _all_ mappings
- * of a page]
+ * physical memory. the pv_head points to a list of pv_entry
+ * structures which describe all the <PMAP,VA> pairs that this
+ * page is mapped in. this is critical for page based operations
+ * such as pmap_page_protect() [change protection on _all_ mappings
+ * of a page]
*/
/*
- * memory allocation
- *
- * - there are three data structures that we must dynamically allocate:
- *
- * [A] new process' page directory page (PDP)
- * - plan 1: done at pmap_create() we use
- * uvm_km_alloc(kernel_map, PAGE_SIZE) [fka kmem_alloc] to do this
- * allocation.
- *
- * if we are low in free physical memory then we sleep in
- * uvm_km_alloc -- in this case this is ok since we are creating
- * a new pmap and should not be holding any locks.
- *
- * if the kernel is totally out of virtual space
- * (i.e. uvm_km_alloc returns NULL), then we panic.
+ * Locking
*
- * [B] new page tables pages (PTP)
- * - call uvm_pagealloc()
- * => success: zero page, add to pm_pdir
- * => failure: we are out of free vm_pages, let pmap_enter()
- * tell UVM about it.
- *
- * note: for kernel PTPs, we start with NKPTP of them. as we map
- * kernel memory (at uvm_map time) we check to see if we've grown
- * the kernel pmap. if so, we call the optional function
- * pmap_growkernel() to grow the kernel PTPs in advance.
- *
- * [C] pv_entry structures
- */
-
-/*
- * locking
- *
- * we have the following locks that we must contend with:
- *
- * mutexes:
+ * We have the following locks that we must contend with:
*
* - pmap lock (per pmap, part of uvm_object)
- * this lock protects the fields in the pmap structure including
- * the non-kernel PDEs in the PDP, and the PTEs. it also locks
- * in the alternate PTE space (since that is determined by the
- * entry in the PDP).
+ * This lock protects the fields in the pmap structure including the
+ * non-kernel PDEs in the PDP, and the PTEs.
*
* - pvh_lock (per pv_head)
- * this lock protects the pv_entry list which is chained off the
- * pv_head structure for a specific pv-tracked PA. it is locked
- * when traversing the list (e.g. adding/removing mappings,
- * syncing R/M bits, etc.)
+ * This lock protects the pv_entry list which is chained off the pv_head
+ * structure for a specific pv-tracked PA. It is locked when traversing
+ * the list (e.g. adding/removing mappings, syncing R/M bits, etc).
*
* - pmaps_lock
- * this lock protects the list of active pmaps (headed by "pmaps").
- * we lock it when adding or removing pmaps from this list.
+ * This lock protects the list of active pmaps (headed by "pmaps"). We
+ * lock it when adding or removing pmaps from this list.
*/
const vaddr_t ptp_masks[] = PTP_MASK_INITIALIZER;
@@ -367,30 +304,15 @@
struct bootspace bootspace __read_mostly;
struct slotspace slotspace __read_mostly;
-/*
- * pmap_pg_nx: if our processor supports PG_NX in the PTE then we
- * set pmap_pg_nx to PG_NX (otherwise it is zero).
- */
+/* Set to PG_NX if supported. */
pd_entry_t pmap_pg_nx __read_mostly = 0;
-/*
- * pmap_pg_g: if our processor supports PG_G in the PTE then we
- * set pmap_pg_g to PG_G (otherwise it is zero).
- */
+/* Set to PG_G if supported. */
pd_entry_t pmap_pg_g __read_mostly = 0;
-/*
- * pmap_largepages: if our processor supports PG_PS and we are
- * using it, this is set to true.
- */
+/* Set to true if large pages are supported. */
int pmap_largepages __read_mostly = 0;
-/*
- * i386 physical memory comes in a big contig chunk with a small
- * hole toward the front of it... the following two paddr_t's
- * (shared with machdep.c) describe the physical address space
- * of this machine.
- */
paddr_t lowmem_rsvd __read_mostly;
paddr_t avail_start __read_mostly; /* PA of first available physical page */
paddr_t avail_end __read_mostly; /* PA of last available physical page */
@@ -535,8 +457,6 @@
extern vaddr_t ldt_vaddr;
extern paddr_t ldt_paddr;
-extern int end;
-
#ifdef i386
/* stuff to fix the pentium f00f bug */
extern vaddr_t pentium_idt_vaddr;
@@ -608,7 +528,6 @@
/*
* ptp_to_pmap: lookup pmap by ptp
*/
-
static struct pmap *
ptp_to_pmap(struct vm_page *ptp)
{
@@ -643,7 +562,6 @@
/*
* pv_pte_first, pv_pte_next: PV list iterator.
*/
-
static struct pv_pte *
pv_pte_first(struct pmap_page *pp)
{
@@ -669,20 +587,14 @@
/*
* pmap_is_curpmap: is this pmap the one currently loaded [in %cr3]?
- * of course the kernel is always loaded
+ * of course the kernel is always loaded
*/
Home |
Main Index |
Thread Index |
Old Index