aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/include
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2022-10-07 17:14:03 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2022-10-07 17:14:03 +0000
commit4d90a5afc51b520c3c256ee7c03ed539e71e97e4 (patch)
tree271f132e90397ca64e9b583c97fe571c98fda30a /sys/amd64/include
parent61ab88d873301f8cec91729a312c322e11422f46 (diff)
downloadsrc-4d90a5afc51b520c3c256ee7c03ed539e71e97e4.tar.gz
src-4d90a5afc51b520c3c256ee7c03ed539e71e97e4.zip
sys: Consolidate common implementation details of PV entries.
Add a <sys/_pv_entry.h> intended for use in <machine/pmap.h> to define struct pv_entry, pv_chunk, and related macros and inline functions. Note that powerpc does not yet use this as while the mmu_radix pmap in powerpc uses the new scheme (albeit with fewer PV entries in a chunk than normal due to an used pv_pmap field in struct pv_entry), the Book-E pmaps for powerpc use the older style PV entries without chunks (and thus require the pv_pmap field). Suggested by: kib Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D36685
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/pmap.h37
1 files changed, 1 insertions, 36 deletions
diff --git a/sys/amd64/include/pmap.h b/sys/amd64/include/pmap.h
index c92c09db22a9..a55a14f94ed7 100644
--- a/sys/amd64/include/pmap.h
+++ b/sys/amd64/include/pmap.h
@@ -291,6 +291,7 @@
#include <sys/_lock.h>
#include <sys/_mutex.h>
#include <sys/_pctrie.h>
+#include <sys/_pv_entry.h>
#include <sys/_rangeset.h>
#include <sys/_smr.h>
@@ -353,8 +354,6 @@ extern pt_entry_t pg_nx;
/*
* Pmap stuff
*/
-struct pv_entry;
-struct pv_chunk;
/*
* Locks
@@ -424,40 +423,6 @@ extern struct pmap kernel_pmap_store;
int pmap_pinit_type(pmap_t pmap, enum pmap_type pm_type, int flags);
int pmap_emulate_accessed_dirty(pmap_t pmap, vm_offset_t va, int ftype);
-#endif
-
-/*
- * For each vm_page_t, there is a list of all currently valid virtual
- * mappings of that page. An entry is a pv_entry_t, the list is pv_list.
- */
-typedef struct pv_entry {
- vm_offset_t pv_va; /* virtual address for mapping */
- TAILQ_ENTRY(pv_entry) pv_next;
-} *pv_entry_t;
-
-/*
- * pv_entries are allocated in chunks per-process. This avoids the
- * need to track per-pmap assignments.
- */
-#define _NPCPV 168
-#define _NPCM howmany(_NPCPV, 64)
-
-#define PV_CHUNK_HEADER \
- pmap_t pc_pmap; \
- TAILQ_ENTRY(pv_chunk) pc_list; \
- uint64_t pc_map[_NPCM]; /* bitmap; 1 = free */ \
- TAILQ_ENTRY(pv_chunk) pc_lru;
-
-struct pv_chunk_header {
- PV_CHUNK_HEADER
-};
-
-struct pv_chunk {
- PV_CHUNK_HEADER
- struct pv_entry pc_pventry[_NPCPV];
-};
-
-#ifdef _KERNEL
extern caddr_t CADDR1;
extern pt_entry_t *CMAP1;