Re: new pmap

Jason R Thorpe <[email protected]>
Newsgroups gmane.os.netbsd.ports.sh3
Organization Wasabi Systems, Inc.
Message-ID <[email protected]>
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 <[email protected]>
pmap-patch (text/plain, 1.8 KB)
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 */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.