Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/aarch64/aarch64 Slight code re-organisation. NFCI.
details: https://anonhg.NetBSD.org/src/rev/e5a7519ba70c
branches: trunk
changeset: 364355:e5a7519ba70c
user: skrll <skrll%NetBSD.org@localhost>
date: Sat Mar 19 09:53:18 2022 +0000
description:
Slight code re-organisation. NFCI.
diffstat:
sys/arch/aarch64/aarch64/pmap.c | 59 +++++++++++++++++++++-------------------
1 files changed, 31 insertions(+), 28 deletions(-)
diffs (87 lines):
diff -r 8f75b2ac327a -r e5a7519ba70c sys/arch/aarch64/aarch64/pmap.c
--- a/sys/arch/aarch64/aarch64/pmap.c Fri Mar 18 23:37:14 2022 +0000
+++ b/sys/arch/aarch64/aarch64/pmap.c Sat Mar 19 09:53:18 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.130 2022/03/12 15:32:30 riastradh Exp $ */
+/* $NetBSD: pmap.c,v 1.131 2022/03/19 09:53:18 skrll Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo%nerv.org@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.130 2022/03/12 15:32:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.131 2022/03/19 09:53:18 skrll Exp $");
#include "opt_arm_debug.h"
#include "opt_cpuoptions.h"
@@ -276,7 +276,7 @@
#endif /* __HAVE_PMAP_PV_TRACK */
}
-#define IN_RANGE(va,sta,end) (((sta) <= (va)) && ((va) < (end)))
+#define IN_RANGE(va, sta, end) (((sta) <= (va)) && ((va) < (end)))
#define IN_DIRECTMAP_ADDR(va) \
IN_RANGE((va), AARCH64_DIRECTMAP_START, AARCH64_DIRECTMAP_END)
@@ -288,31 +288,34 @@
#endif
#ifdef DIAGNOSTIC
-#define KASSERT_PM_ADDR(pm,va) \
- do { \
- int space = aarch64_addressspace(va); \
- if ((pm) == pmap_kernel()) { \
- KASSERTMSG(space == AARCH64_ADDRSPACE_UPPER, \
- "%s: kernel pm %p: va=%016lx" \
- " is out of upper address space", \
- __func__, (pm), (va)); \
- KASSERTMSG(IN_RANGE((va), VM_MIN_KERNEL_ADDRESS, \
- VM_MAX_KERNEL_ADDRESS), \
- "%s: kernel pm %p: va=%016lx" \
- " is not kernel address", \
- __func__, (pm), (va)); \
- } else { \
- KASSERTMSG(space == AARCH64_ADDRSPACE_LOWER, \
- "%s: user pm %p: va=%016lx" \
- " is out of lower address space", \
- __func__, (pm), (va)); \
- KASSERTMSG(IN_RANGE((va), \
- VM_MIN_ADDRESS, VM_MAX_ADDRESS), \
- "%s: user pm %p: va=%016lx" \
- " is not user address", \
- __func__, (pm), (va)); \
- } \
- } while (0 /* CONSTCOND */)
+
+#define KERNEL_ADDR_P(va) \
+ IN_RANGE((va), VM_MIN_KERNEL_ADDRESS, VM_MAX_KERNEL_ADDRESS)
+
+#define KASSERT_PM_ADDR(pm, va) \
+ do { \
+ int space = aarch64_addressspace(va); \
+ if ((pm) == pmap_kernel()) { \
+ KASSERTMSG(space == AARCH64_ADDRSPACE_UPPER, \
+ "%s: kernel pm %p: va=%016lx" \
+ " is out of upper address space", \
+ __func__, (pm), (va)); \
+ KASSERTMSG(KERNEL_ADDR_P(va), \
+ "%s: kernel pm %p: va=%016lx" \
+ " is not kernel address", \
+ __func__, (pm), (va)); \
+ } else { \
+ KASSERTMSG(space == AARCH64_ADDRSPACE_LOWER, \
+ "%s: user pm %p: va=%016lx" \
+ " is out of lower address space", \
+ __func__, (pm), (va)); \
+ KASSERTMSG(IN_RANGE((va), \
+ VM_MIN_ADDRESS, VM_MAX_ADDRESS), \
+ "%s: user pm %p: va=%016lx" \
+ " is not user address", \
+ __func__, (pm), (va)); \
+ } \
+ } while (0 /* CONSTCOND */)
#else /* DIAGNOSTIC */
#define KASSERT_PM_ADDR(pm,va)
#endif /* DIAGNOSTIC */
Home |
Main Index |
Thread Index |
Old Index