Add some KASSERTs to catch similar bugs to the cnptes/nptes one
This commit is contained in:
parent
ae8c40588e
commit
7f61cd4134
@ -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 pte, pt_entry_t opte)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user