Subject: Re: new pmap
To: UCHIYAMA Yasushi <uch@vnop.net>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: port-sh3
Date: 05/09/2002 20:05:03
--3CAnR4CLEnEWqRMR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Thu, May 09, 2002 at 11:00:50PM +0900, UCHIYAMA Yasushi wrote:
UCHIYAMA-san...
> Thank you for advice. I have fixed pmap_enter(), pmap_is_referenced()
> and __pmap_pte_load. I'm now investigating the other.
I think there is still a problem with the handling of mod/ref in your
new pmap. Please take a look at the following patch. This is how I
think it should work.
If you agree, I'll go ahead and commit the patch.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
--3CAnR4CLEnEWqRMR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=pmap-patch
Index: pmap.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sh3/sh3/pmap.c,v
retrieving revision 1.40
diff -c -r1.40 pmap.c
*** pmap.c 2002/05/09 12:28:08 1.40
--- pmap.c 2002/05/10 02:38:06
***************
*** 331,357 ****
pvh = &pg->mdpage;
entry |= PG_C; /* always cached */
! /* Modified/reference tracking */
! if (flags & VM_PROT_WRITE) {
! entry |= PG_V | PG_D;
pvh->pvh_flags |= PVH_MODIFIED | PVH_REFERENCED;
! } else if (flags & VM_PROT_ALL) {
! entry |= PG_V;
pvh->pvh_flags |= PVH_REFERENCED;
- }
/* Protection */
! if ((prot & VM_PROT_WRITE) && (pvh->pvh_flags & PVH_MODIFIED)) {
! if (kva)
! entry |= PG_PR_KRW | PG_SH;
! else
! entry |= PG_PR_URW;
} else {
! /* RO, COW page */
! if (kva)
! entry |= PG_PR_KRO | PG_SH;
! else
! entry |= PG_PR_URO;
}
/* Check for existing mapping */
--- 331,361 ----
pvh = &pg->mdpage;
entry |= PG_C; /* always cached */
! /* Seed mod/ref for this page based on flags. */
! if (flags & VM_PROT_WRITE)
pvh->pvh_flags |= PVH_MODIFIED | PVH_REFERENCED;
! else if (flags & VM_PROT_ALL)
pvh->pvh_flags |= PVH_REFERENCED;
/* Protection */
! if (prot & VM_PROT_WRITE) {
! entry |= kva ? PG_PR_KRW | PG_SH : PG_PR_URW;
! switch (pvh->pvh_flags &
! (PVH_MODIFIED | PVH_REFERENCED)) {
! case PVH_MODIFIED | PVH_REFERENCED:
! entry |= PG_V | PG_D;
! break;
! case PVH_MODIFIED:
! entry |= PG_D;
! break;
! case PVH_REFERENCED:
! entry |= PG_V;
! break;
! }
} else {
! entry |= kva ? PG_PR_KRO | PG_SH : PG_PR_URO;
! if (pvh->pvh_flags & PVH_REFERENCED)
! entry |= PG_V;
}
/* Check for existing mapping */
--3CAnR4CLEnEWqRMR--