From 13189065cb335587089d305a6e9b2170564db7a3 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sun, 24 Nov 2019 19:02:13 +0000 Subject: [PATCH] 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 --- sys/amd64/include/counter.h | 1 + 1 file changed, 1 insertion(+) 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)