summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorskrll <skrll@NetBSD.org>2023-06-10 07:33:32 +0000
committerskrll <skrll@NetBSD.org>2023-06-10 07:33:32 +0000
commit3adbe87b868455a4adebdaf91d7ff70e9ea1f836 (patch)
tree07816ffaa3760fbdff1be845028d0ea323ed3e73 /sys
parent8097e2f75d6bfcc73ce03fe7cc8e75c6b6029ed7 (diff)
KASSERT(kpreempt_disabled()) before accessing curcpu() to reflect why
preemption needs to be disabled more clearly.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/aarch64/aarch64/cpufunc.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/arch/aarch64/aarch64/cpufunc.c b/sys/arch/aarch64/aarch64/cpufunc.c
index 96b3e22d273..63eeb4fcb2c 100644
--- a/sys/arch/aarch64/aarch64/cpufunc.c
+++ b/sys/arch/aarch64/aarch64/cpufunc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cpufunc.c,v 1.34 2023/02/25 00:40:22 riastradh Exp $ */
+/* $NetBSD: cpufunc.c,v 1.35 2023/06/10 07:33:32 skrll Exp $ */
/*
* Copyright (c) 2017 Ryo Shimizu <ryo@nerv.org>
@@ -30,7 +30,7 @@
#include "opt_multiprocessor.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.34 2023/02/25 00:40:22 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.35 2023/06/10 07:33:32 skrll Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -365,12 +365,12 @@ ln_dcache_inv_all(int level, struct aarch64_cache_unit *cunit)
void
aarch64_dcache_wbinv_all(void)
{
+ KASSERT(kpreempt_disabled());
+
struct cpu_info * const ci = curcpu();
struct aarch64_cache_info * const cinfo = ci->ci_cacheinfo;
int level;
- KASSERT(kpreempt_disabled());
-
for (level = 0; level < MAX_CACHE_LEVEL; level++) {
if (cinfo[level].cacheable == CACHE_CACHEABLE_NONE)
break;
@@ -384,12 +384,12 @@ aarch64_dcache_wbinv_all(void)
void
aarch64_dcache_inv_all(void)
{
+ KASSERT(kpreempt_disabled());
+
struct cpu_info * const ci = curcpu();
struct aarch64_cache_info * const cinfo = ci->ci_cacheinfo;
int level;
- KASSERT(kpreempt_disabled());
-
for (level = 0; level < MAX_CACHE_LEVEL; level++) {
if (cinfo[level].cacheable == CACHE_CACHEABLE_NONE)
break;
@@ -403,12 +403,12 @@ aarch64_dcache_inv_all(void)
void
aarch64_dcache_wb_all(void)
{
+ KASSERT(kpreempt_disabled());
+
struct cpu_info * const ci = curcpu();
struct aarch64_cache_info * const cinfo = ci->ci_cacheinfo;
int level;
- KASSERT(kpreempt_disabled());
-
for (level = 0; level < MAX_CACHE_LEVEL; level++) {
if (cinfo[level].cacheable == CACHE_CACHEABLE_NONE)
break;