summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2005-10-30 20:47:42 +0000
committeralc <alc@FreeBSD.org>2005-10-30 20:47:42 +0000
commitdaa510f5e2dd92ab4465bd10c4cadc57b78dad63 (patch)
treea8b9401602498a6f251fe558ef412fed6e0edfbb /sys
parent49831ed8da06ffadf684484671b4561c9ac55f9f (diff)
downloadFreeBSD-src-daa510f5e2dd92ab4465bd10c4cadc57b78dad63.zip
FreeBSD-src-daa510f5e2dd92ab4465bd10c4cadc57b78dad63.tar.gz
Replace diagnostic printf()s by assertions. Use consistent style for
similar assertions.
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/amd64/pmap.c44
-rw-r--r--sys/i386/i386/pmap.c44
2 files changed, 16 insertions, 72 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 029963a..58db969 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -597,26 +597,6 @@ pmap_init2()
* Low level helper routines.....
***************************************************/
-#if defined(PMAP_DIAGNOSTIC)
-
-/*
- * This code checks for non-writeable/modified pages.
- * This should be an invalid condition.
- */
-static int
-pmap_nw_modified(pt_entry_t ptea)
-{
- int pte;
-
- pte = (int) ptea;
-
- if ((pte & (PG_M|PG_RW)) == PG_M)
- return 1;
- else
- return 0;
-}
-#endif
-
/*
* this routine defines the region(s) of memory that should
@@ -1543,13 +1523,9 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va, pd_entry_t ptepde)
if (oldpte & PG_MANAGED) {
m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME);
if (oldpte & PG_M) {
-#if defined(PMAP_DIAGNOSTIC)
- if (pmap_nw_modified((pt_entry_t) oldpte)) {
- printf(
- "pmap_remove: modified page not writable: va: 0x%lx, pte: 0x%lx\n",
- va, oldpte);
- }
-#endif
+ KASSERT((oldpte & PG_RW),
+ ("pmap_remove_pte: modified page not writable: va: 0x%lx, pte: 0x%lx",
+ va, oldpte));
if (pmap_track_modified(va))
vm_page_dirty(m);
}
@@ -1728,13 +1704,9 @@ pmap_remove_all(vm_page_t m)
* Update the vm_page_t clean and reference bits.
*/
if (tpte & PG_M) {
-#if defined(PMAP_DIAGNOSTIC)
- if (pmap_nw_modified((pt_entry_t) tpte)) {
- printf(
- "pmap_remove_all: modified page not writable: va: 0x%lx, pte: 0x%lx\n",
- pv->pv_va, tpte);
- }
-#endif
+ KASSERT((tpte & PG_RW),
+ ("pmap_remove_all: modified page not writable: va: 0x%lx, pte: 0x%lx",
+ pv->pv_va, tpte));
if (pmap_track_modified(pv->pv_va))
vm_page_dirty(m);
}
@@ -2021,8 +1993,8 @@ validate:
}
if (origpte & PG_M) {
KASSERT((origpte & PG_RW),
- ("pmap_enter: modified page not writable:"
- " va: 0x%lx, pte: 0x%lx", va, origpte));
+ ("pmap_enter: modified page not writable: va: 0x%lx, pte: 0x%lx",
+ va, origpte));
if ((origpte & PG_MANAGED) &&
pmap_track_modified(va))
vm_page_dirty(om);
diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c
index d813e16..fdc51d7 100644
--- a/sys/i386/i386/pmap.c
+++ b/sys/i386/i386/pmap.c
@@ -510,26 +510,6 @@ pmap_init2()
* Low level helper routines.....
***************************************************/
-#if defined(PMAP_DIAGNOSTIC)
-
-/*
- * This code checks for non-writeable/modified pages.
- * This should be an invalid condition.
- */
-static int
-pmap_nw_modified(pt_entry_t ptea)
-{
- int pte;
-
- pte = (int) ptea;
-
- if ((pte & (PG_M|PG_RW)) == PG_M)
- return 1;
- else
- return 0;
-}
-#endif
-
/*
* this routine defines the region(s) of memory that should
@@ -1546,13 +1526,9 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va)
if (oldpte & PG_MANAGED) {
m = PHYS_TO_VM_PAGE(oldpte);
if (oldpte & PG_M) {
-#if defined(PMAP_DIAGNOSTIC)
- if (pmap_nw_modified((pt_entry_t) oldpte)) {
- printf(
- "pmap_remove: modified page not writable: va: 0x%x, pte: 0x%x\n",
- va, oldpte);
- }
-#endif
+ KASSERT((oldpte & PG_RW),
+ ("pmap_remove_pte: modified page not writable: va: 0x%x, pte: 0x%x",
+ va, oldpte));
if (pmap_track_modified(va))
vm_page_dirty(m);
}
@@ -1716,13 +1692,9 @@ pmap_remove_all(vm_page_t m)
* Update the vm_page_t clean and reference bits.
*/
if (tpte & PG_M) {
-#if defined(PMAP_DIAGNOSTIC)
- if (pmap_nw_modified((pt_entry_t) tpte)) {
- printf(
- "pmap_remove_all: modified page not writable: va: 0x%x, pte: 0x%x\n",
- pv->pv_va, tpte);
- }
-#endif
+ KASSERT((tpte & PG_RW),
+ ("pmap_remove_all: modified page not writable: va: 0x%x, pte: 0x%x",
+ pv->pv_va, tpte));
if (pmap_track_modified(pv->pv_va))
vm_page_dirty(m);
}
@@ -2011,8 +1983,8 @@ validate:
}
if (origpte & PG_M) {
KASSERT((origpte & PG_RW),
- ("pmap_enter: modified page not writable:"
- " va: 0x%x, pte: 0x%x", va, origpte));
+ ("pmap_enter: modified page not writable: va: 0x%x, pte: 0x%x",
+ va, origpte));
if ((origpte & PG_MANAGED) &&
pmap_track_modified(va))
vm_page_dirty(om);
OpenPOWER on IntegriCloud