svn commit: r356443 - in head/sys/i386: i386 include
Mark Johnston
markj at FreeBSD.org
Tue Jan 7 15:59:33 UTC 2020
Author: markj
Date: Tue Jan 7 15:59:31 2020
New Revision: 356443
URL: https://svnweb.freebsd.org/changeset/base/356443
Log:
Define a unified pmap structure for i386.
The overloading of struct pmap for PAE and non-PAE pmaps results in
three distinct layouts for the structure, which is embedded in
struct vmspace. This causes a large number of duplicate structure
definitions in the i386 kernel's CTF type graph.
Since most pmap fields are the same in the two pmaps, simply provide
side-by-side variants of the fields that are distinct, using fixed-size
types.
PR: 242689
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22896
Modified:
head/sys/i386/i386/pmap.c
head/sys/i386/i386/pmap_nopae.c
head/sys/i386/i386/pmap_pae.c
head/sys/i386/include/pmap.h
Modified: head/sys/i386/i386/pmap.c
==============================================================================
--- head/sys/i386/i386/pmap.c Tue Jan 7 15:59:02 2020 (r356442)
+++ head/sys/i386/i386/pmap.c Tue Jan 7 15:59:31 2020 (r356443)
@@ -216,9 +216,6 @@ __FBSDID("$FreeBSD$");
atomic_clear_int((u_int *)(pte), PG_W))
#define pmap_pte_set_prot(pte, v) ((*(int *)pte &= ~PG_PROT), (*(int *)pte |= (v)))
-_Static_assert(sizeof(struct pmap) <= sizeof(struct pmap_KBI),
- "pmap_KBI");
-
static int pgeflag = 0; /* PG_G or-in */
static int pseflag = 0; /* PG_PS or-in */
Modified: head/sys/i386/i386/pmap_nopae.c
==============================================================================
--- head/sys/i386/i386/pmap_nopae.c Tue Jan 7 15:59:02 2020 (r356442)
+++ head/sys/i386/i386/pmap_nopae.c Tue Jan 7 15:59:31 2020 (r356443)
@@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_param.h>
#define PMTYPE pmap_nopae_
+#define pm_pdir pm_pdir_nopae
#include <machine/pmap_nopae.h>
#include <vm/pmap.h>
-_Static_assert(sizeof(struct pmap_KBI) >= sizeof(struct pmap), "pmap KBI");
#include "pmap.c"
Modified: head/sys/i386/i386/pmap_pae.c
==============================================================================
--- head/sys/i386/i386/pmap_pae.c Tue Jan 7 15:59:02 2020 (r356442)
+++ head/sys/i386/i386/pmap_pae.c Tue Jan 7 15:59:31 2020 (r356443)
@@ -43,7 +43,8 @@ __FBSDID("$FreeBSD$");
#include <vm/vm.h>
#include <vm/vm_param.h>
#define PMTYPE pmap_pae_
+#define pm_pdir pm_pdir_pae
+#define pm_pdpt pm_pdpt_pae
#include <machine/pmap_pae.h>
#include <vm/pmap.h>
-_Static_assert(sizeof(struct pmap_KBI) >= sizeof(struct pmap), "pmap KBI");
#include "pmap.c"
Modified: head/sys/i386/include/pmap.h
==============================================================================
--- head/sys/i386/include/pmap.h Tue Jan 7 15:59:02 2020 (r356442)
+++ head/sys/i386/include/pmap.h Tue Jan 7 15:59:31 2020 (r356443)
@@ -166,30 +166,18 @@ struct md_page {
int pat_mode;
};
-#define PMAP_EXTERN_FIELDS \
- cpuset_t pm_active; /* active on cpus */ \
- struct mtx pm_mtx; \
- struct pmap_statistics pm_stats; /* pmap statistics */
-
-struct pmap_KBI {
- PMAP_EXTERN_FIELDS
- int32_t pm_fill[32];
-};
-
-#ifdef PMTYPE
struct pmap {
- PMAP_EXTERN_FIELDS
- pd_entry_t *pm_pdir; /* KVA of page directory */
+ cpuset_t pm_active; /* active on cpus */
+ struct mtx pm_mtx;
+ struct pmap_statistics pm_stats; /* pmap statistics */
+ uint32_t *pm_pdir_nopae; /* KVA of page directory */
+ uint64_t *pm_pdir_pae;
TAILQ_HEAD(,pv_chunk) pm_pvchunk; /* list of mappings in pmap */
LIST_ENTRY(pmap) pm_list; /* List of all pmaps */
- pdpt_entry_t *pm_pdpt; /* KVA of page directory pointer
- table */
+ uint64_t *pm_pdpt_pae;
struct vm_radix pm_root; /* spare page table pages */
- vm_page_t pm_ptdpg[NPGPTD];
+ vm_page_t pm_ptdpg[4]; /* PAE NPGPTD */
};
-#else
-#define pmap pmap_KBI
-#endif
typedef struct pmap *pmap_t;
More information about the svn-src-all
mailing list