Module Name: src
Committed By: skrll
Date: Tue May 12 07:07:16 UTC 2015
Modified Files:
src/sys/arch/arm/include/arm32: pmap.h
Log Message:
Add some KASSERTs to catch similar bugs to the cnptes/nptes one
To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/arch/arm/include/arm32/pmap.h
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/arm/include/arm32/pmap.h
diff -u src/sys/arch/arm/include/arm32/pmap.h:1.138 src/sys/arch/arm/include/arm32/pmap.h:1.139
--- src/sys/arch/arm/include/arm32/pmap.h:1.138 Wed Feb 25 13:52:42 2015
+++ src/sys/arch/arm/include/arm32/pmap.h Tue May 12 07:07:16 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.138 2015/02/25 13:52:42 joerg Exp $ */
+/* $NetBSD: pmap.h,v 1.139 2015/05/12 07:07:16 skrll Exp $ */
/*
* Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -567,10 +567,12 @@ static inline void
l2pte_set(pt_entry_t *ptep, pt_entry_t pte, pt_entry_t opte)
{
if (l1pte_lpage_p(pte)) {
+ KASSERTMSG((((uintptr_t)ptep / sizeof(pte)) & (L2_L_SIZE / L2_S_SIZE - 1)) == 0, "%p", ptep);
for (size_t k = 0; k < L2_L_SIZE / L2_S_SIZE; k++) {
*ptep++ = pte;
}
} else {
+ KASSERTMSG((((uintptr_t)ptep / sizeof(pte)) & (PAGE_SIZE / L2_S_SIZE - 1)) == 0, "%p", ptep);
for (size_t k = 0; k < PAGE_SIZE / L2_S_SIZE; k++) {
KASSERTMSG(*ptep == opte, "%#x [*%p] != %#x", *ptep, ptep, opte);
*ptep++ = pte;
@@ -584,6 +586,7 @@ l2pte_set(pt_entry_t *ptep, pt_entry_t p
static inline void
l2pte_reset(pt_entry_t *ptep)
{
+ KASSERTMSG((((uintptr_t)ptep / sizeof(*ptep)) & (PAGE_SIZE / L2_S_SIZE - 1)) == 0, "%p", ptep);
*ptep = 0;
for (vsize_t k = 1; k < PAGE_SIZE / L2_S_SIZE; k++) {
ptep[k] = 0;