Add pmap_clear_write() to the interface between the virtual memory
system's machine-dependent and machine-independent layers. Once pmap_clear_write() is implemented on all of our supported architectures, I intend to replace all calls to pmap_page_protect() by calls to pmap_clear_write(). Why? Both the use and implementation of pmap_page_protect() in our virtual memory system has subtle errors, specifically, the management of execute permission is broken on some architectures. The "prot" argument to pmap_page_protect() should behave differently from the "prot" argument to other pmap functions. Instead of meaning, "give the specified access rights to all of the physical page's mappings," it means "don't take away the specified access rights from all of the physical page's mappings, but do take away the ones that aren't specified." However, owing to our i386 legacy, i.e., no support for no-execute rights, all but one invocation of pmap_page_protect() specifies VM_PROT_READ only, when the intent is, in fact, to remove only write permission. Consequently, a faithful implementation of pmap_page_protect(), e.g., ia64, would remove execute permission as well as write permission. On the other hand, some architectures that support execute permission have basically ignored whether or not VM_PROT_EXECUTE is passed to pmap_page_protect(), e.g., amd64 and sparc64. This change represents the first step in replacing pmap_page_protect() by the less subtle pmap_clear_write() that is already implemented on amd64, i386, and sparc64. Discussed with: grehan@ and marcel@
This commit is contained in:
parent
ca3a4056ad
commit
3cad40e517
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160525
@ -207,7 +207,6 @@ static caddr_t crashdumpmap;
|
||||
|
||||
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
||||
static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
|
||||
static void pmap_clear_write(vm_page_t m);
|
||||
|
||||
static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
|
||||
vm_page_t m, vm_prot_t prot, vm_page_t mpte);
|
||||
@ -2972,7 +2971,7 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
|
||||
/*
|
||||
* Clear the write and modified bits in each of the given page's mappings.
|
||||
*/
|
||||
static __inline void
|
||||
void
|
||||
pmap_clear_write(vm_page_t m)
|
||||
{
|
||||
pv_entry_t pv;
|
||||
|
@ -266,7 +266,6 @@ static struct mtx PMAP2mutex;
|
||||
|
||||
static void free_pv_entry(pmap_t pmap, pv_entry_t pv);
|
||||
static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
|
||||
static void pmap_clear_write(vm_page_t m);
|
||||
|
||||
static vm_page_t pmap_enter_quick_locked(pmap_t pmap, vm_offset_t va,
|
||||
vm_page_t m, vm_prot_t prot, vm_page_t mpte);
|
||||
@ -3066,7 +3065,7 @@ pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr)
|
||||
/*
|
||||
* Clear the write and modified bits in each of the given page's mappings.
|
||||
*/
|
||||
static __inline void
|
||||
void
|
||||
pmap_clear_write(vm_page_t m)
|
||||
{
|
||||
pv_entry_t pv;
|
||||
|
@ -95,8 +95,6 @@ int pmap_protect_tte(struct pmap *pm1, struct pmap *pm2, struct tte *tp,
|
||||
|
||||
void pmap_map_tsb(void);
|
||||
|
||||
void pmap_clear_write(vm_page_t m);
|
||||
|
||||
#define vtophys(va) pmap_kextract((vm_offset_t)(va))
|
||||
|
||||
extern struct pmap kernel_pmap_store;
|
||||
|
@ -93,6 +93,7 @@ extern vm_offset_t kernel_vm_end;
|
||||
void pmap_change_wiring(pmap_t, vm_offset_t, boolean_t);
|
||||
void pmap_clear_modify(vm_page_t m);
|
||||
void pmap_clear_reference(vm_page_t m);
|
||||
void pmap_clear_write(vm_page_t m);
|
||||
void pmap_copy(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t);
|
||||
void pmap_copy_page(vm_page_t, vm_page_t);
|
||||
void pmap_enter(pmap_t, vm_offset_t, vm_page_t, vm_prot_t,
|
||||
|
Loading…
Reference in New Issue
Block a user