aboutsummaryrefslogtreecommitdiff
path: root/sys/amd64/include
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2019-11-24 19:02:13 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2019-11-24 19:02:13 +0000
commit13189065cb335587089d305a6e9b2170564db7a3 (patch)
tree85d28789591bcbe9186770cce0a887fdcb9938a9 /sys/amd64/include
parent515a40d5d9bfae91e4c063cf862894d16dae20e5 (diff)
downloadsrc-13189065cb335587089d305a6e9b2170564db7a3.tar.gz
src-13189065cb335587089d305a6e9b2170564db7a3.zip
amd64: assert that EARLY_COUNTER does not corrupt memory.
Reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22514
Notes
Notes: svn path=/head/; revision=355060
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/counter.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/amd64/include/counter.h b/sys/amd64/include/counter.h
index cc68da61928d..cc0e74064a5f 100644
--- a/sys/amd64/include/counter.h
+++ b/sys/amd64/include/counter.h
@@ -82,6 +82,7 @@ static inline void
counter_u64_add(counter_u64_t c, int64_t inc)
{
+ KASSERT(IS_BSP() || c != EARLY_COUNTER, ("EARLY_COUNTER used on AP"));
__asm __volatile("addq\t%1,%%gs:(%0)"
:
: "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc)