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
This commit is contained in:
Mark Johnston 2020-01-07 15:59:31 +00:00
parent e8bbca1b44
commit f3e982e764
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=356443
4 changed files with 10 additions and 24 deletions

View File

@ -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 */

View File

@ -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"

View File

@ -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"

View File

@ -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;