Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/arch/x86/include/pmap.h,v rcsdiff: /ftp/cvs/cvsroot/src/sys/arch/x86/include/pmap.h,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.55 retrieving revision 1.55.4.3 diff -u -p -r1.55 -r1.55.4.3 --- src/sys/arch/x86/include/pmap.h 2013/10/17 20:59:16 1.55 +++ src/sys/arch/x86/include/pmap.h 2017/03/06 03:27:19 1.55.4.3 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.55 2013/10/17 20:59:16 christos Exp $ */ +/* $NetBSD: pmap.h,v 1.55.4.3 2017/03/06 03:27:19 snj Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -179,15 +179,7 @@ struct pmap { ((pmap)->pm_pdirpa[0] + (index) * sizeof(pd_entry_t)) #endif -/* - * flag to be used for kernel mappings: PG_u on Xen/amd64, - * 0 otherwise. - */ -#if defined(XEN) && defined(__x86_64__) -#define PG_k PG_u -#else #define PG_k 0 -#endif /* * MD flags that we use for pmap_enter and pmap_kenter_pa: @@ -243,8 +235,10 @@ extern long nkptp[PTP_LEVELS]; void pmap_activate(struct lwp *); void pmap_bootstrap(vaddr_t); bool pmap_clear_attrs(struct vm_page *, unsigned); +bool pmap_pv_clear_attrs(paddr_t, unsigned); void pmap_deactivate(struct lwp *); -void pmap_page_remove (struct vm_page *); +void pmap_page_remove(struct vm_page *); +void pmap_pv_remove(paddr_t); void pmap_remove(struct pmap *, vaddr_t, vaddr_t); bool pmap_test_attrs(struct vm_page *, unsigned); void pmap_write_protect(struct pmap *, vaddr_t, vaddr_t, vm_prot_t); @@ -258,6 +252,11 @@ void pmap_emap_enter(vaddr_t, paddr_t, void pmap_emap_remove(vaddr_t, vsize_t); void pmap_emap_sync(bool); +#define __HAVE_PMAP_PV_TRACK 1 +void pmap_pv_init(void); +void pmap_pv_track(paddr_t, psize_t); +void pmap_pv_untrack(paddr_t, psize_t); + void pmap_map_ptes(struct pmap *, struct pmap **, pd_entry_t **, pd_entry_t * const **); void pmap_unmap_ptes(struct pmap *, struct pmap *); @@ -359,6 +358,23 @@ pmap_page_protect(struct vm_page *pg, vm } /* + * pmap_pv_protect: change the protection of all recorded mappings + * of an unmanaged page + */ + +__inline static void __unused +pmap_pv_protect(paddr_t pa, vm_prot_t prot) +{ + if ((prot & VM_PROT_WRITE) == 0) { + if (prot & (VM_PROT_READ|VM_PROT_EXECUTE)) { + (void) pmap_pv_clear_attrs(pa, PG_RW); + } else { + pmap_pv_remove(pa); + } + } +} + +/* * pmap_protect: change the protection of pages in a pmap * * => this function is a frontend for pmap_remove/pmap_write_protect @@ -455,6 +471,7 @@ void pmap_kenter_ma(vaddr_t, paddr_t, vm int pmap_enter_ma(struct pmap *, vaddr_t, paddr_t, paddr_t, vm_prot_t, u_int, int); bool pmap_extract_ma(pmap_t, vaddr_t, paddr_t *); +void pmap_free_ptps(struct vm_page *); /* * Hooks for the pool allocator.