Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 x86/pmap: Convert conditional to assertion.
details: https://anonhg.NetBSD.org/src/rev/e8c22f2a1d73
branches: trunk
changeset: 370681:e8c22f2a1d73
user: riastradh <riastradh%NetBSD.org@localhost>
date: Sat Sep 24 11:05:47 2022 +0000
description:
x86/pmap: Convert conditional to assertion.
pmap_kernel should never have va < VM_MAXUSER_ADDRESS entered.
diffstat:
sys/arch/x86/x86/pmap.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diffs (35 lines):
diff -r 81eb9d804afb -r e8c22f2a1d73 sys/arch/x86/x86/pmap.c
--- a/sys/arch/x86/x86/pmap.c Sat Sep 24 11:05:17 2022 +0000
+++ b/sys/arch/x86/x86/pmap.c Sat Sep 24 11:05:47 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.422 2022/09/24 11:05:18 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.423 2022/09/24 11:05:47 riastradh Exp $ */
/*
* Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.422 2022/09/24 11:05:18 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.423 2022/09/24 11:05:47 riastradh Exp $");
#include "opt_user_ldt.h"
#include "opt_lockdebug.h"
@@ -5001,9 +5001,13 @@
npte |= pmap_pat_flags(flags);
if (wired)
npte |= PTE_WIRED;
- if (va < VM_MAXUSER_ADDRESS &&
- (pmap == pmap_kernel() || pmap_is_user(pmap)))
- npte |= PTE_U;
+ if (va < VM_MAXUSER_ADDRESS) {
+ KASSERTMSG(pmap != pmap_kernel(),
+ "entering user va %#"PRIxVADDR" into kernel pmap",
+ va);
+ if (pmap_is_user(pmap))
+ npte |= PTE_U;
+ }
if (pmap == pmap_kernel())
npte |= pmap_pg_g;
Home |
Main Index |
Thread Index |
Old Index