Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys x86: Move definition of struct pmap to pmap_private.h.
details: https://anonhg.NetBSD.org/src/rev/a50d01d420d2
branches: trunk
changeset: 369534:a50d01d420d2
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Aug 20 23:49:31 2022 +0000
description:
x86: Move definition of struct pmap to pmap_private.h.
This makes pmap_resident_count and pmap_wired_count out-of-line
functions instead of inline. No functional change intended
otherwise.
diffstat:
sys/arch/amd64/amd64/netbsd32_machdep.c | 5 +-
sys/arch/amd64/include/pmap.h | 3 +-
sys/arch/amd64/include/pmap_private.h | 4 +-
sys/arch/i386/i386/compat_16_machdep.c | 5 +-
sys/arch/i386/include/pmap.h | 3 +-
sys/arch/i386/include/pmap_private.h | 4 +-
sys/arch/x86/include/pmap.h | 69 +-------------------------
sys/arch/x86/include/pmap_private.h | 66 ++++++++++++++++++++++++-
sys/arch/x86/x86/pmap.c | 18 ++++++-
sys/arch/x86/x86/sys_machdep.c | 5 +-
sys/external/bsd/drm2/include/linux/shmem_fs.h | 3 +-
11 files changed, 101 insertions(+), 84 deletions(-)
diffs (truncated from 374 to 300 lines):
diff -r 79518809b26d -r a50d01d420d2 sys/arch/amd64/amd64/netbsd32_machdep.c
--- a/sys/arch/amd64/amd64/netbsd32_machdep.c Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/amd64/amd64/netbsd32_machdep.c Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.140 2021/11/06 20:42:56 thorpej Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.141 2022/08/20 23:49:31 riastradh Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.140 2021/11/06 20:42:56 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.141 2022/08/20 23:49:31 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -75,6 +75,7 @@
#include <machine/sysarch.h>
#include <machine/userret.h>
#include <machine/gdt.h>
+#include <machine/pmap_private.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_exec.h>
diff -r 79518809b26d -r a50d01d420d2 sys/arch/amd64/include/pmap.h
--- a/sys/arch/amd64/include/pmap.h Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/amd64/include/pmap.h Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,3 @@
-/* $NetBSD: pmap.h,v 1.68 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: pmap.h,v 1.69 2022/08/20 23:49:31 riastradh Exp $ */
-#define PTP_LEVELS 4
#include <x86/pmap.h>
diff -r 79518809b26d -r a50d01d420d2 sys/arch/amd64/include/pmap_private.h
--- a/sys/arch/amd64/include/pmap_private.h Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/amd64/include/pmap_private.h Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_private.h,v 1.1 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: pmap_private.h,v 1.2 2022/08/20 23:49:31 riastradh Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -175,6 +175,8 @@
#define NBPD_INITIALIZER { NBPD_L1, NBPD_L2, NBPD_L3, NBPD_L4 }
#define PDES_INITIALIZER { L2_BASE, L3_BASE, L4_BASE }
+#define PTP_LEVELS 4
+
/*
* PTE_AVL usage: we make use of the ignored bits of the PTE
*/
diff -r 79518809b26d -r a50d01d420d2 sys/arch/i386/i386/compat_16_machdep.c
--- a/sys/arch/i386/i386/compat_16_machdep.c Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/i386/i386/compat_16_machdep.c Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_16_machdep.c,v 1.33 2021/10/27 04:14:59 thorpej Exp $ */
+/* $NetBSD: compat_16_machdep.c,v 1.34 2022/08/20 23:49:31 riastradh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2000 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.33 2021/10/27 04:14:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: compat_16_machdep.c,v 1.34 2022/08/20 23:49:31 riastradh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -48,6 +48,7 @@
#include <uvm/uvm_extern.h>
#include <machine/pmap.h>
+#include <machine/pmap_private.h>
#include <machine/vmparam.h>
#include <x86/fpu.h>
diff -r 79518809b26d -r a50d01d420d2 sys/arch/i386/include/pmap.h
--- a/sys/arch/i386/include/pmap.h Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/i386/include/pmap.h Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,3 @@
-/* $NetBSD: pmap.h,v 1.128 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: pmap.h,v 1.129 2022/08/20 23:49:31 riastradh Exp $ */
-#define PTP_LEVELS 2
#include <x86/pmap.h>
diff -r 79518809b26d -r a50d01d420d2 sys/arch/i386/include/pmap_private.h
--- a/sys/arch/i386/include/pmap_private.h Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/i386/include/pmap_private.h Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_private.h,v 1.1 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: pmap_private.h,v 1.2 2022/08/20 23:49:31 riastradh Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -241,6 +241,8 @@
#define NBPD_INITIALIZER { NBPD_L1, NBPD_L2 }
#define PDES_INITIALIZER { L2_BASE }
+#define PTP_LEVELS 2
+
/*
* PTE_AVL usage: we make use of the ignored bits of the PTE
*/
diff -r 79518809b26d -r a50d01d420d2 sys/arch/x86/include/pmap.h
--- a/sys/arch/x86/include/pmap.h Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/x86/include/pmap.h Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.133 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: pmap.h,v 1.134 2022/08/20 23:49:31 riastradh Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -68,72 +68,8 @@
#define _X86_PMAP_H_
#if defined(_KERNEL)
-#include <sys/kcpuset.h>
-#include <sys/rwlock.h>
#include <x86/pmap_pv.h>
#include <uvm/pmap/pmap_pvt.h>
-#include <uvm/uvm_object.h>
-
-/*
- * the pmap structure
- *
- * note that the pm_obj contains the lock pointer, the reference count,
- * page list, and number of PTPs within the pmap.
- *
- * pm_lock is the same as the lock for vm object 0. Changes to
- * the other objects may only be made if that lock has been taken
- * (the other object locks are only used when uvm_pagealloc is called)
- */
-
-struct pv_page;
-
-struct pmap {
- struct uvm_object pm_obj[PTP_LEVELS-1];/* objects for lvl >= 1) */
- LIST_ENTRY(pmap) pm_list; /* list of all pmaps */
- pd_entry_t *pm_pdir; /* VA of PD */
- paddr_t pm_pdirpa[PDP_SIZE]; /* PA of PDs (read-only after create) */
- struct vm_page *pm_ptphint[PTP_LEVELS-1];
- /* pointer to a PTP in our pmap */
- struct pmap_statistics pm_stats; /* pmap stats */
- struct pv_entry *pm_pve; /* spare pv_entry */
- LIST_HEAD(, pv_page) pm_pvp_part;
- LIST_HEAD(, pv_page) pm_pvp_empty;
- LIST_HEAD(, pv_page) pm_pvp_full;
-
-#if !defined(__x86_64__)
- vaddr_t pm_hiexec; /* highest executable mapping */
-#endif /* !defined(__x86_64__) */
-
- union descriptor *pm_ldt; /* user-set LDT */
- size_t pm_ldt_len; /* XXX unused, remove */
- int pm_ldt_sel; /* LDT selector */
-
- kcpuset_t *pm_cpus; /* mask of CPUs using pmap */
- kcpuset_t *pm_kernel_cpus; /* mask of CPUs using kernel part
- of pmap */
- kcpuset_t *pm_xen_ptp_cpus; /* mask of CPUs which have this pmap's
- ptp mapped */
- uint64_t pm_ncsw; /* for assertions */
- LIST_HEAD(,vm_page) pm_gc_ptp; /* PTPs queued for free */
-
- /* Used by NVMM and Xen */
- int (*pm_enter)(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int);
- bool (*pm_extract)(struct pmap *, vaddr_t, paddr_t *);
- void (*pm_remove)(struct pmap *, vaddr_t, vaddr_t);
- int (*pm_sync_pv)(struct vm_page *, vaddr_t, paddr_t, int, uint8_t *,
- pt_entry_t *);
- void (*pm_pp_remove_ent)(struct pmap *, struct vm_page *, pt_entry_t,
- vaddr_t);
- void (*pm_write_protect)(struct pmap *, vaddr_t, vaddr_t, vm_prot_t);
- void (*pm_unwire)(struct pmap *, vaddr_t);
-
- void (*pm_tlb_flush)(struct pmap *);
- void *pm_data;
-
- kmutex_t pm_lock /* locks for pm_objs */
- __aligned(64); /* give lock own cache line */
- krwlock_t pm_dummy_lock; /* ugly hack for abusing uvm_object */
-};
/*
* MD flags that we use for pmap_enter and pmap_kenter_pa:
@@ -143,9 +79,6 @@
* macros
*/
-#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
-#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
-
#define pmap_clear_modify(pg) pmap_clear_attrs(pg, PP_ATTRS_D)
#define pmap_clear_reference(pg) pmap_clear_attrs(pg, PP_ATTRS_A)
#define pmap_copy(DP,SP,D,L,S) __USE(L)
diff -r 79518809b26d -r a50d01d420d2 sys/arch/x86/include/pmap_private.h
--- a/sys/arch/x86/include/pmap_private.h Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/x86/include/pmap_private.h Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap_private.h,v 1.1 2022/08/20 23:48:50 riastradh Exp $ */
+/* $NetBSD: pmap_private.h,v 1.2 2022/08/20 23:49:31 riastradh Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -74,13 +74,16 @@
#include <sys/param.h>
#include <sys/types.h>
+#include <sys/kcpuset.h>
#include <sys/mutex.h>
#include <sys/pool.h>
#include <sys/queue.h>
+#include <sys/rwlock.h>
#include <machine/pte.h>
#include <machine/vmparam.h>
+#include <uvm/uvm_object.h>
#include <uvm/uvm_pmap.h>
struct pmap;
@@ -154,6 +157,67 @@
*/
extern struct pool_cache pmap_cache;
+/*
+ * the pmap structure
+ *
+ * note that the pm_obj contains the lock pointer, the reference count,
+ * page list, and number of PTPs within the pmap.
+ *
+ * pm_lock is the same as the lock for vm object 0. Changes to
+ * the other objects may only be made if that lock has been taken
+ * (the other object locks are only used when uvm_pagealloc is called)
+ */
+
+struct pv_page;
+
+struct pmap {
+ struct uvm_object pm_obj[PTP_LEVELS-1];/* objects for lvl >= 1) */
+ LIST_ENTRY(pmap) pm_list; /* list of all pmaps */
+ pd_entry_t *pm_pdir; /* VA of PD */
+ paddr_t pm_pdirpa[PDP_SIZE]; /* PA of PDs (read-only after create) */
+ struct vm_page *pm_ptphint[PTP_LEVELS-1];
+ /* pointer to a PTP in our pmap */
+ struct pmap_statistics pm_stats; /* pmap stats */
+ struct pv_entry *pm_pve; /* spare pv_entry */
+ LIST_HEAD(, pv_page) pm_pvp_part;
+ LIST_HEAD(, pv_page) pm_pvp_empty;
+ LIST_HEAD(, pv_page) pm_pvp_full;
+
+#if !defined(__x86_64__)
+ vaddr_t pm_hiexec; /* highest executable mapping */
+#endif /* !defined(__x86_64__) */
+
+ union descriptor *pm_ldt; /* user-set LDT */
+ size_t pm_ldt_len; /* XXX unused, remove */
+ int pm_ldt_sel; /* LDT selector */
+
+ kcpuset_t *pm_cpus; /* mask of CPUs using pmap */
+ kcpuset_t *pm_kernel_cpus; /* mask of CPUs using kernel part
+ of pmap */
+ kcpuset_t *pm_xen_ptp_cpus; /* mask of CPUs which have this pmap's
+ ptp mapped */
+ uint64_t pm_ncsw; /* for assertions */
+ LIST_HEAD(,vm_page) pm_gc_ptp; /* PTPs queued for free */
+
+ /* Used by NVMM and Xen */
+ int (*pm_enter)(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int);
+ bool (*pm_extract)(struct pmap *, vaddr_t, paddr_t *);
+ void (*pm_remove)(struct pmap *, vaddr_t, vaddr_t);
+ int (*pm_sync_pv)(struct vm_page *, vaddr_t, paddr_t, int, uint8_t *,
+ pt_entry_t *);
+ void (*pm_pp_remove_ent)(struct pmap *, struct vm_page *, pt_entry_t,
+ vaddr_t);
+ void (*pm_write_protect)(struct pmap *, vaddr_t, vaddr_t, vm_prot_t);
+ void (*pm_unwire)(struct pmap *, vaddr_t);
+
+ void (*pm_tlb_flush)(struct pmap *);
+ void *pm_data;
+
+ kmutex_t pm_lock /* locks for pm_objs */
+ __aligned(64); /* give lock own cache line */
+ krwlock_t pm_dummy_lock; /* ugly hack for abusing uvm_object */
+};
+
/* macro to access pm_pdirpa slots */
#ifdef PAE
#define pmap_pdirpa(pmap, index) \
diff -r 79518809b26d -r a50d01d420d2 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Sat Aug 20 23:48:50 2022 +0000
+++ b/sys/arch/x86/x86/pmap.c Sat Aug 20 23:49:31 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.419 2022/08/20 23:48:51 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.420 2022/08/20 23:49:31 riastradh Exp $ */
/*
Home |
Main Index |
Thread Index |
Old Index