Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/uebayasi-xip]: src/sys/arch/sh3/sh3 Use VM_PAGE_TO_MD(). Only compile t...



details:   https://anonhg.NetBSD.org/src/rev/eb8f2ea6f982
branches:  uebayasi-xip
changeset: 751606:eb8f2ea6f982
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Thu Feb 25 05:05:23 2010 +0000

description:
Use VM_PAGE_TO_MD().  Only compile tested.

diffstat:

 sys/arch/sh3/sh3/pmap.c |  36 ++++++++++++++++++++----------------
 1 files changed, 20 insertions(+), 16 deletions(-)

diffs (134 lines):

diff -r c69f529e8132 -r eb8f2ea6f982 sys/arch/sh3/sh3/pmap.c
--- a/sys/arch/sh3/sh3/pmap.c   Thu Feb 25 04:46:28 2010 +0000
+++ b/sys/arch/sh3/sh3/pmap.c   Thu Feb 25 05:05:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.74 2009/11/07 07:27:46 cegger Exp $ */
+/*     $NetBSD: pmap.c,v 1.74.2.1 2010/02/25 05:05:23 uebayasi Exp $   */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74 2009/11/07 07:27:46 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.74.2.1 2010/02/25 05:05:23 uebayasi Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -339,7 +339,7 @@
                entry |= _PG_WIRED;
 
        if (pg != NULL) {       /* memory-space */
-               pvh = &pg->mdpage;
+               pvh = VM_PAGE_TO_MD(pg);
                entry |= PG_C;  /* always cached */
 
                /* Seed modified/reference tracking */
@@ -483,7 +483,7 @@
                 * XXX mapping them uncached (like arm and mips do).
                 */
  again:
-               pvh = &pg->mdpage;
+               pvh = VM_PAGE_TO_MD(pg);
                SLIST_FOREACH(pv, &pvh->pvh_head, pv_link) {
                        if (sh_cache_indexof(va) !=
                            sh_cache_indexof(pv->pv_va)) {
@@ -495,7 +495,7 @@
        }
 
        /* Register pv map */
-       pvh = &pg->mdpage;
+       pvh = VM_PAGE_TO_MD(pg);
        pv = __pmap_pv_alloc();
        pv->pv_pmap = pmap;
        pv->pv_va = va;
@@ -547,12 +547,12 @@
        int s;
 
        s = splvm();
-       pvh = &pg->mdpage;
+       pvh = VM_PAGE_TO_MD(pg);
        SLIST_FOREACH(pv, &pvh->pvh_head, pv_link) {
                if (pv->pv_pmap == pmap && pv->pv_va == vaddr) {
                        if (SH_HAS_VIRTUAL_ALIAS ||
                            (SH_HAS_WRITEBACK_CACHE &&
-                               (pg->mdpage.pvh_flags & PVH_MODIFIED))) {
+                               (pvh->pvh_flags & PVH_MODIFIED))) {
                                /*
                                 * Always use index ops. since I don't want to
                                 * worry about address space.
@@ -699,7 +699,7 @@
 void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
-       struct vm_page_md *pvh = &pg->mdpage;
+       struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
        struct pv_entry *pv;
        struct pmap *pmap;
        vaddr_t va;
@@ -789,24 +789,25 @@
 bool
 pmap_is_referenced(struct vm_page *pg)
 {
+       struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
 
-       return ((pg->mdpage.pvh_flags & PVH_REFERENCED) ? true : false);
+       return ((pvh->pvh_flags & PVH_REFERENCED) ? true : false);
 }
 
 bool
 pmap_clear_reference(struct vm_page *pg)
 {
-       struct vm_page_md *pvh = &pg->mdpage;
+       struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
        struct pv_entry *pv;
        pt_entry_t *pte;
        pmap_t pmap;
        vaddr_t va;
        int s;
 
-       if ((pg->mdpage.pvh_flags & PVH_REFERENCED) == 0)
+       if ((pvh->pvh_flags & PVH_REFERENCED) == 0)
                return (false);
 
-       pg->mdpage.pvh_flags &= ~PVH_REFERENCED;
+       pvh->pvh_flags &= ~PVH_REFERENCED;
 
        s = splvm();
        /* Restart reference bit emulation */
@@ -831,14 +832,15 @@
 bool
 pmap_is_modified(struct vm_page *pg)
 {
+       struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
 
-       return ((pg->mdpage.pvh_flags & PVH_MODIFIED) ? true : false);
+       return ((pvh->pvh_flags & PVH_MODIFIED) ? true : false);
 }
 
 bool
 pmap_clear_modify(struct vm_page *pg)
 {
-       struct vm_page_md *pvh = &pg->mdpage;
+       struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
        struct pv_entry *pv;
        struct pmap *pmap;
        pt_entry_t *pte, entry;
@@ -1023,12 +1025,14 @@
 
        /* Emulate reference/modified tracking for managed page. */
        if (flags != 0 && (pg = PHYS_TO_VM_PAGE(entry & PG_PPN)) != NULL) {
+               struct vm_page_md *pvh = VM_PAGE_TO_MD(pg);
+
                if (flags & PVH_REFERENCED) {
-                       pg->mdpage.pvh_flags |= PVH_REFERENCED;
+                       pvh->pvh_flags |= PVH_REFERENCED;
                        entry |= PG_V;
                }
                if (flags & PVH_MODIFIED) {
-                       pg->mdpage.pvh_flags |= PVH_MODIFIED;
+                       pvh->pvh_flags |= PVH_MODIFIED;
                        entry |= PG_D;
                }
                *pte = entry;



Home | Main Index | Thread Index | Old Index