Pay attention to "access_type" in pmap_enter().

This commit is contained in:
thorpej 1999-03-27 02:48:32 +00:00
parent e75fc73f95
commit b69d0d9e89
1 changed files with 16 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.86 1999/03/26 23:41:26 mycroft Exp $ */
/* $NetBSD: pmap.c,v 1.87 1999/03/27 02:48:32 thorpej Exp $ */
/*-
* Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@ -155,7 +155,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 1999/03/26 23:41:26 mycroft Exp $");
__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 1999/03/27 02:48:32 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1773,6 +1773,20 @@ pmap_enter(pmap, va, pa, prot, wired, access_type)
if (managed) {
struct pv_head *pvh = pa_to_pvh(pa);
/*
* An obvious question here is why a page would be entered in
* response to a fault, but with permissions less than those
* requested. This can happen in the case of a copy-on-write
* page that's not currently mapped being accessed; the first
* fault will map the original page read-only, and another
* fault will be taken to do the copy and make it read-write.
*/
access_type &= prot;
if (access_type & VM_PROT_WRITE)
pvh->pvh_attrs |= (PGA_REFERENCED|PGA_MODIFIED);
else if (access_type & VM_PROT_ALL)
pvh->pvh_attrs |= PGA_REFERENCED;
/*
* Set up referenced/modified emulation for new mapping.
*/