Index: sys/sparc64/include/counter.h
===================================================================
--- sys/sparc64/include/counter.h	(revision 249002)
+++ sys/sparc64/include/counter.h	(working copy)
@@ -31,22 +31,33 @@
 
 #include <sys/pcpu.h>
 
+#define	counter_enter()	critical_enter()
+#define	counter_exit()	critical_exit()
+
+#define	counter_u64_add_prot(c, inc)		do {	\
+	*(uint64_t *)zpcpu_get(c) += (inc);		\
+} while (0)
+
+#define	counter_u64_subtract_prot(c, dec)	do {	\
+	*(uint64_t *)zpcpu_get(c) -= (dec);		\
+} while (0)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) += inc;
-	critical_exit();
+	counter_enter();
+	counter_u64_add_prot(c, inc);
+	counter_exit();
 }
 
 static inline void
 counter_u64_subtract(counter_u64_t c, uint64_t dec)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) -= dec;
-	critical_exit();
+	counter_enter();
+	counter_u64_subtract_prot(c, dec);
+	counter_exit();
 }
 
 #endif	/* ! __MACHINE_COUNTER_H__ */
Index: sys/ia64/include/counter.h
===================================================================
--- sys/ia64/include/counter.h	(revision 249002)
+++ sys/ia64/include/counter.h	(working copy)
@@ -31,22 +31,33 @@
 
 #include <sys/pcpu.h>
 
+#define	counter_enter()	critical_enter()
+#define	counter_exit()	critical_exit()
+
+#define	counter_u64_add_prot(c, inc)		do {	\
+	*(uint64_t *)zpcpu_get(c) += (inc);		\
+} while (0)
+
+#define	counter_u64_subtract_prot(c, dec)	do {	\
+	*(uint64_t *)zpcpu_get(c) -= (dec);		\
+} while (0)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) += inc;
-	critical_exit();
+	counter_enter();
+	counter_u64_add_prot(c, inc);
+	counter_exit();
 }
 
 static inline void
 counter_u64_subtract(counter_u64_t c, uint64_t dec)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) -= dec;
-	critical_exit();
+	counter_enter();
+	counter_u64_subtract_prot(c, dec);
+	counter_exit();
 }
 
 #endif	/* ! __MACHINE_COUNTER_H__ */
Index: sys/i386/include/counter.h
===================================================================
--- sys/i386/include/counter.h	(revision 249002)
+++ sys/i386/include/counter.h	(working copy)
@@ -33,6 +33,16 @@
 #include <machine/md_var.h>
 #include <machine/specialreg.h>
 
+#define	counter_enter()	do {				\
+	if ((cpu_feature & CPUID_CX8) == 0)		\
+		critical_enter();			\
+} while (0)
+
+#define	counter_exit()	do {				\
+	if ((cpu_feature & CPUID_CX8) == 0)		\
+		critical_exit();			\
+} while (0)
+
 static inline void
 counter_64_inc_8b(uint64_t *p, uint64_t inc)
 {
@@ -52,24 +62,36 @@ counter_64_inc_8b(uint64_t *p, uint64_t inc)
 	: "memory", "cc", "eax", "edx", "ebx", "ecx");
 }
 
+#define	counter_u64_add_prot(c, inc)		do {	\
+	if ((cpu_feature & CPUID_CX8) == 0)		\
+		*(uint64_t *)zpcpu_get(c) += (inc);	\
+	else						\
+		counter_64_inc_8b((c), (inc));		\
+} while (0)
+
+#define	counter_u64_subtract_prot(c, dec)	do {	\
+	if ((cpu_feature & CPUID_CX8) == 0)		\
+		*(uint64_t *)zpcpu_get(c) -= (dec);	\
+	else						\
+		counter_64_inc_8b((c), -(int64_t)(dec));\
+} while (0)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
 
-	if ((cpu_feature & CPUID_CX8) == 0) {
-		critical_enter();
-		*(uint64_t *)zpcpu_get(c) += inc;
-		critical_exit();
-	} else {
-		counter_64_inc_8b(c, inc);
-	}
+	counter_enter();
+	counter_u64_add_prot(c, inc);
+	counter_exit();
 }
 
 static inline void
 counter_u64_subtract(counter_u64_t c, uint64_t dec)
 {
 
-	counter_u64_add(c, -(int64_t)dec);
+	counter_enter();
+	counter_u64_subtract_prot(c, dec);
+	counter_exit();
 }
 
 #endif	/* ! __MACHINE_COUNTER_H__ */
Index: sys/amd64/include/counter.h
===================================================================
--- sys/amd64/include/counter.h	(revision 249002)
+++ sys/amd64/include/counter.h	(working copy)
@@ -33,6 +33,12 @@
 
 extern struct pcpu __pcpu[1];
 
+#define	counter_enter()	do {} while (0)
+#define	counter_exit()	do {} while (0)
+
+#define	counter_u64_add_prot(c, i)	counter_u64_add(c, i)
+#define	counter_u64_subtract_prot(c, i)	counter_u64_subtract(c, i)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
Index: sys/arm/include/counter.h
===================================================================
--- sys/arm/include/counter.h	(revision 249002)
+++ sys/arm/include/counter.h	(working copy)
@@ -31,22 +31,33 @@
 
 #include <sys/pcpu.h>
 
+#define	counter_enter()	critical_enter()
+#define	counter_exit()	critical_exit()
+
+#define	counter_u64_add_prot(c, inc)		do {	\
+	*(uint64_t *)zpcpu_get(c) += (inc);		\
+} while (0)
+
+#define	counter_u64_subtract_prot(c, dec)	do {	\
+	*(uint64_t *)zpcpu_get(c) -= (dec);		\
+} while (0)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) += inc;
-	critical_exit();
+	counter_enter();
+	counter_u64_add_prot(c, inc);
+	counter_exit();
 }
 
 static inline void
 counter_u64_subtract(counter_u64_t c, uint64_t dec)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) -= dec;
-	critical_exit();
+	counter_enter();
+	counter_u64_subtract_prot(c, dec);
+	counter_exit();
 }
 
 #endif	/* ! __MACHINE_COUNTER_H__ */
Index: sys/powerpc/include/counter.h
===================================================================
--- sys/powerpc/include/counter.h	(revision 249002)
+++ sys/powerpc/include/counter.h	(working copy)
@@ -33,6 +33,12 @@
 
 #if defined(AIM) && defined(__powerpc64__)
 
+#define	counter_enter()	do {} while (0)
+#define	counter_exit()	do {} while (0)
+
+#define	counter_u64_add_prot(c, i)	counter_u64_add(c, i)
+#define	counter_u64_subtract_prot(c, i)	counter_u64_subtract(c, i)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
@@ -59,24 +65,33 @@ counter_u64_subtract(counter_u64_t c, uint64_t dec
 
 #else	/* !AIM || !64bit */
 
+#define	counter_enter()	critical_enter()
+#define	counter_exit()	critical_exit()
+
+#define	counter_u64_add_prot(c, inc)		do {	\
+	*(uint64_t *)zpcpu_get(c) += (inc);		\
+} while (0)
+
+#define	counter_u64_subtract_prot(c, dec)	do {	\
+	*(uint64_t *)zpcpu_get(c) -= (dec);		\
+} while (0)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) += inc;
-	critical_exit();
+	counter_enter();
+	counter_u64_add_prot(c, inc);
+	counter_exit();
 }
 
 static inline void
 counter_u64_subtract(counter_u64_t c, uint64_t dec)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) -= dec;
-	critical_exit();
+	counter_enter();
+	counter_u64_subtract_prot(c, dec);
+	counter_exit();
 }
 
-#endif	/* AIM 64bit */
-
 #endif	/* ! __MACHINE_COUNTER_H__ */
Index: sys/mips/include/counter.h
===================================================================
--- sys/mips/include/counter.h	(revision 249002)
+++ sys/mips/include/counter.h	(working copy)
@@ -31,22 +31,33 @@
 
 #include <sys/pcpu.h>
 
+#define	counter_enter()	critical_enter()
+#define	counter_exit()	critical_exit()
+
+#define	counter_u64_add_prot(c, inc)		do {	\
+	*(uint64_t *)zpcpu_get(c) += (inc);		\
+} while (0)
+
+#define	counter_u64_subtract_prot(c, dec)	do {	\
+	*(uint64_t *)zpcpu_get(c) -= (dec);		\
+} while (0)
+
 static inline void
 counter_u64_add(counter_u64_t c, uint64_t inc)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) += inc;
-	critical_exit();
+	counter_enter();
+	counter_u64_add_prot(c, inc);
+	counter_exit();
 }
 
 static inline void
 counter_u64_subtract(counter_u64_t c, uint64_t dec)
 {
 
-	critical_enter();
-	*(uint64_t *)zpcpu_get(c) -= dec;
-	critical_exit();
+	counter_enter();
+	counter_u64_subtract_prot(c, dec);
+	counter_exit();
 }
 
 #endif	/* ! __MACHINE_COUNTER_H__ */
