Module Name: src Committed By: tsutsui Date: Mon Jun 29 13:22:52 UTC 2009
Modified Files: src/sys/arch/mips/include: pmap.h src/sys/arch/mips/mips: pmap.c Log Message: Since pmap.c rev 1.163, page attributes of PV_MODIFIED and PV_REFERENCED have beem moved from pv_flags in struct pv_entry to pvh_attrs in struct vm_page_md, so no need to copy pv_flags to keep these flags in pv header in pmap_remove_pv(). Pointed out by uebayasi@ on port-mips. Also rename those page attribute flags from PV_FOO to PGA_FOO like alpha. While here, make pv_flags unsigned. Briefly tested on sgimips O2. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/mips/include/pmap.h cvs rdiff -u -r1.182 -r1.183 src/sys/arch/mips/mips/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/include/pmap.h diff -u src/sys/arch/mips/include/pmap.h:1.55 src/sys/arch/mips/include/pmap.h:1.56 --- src/sys/arch/mips/include/pmap.h:1.55 Tue Dec 9 20:45:45 2008 +++ src/sys/arch/mips/include/pmap.h Mon Jun 29 13:22:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.55 2008/12/09 20:45:45 pooka Exp $ */ +/* $NetBSD: pmap.h,v 1.56 2009/06/29 13:22:51 tsutsui Exp $ */ /* * Copyright (c) 1992, 1993 @@ -131,12 +131,13 @@ struct pv_entry *pv_next; /* next pv_entry */ struct pmap *pv_pmap; /* pmap where mapping lies */ vaddr_t pv_va; /* virtual address for mapping */ - int pv_flags; /* some flags for the mapping */ + u_int pv_flags; /* some flags for the mapping */ +#define PV_UNCACHED 0x0001 /* page is mapped uncached */ } *pv_entry_t; -#define PV_UNCACHED 0x0001 /* page is mapped uncached */ -#define PV_MODIFIED 0x0002 /* page has been modified */ -#define PV_REFERENCED 0x0004 /* page has been recently referenced */ +/* pvh_attrs flags in struct vm_page_md */ +#define PGA_MODIFIED 0x0001 /* page has been modified */ +#define PGA_REFERENCED 0x0002 /* page has been recently referenced */ #ifdef _KERNEL Index: src/sys/arch/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.182 src/sys/arch/mips/mips/pmap.c:1.183 --- src/sys/arch/mips/mips/pmap.c:1.182 Tue Apr 21 21:29:59 2009 +++ src/sys/arch/mips/mips/pmap.c Mon Jun 29 13:22:51 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.182 2009/04/21 21:29:59 cegger Exp $ */ +/* $NetBSD: pmap.c,v 1.183 2009/06/29 13:22:51 tsutsui Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.182 2009/04/21 21:29:59 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.183 2009/06/29 13:22:51 tsutsui Exp $"); /* * Manages physical address maps. @@ -1156,9 +1156,9 @@ /* Set page referenced/modified status based on flags */ if (flags & VM_PROT_WRITE) - *attrs |= PV_MODIFIED | PV_REFERENCED; + *attrs |= PGA_MODIFIED | PGA_REFERENCED; else if (flags & VM_PROT_ALL) - *attrs |= PV_REFERENCED; + *attrs |= PGA_REFERENCED; if (!(prot & VM_PROT_WRITE)) /* * If page is not yet referenced, we could emulate this @@ -1171,14 +1171,14 @@ else { #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64) if (cached == 0) { - if (*attrs & PV_MODIFIED) { + if (*attrs & PGA_MODIFIED) { npte = mips_pg_rwncpage_bit(); } else { npte = mips_pg_cwncpage_bit(); } } else { #endif - if (*attrs & PV_MODIFIED) { + if (*attrs & PGA_MODIFIED) { npte = mips_pg_rwpage_bit(); } else { npte = mips_pg_cwpage_bit(); @@ -1712,8 +1712,8 @@ (u_long)VM_PAGE_TO_PHYS(pg)); #endif attrp = &pg->mdpage.pvh_attrs; - rv = *attrp & PV_REFERENCED; - *attrp &= ~PV_REFERENCED; + rv = *attrp & PGA_REFERENCED; + *attrp &= ~PGA_REFERENCED; return rv; } @@ -1727,7 +1727,7 @@ pmap_is_referenced(struct vm_page *pg) { - return pg->mdpage.pvh_attrs & PV_REFERENCED; + return pg->mdpage.pvh_attrs & PGA_REFERENCED; } /* @@ -1749,8 +1749,8 @@ printf("pmap_clear_modify(%lx)\n", (u_long)VM_PAGE_TO_PHYS(pg)); #endif attrp = &pg->mdpage.pvh_attrs; - rv = *attrp & PV_MODIFIED; - *attrp &= ~PV_MODIFIED; + rv = *attrp & PGA_MODIFIED; + *attrp &= ~PGA_MODIFIED; if (!rv) { return rv; } @@ -1805,7 +1805,7 @@ pmap_is_modified(struct vm_page *pg) { - return pg->mdpage.pvh_attrs & PV_MODIFIED; + return pg->mdpage.pvh_attrs & PGA_MODIFIED; } /* @@ -1819,7 +1819,7 @@ struct vm_page *pg; pg = PHYS_TO_VM_PAGE(pa); - pg->mdpage.pvh_attrs |= PV_MODIFIED | PV_REFERENCED; + pg->mdpage.pvh_attrs |= PGA_MODIFIED | PGA_REFERENCED; } /******************** misc. functions ********************/ @@ -2043,14 +2043,6 @@ if (pmap == pv->pv_pmap && va == pv->pv_va) { npv = pv->pv_next; if (npv) { - - /* - * Copy current modified and referenced status to - * the following entry before copying. - */ - - npv->pv_flags |= - pv->pv_flags & (PV_MODIFIED | PV_REFERENCED); *pv = *npv; pmap_pv_free(npv); } else {