Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/c888cfc835ac
branches:  uebayasi-xip
changeset: 751604:c888cfc835ac
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Thu Feb 25 04:33:44 2010 +0000

description:
Use VM_PAGE_TO_MD().  Only compile tested.

diffstat:

 sys/arch/ia64/ia64/pmap.c    |  47 +++++++++++++++++++++++++++----------------
 sys/arch/ia64/include/pmap.h |   4 +-
 2 files changed, 31 insertions(+), 20 deletions(-)

diffs (170 lines):

diff -r 7c8bc6b15254 -r c888cfc835ac sys/arch/ia64/ia64/pmap.c
--- a/sys/arch/ia64/ia64/pmap.c Thu Feb 25 04:33:06 2010 +0000
+++ b/sys/arch/ia64/ia64/pmap.c Thu Feb 25 04:33:44 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.24 2009/11/07 07:27:44 cegger Exp $ */
+/* $NetBSD: pmap.c,v 1.24.2.1 2010/02/25 04:33:44 uebayasi Exp $ */
 
 
 /*-
@@ -85,7 +85,10 @@
 
 #include <sys/cdefs.h>
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.24 2009/11/07 07:27:44 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.24.2.1 2010/02/25 04:33:44 uebayasi Exp $");
+
+#include "opt_device_page.h"
+#include "opt_xip.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1233,6 +1236,7 @@
 bool
 pmap_clear_modify(struct vm_page *pg)
 {
+       struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
        bool rv = false;
        struct ia64_lpte *pte;
        pmap_t oldpmap;
@@ -1241,7 +1245,7 @@
        if (pg->flags & PG_FAKE)
                return rv;
 
-       TAILQ_FOREACH(pv, &pg->mdpage.pv_list, pv_list) {
+       TAILQ_FOREACH(pv, &md->pv_list, pv_list) {
                PMAP_LOCK(pv->pv_pmap);
                oldpmap = pmap_install(pv->pv_pmap);
                pte = pmap_find_vhpt(pv->pv_va);
@@ -1266,6 +1270,7 @@
 void
 pmap_page_protect(struct vm_page *pg, vm_prot_t prot)
 {
+       struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
         struct ia64_lpte *pte;
         pmap_t oldpmap, pmap;
         pv_entry_t pv;
@@ -1275,7 +1280,7 @@
         if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) {
                 if (pg->flags & PG_RDONLY)
                         return;
-                TAILQ_FOREACH(pv, &pg->mdpage.pv_list, pv_list) {
+                TAILQ_FOREACH(pv, &md->pv_list, pv_list) {
                         pmap = pv->pv_pmap;
                         PMAP_LOCK(pmap);
                         oldpmap = pmap_install(pmap);
@@ -1489,8 +1494,9 @@
  */
 
 void
-pmap_page_purge(struct vm_page * pg)
+pmap_page_purge(struct vm_page *pg)
 {
+       struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
        pmap_t oldpmap;
        pv_entry_t pv;
 
@@ -1505,7 +1511,7 @@
 #endif
        //UVM_LOCK_ASSERT_PAGEQ();
 
-       while ((pv = TAILQ_FIRST(&pg->mdpage.pv_list)) != NULL) {
+       while ((pv = TAILQ_FIRST(&md->pv_list)) != NULL) {
                struct ia64_lpte *pte;
                pmap_t pmap = pv->pv_pmap;
                vaddr_t va = pv->pv_va;
@@ -1972,11 +1978,13 @@
  * Remove an entry from the list of managed mappings.
  */
 static int
-pmap_remove_entry(pmap_t pmap, struct vm_page * pg, vaddr_t va, pv_entry_t pv)
+pmap_remove_entry(pmap_t pmap, struct vm_page *pg, vaddr_t va, pv_entry_t pv)
 {
+       struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+
        if (!pv) {
-               if (pg->mdpage.pv_list_count < pmap->pm_stats.resident_count) {
-                       TAILQ_FOREACH(pv, &pg->mdpage.pv_list, pv_list) {
+               if (md->pv_list_count < pmap->pm_stats.resident_count) {
+                       TAILQ_FOREACH(pv, &md->pv_list, pv_list) {
                                if (pmap == pv->pv_pmap && va == pv->pv_va) 
                                        break;
                        }
@@ -1989,9 +1997,9 @@
        }
 
        if (pv) {
-               TAILQ_REMOVE(&pg->mdpage.pv_list, pv, pv_list);
-               pg->mdpage.pv_list_count--;
-               if (TAILQ_FIRST(&pg->mdpage.pv_list) == NULL) {
+               TAILQ_REMOVE(&md->pv_list, pv, pv_list);
+               md->pv_list_count--;
+               if (TAILQ_FIRST(&md->pv_list) == NULL) {
                        //UVM_LOCK_ASSERT_PAGEQ(); 
                        pg->flags |= PG_RDONLY;
                }
@@ -2012,6 +2020,7 @@
 static void
 pmap_insert_entry(pmap_t pmap, vaddr_t va, struct vm_page *pg)
 {
+       struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
        pv_entry_t pv;
 
        pv = get_pv_entry(pmap);
@@ -2021,8 +2030,8 @@
        //LOCK_ASSERT(simple_lock_held(pmap->slock));
        //UVM_LOCK_ASSERT_PAGEQ(); 
        TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist);
-       TAILQ_INSERT_TAIL(&pg->mdpage.pv_list, pv, pv_list);
-       pg->mdpage.pv_list_count++;
+       TAILQ_INSERT_TAIL(&md->pv_list, pv, pv_list);
+       md->pv_list_count++;
 }
 
 
@@ -2092,13 +2101,14 @@
                pa = VM_PAGE_TO_PHYS(pg);
 
 #ifdef DEBUG
-               mutex_enter(&pg->mdpage.pv_mutex);
+               struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+               mutex_enter(&md->pv_mutex);
                if (pg->wire_count != 0) {
                        printf("pmap_physpage_alloc: page 0x%lx has "
                            "%d references\n", pa, pg->wire_count);
                        panic("pmap_physpage_alloc");
                }
-               mutex_exit(&pg->mdpage.pv_mutex);
+               mutex_exit(&md->pv_mutex);
 #endif
                *pap = pa;
                return true;
@@ -2120,10 +2130,11 @@
                panic("pmap_physpage_free: bogus physical page address");
 
 #ifdef DEBUG
-       mutex_enter(&pg->mdpage.pv_mutex);
+       struct vm_page_md * const md = VM_PAGE_TO_MD(pg);
+       mutex_enter(&md->pv_mutex);
        if (pg->wire_count != 0)
                panic("pmap_physpage_free: page still has references");
-       mutex_exit(&pg->mdpage.pv_mutex);
+       mutex_exit(&md->pv_mutex);
 #endif
 
        uvm_pagefree(pg);
diff -r 7c8bc6b15254 -r c888cfc835ac sys/arch/ia64/include/pmap.h
--- a/sys/arch/ia64/include/pmap.h      Thu Feb 25 04:33:06 2010 +0000
+++ b/sys/arch/ia64/include/pmap.h      Thu Feb 25 04:33:44 2010 +0000
@@ -118,9 +118,9 @@
 void pmap_bootstrap(void);
 
 #define        pmap_is_referenced(pg)                                          \
-       (((pg)->mdpage.pvh_attrs & PGA_REFERENCED) != 0)
+       ((VM_PAGE_TO_MD(pg)->pvh_attrs & PGA_REFERENCED) != 0)
 #define        pmap_is_modified(pg)                                            \
-       (((pg)->mdpage.pvh_attrs & PGA_MODIFIED) != 0)
+       ((VM_PAGE_TO_MD(pg)->pvh_attrs & PGA_MODIFIED) != 0)
 
 
 #define PMAP_STEAL_MEMORY              /* enable pmap_steal_memory() */



Home | Main Index | Thread Index | Old Index