Subject: replace pa_to_pvh() and pa_to_attribute() macro
To: None <port-mips@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-mips
Date: 11/22/2005 01:41:59
Some discussion is going on tech-kern, but is it OK
to commit the attached diff against mips/pmap.c?
---
Izumi Tsutsui
Index: pmap.c
===================================================================
RCS file: /cvsroot/src/sys/arch/mips/mips/pmap.c,v
retrieving revision 1.160
diff -u -r1.160 pmap.c
--- pmap.c 5 Nov 2005 10:57:49 -0000 1.160
+++ pmap.c 21 Nov 2005 16:29:56 -0000
@@ -221,22 +221,6 @@
((pm) == pmap_kernel() || \
(pm) == curlwp->l_proc->p_vmspace->vm_map.pmap)
-#define pa_to_pvh(pa) \
-({ \
- int bank_, pg_; \
- \
- bank_ = vm_physseg_find(atop((pa)), &pg_); \
- &vm_physmem[bank_].pmseg.pvent[pg_]; \
-})
-
-#define pa_to_attribute(pa) \
-({ \
- int bank_, pg_; \
- \
- bank_ = vm_physseg_find(atop((pa)), &pg_); \
- &vm_physmem[bank_].pmseg.pvent[pg_].pv_flags; \
-})
-
/* Forward function declarations */
void pmap_remove_pv(pmap_t pmap, vaddr_t va, paddr_t pa);
void pmap_asid_alloc(pmap_t pmap);
@@ -249,6 +233,9 @@
void *pmap_pv_page_alloc(struct pool *, int);
void pmap_pv_page_free(struct pool *, void *);
+static __inline struct pv_entry *pa_to_pvh(paddr_t pa);
+static __inline int *pa_to_attribute(paddr_t pa);
+
struct pool_allocator pmap_pv_page_allocator = {
pmap_pv_page_alloc, pmap_pv_page_free, 0,
};
@@ -260,6 +247,24 @@
* Misc. functions.
*/
+static __inline struct pv_entry *
+pa_to_pvh(paddr_t pa)
+{
+ int bank, pg;
+
+ bank = vm_physseg_find(atop((pa)), &pg);
+ return &vm_physmem[bank].pmseg.pvent[pg];
+}
+
+static __inline int *
+pa_to_attribute(paddr_t pa)
+{
+ int bank, pg;
+
+ bank = vm_physseg_find(atop((pa)), &pg);
+ return &vm_physmem[bank].pmseg.pvent[pg].pv_flags;
+}
+
#if defined(MIPS3_PLUS) /* XXX mmu XXX */
void mips_dump_segtab(struct proc *);
static void mips_flushcache_allpvh(paddr_t);
---