summaryrefslogtreecommitdiffstats
path: root/sys/amd64/include
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2012-06-30 20:25:12 +0000
committeralc <alc@FreeBSD.org>2012-06-30 20:25:12 +0000
commitaacced50dfd757da308a405f8141fc798d81875c (patch)
tree9f8ce64a88610ed127c66c973aec935eb8cd5103 /sys/amd64/include
parentc61cad51adaa3f4b9963cd8910e2c5d7471dd524 (diff)
downloadFreeBSD-src-aacced50dfd757da308a405f8141fc798d81875c.zip
FreeBSD-src-aacced50dfd757da308a405f8141fc798d81875c.tar.gz
Optimize reserve_pv_entries() using the popcnt instruction.
Diffstat (limited to 'sys/amd64/include')
-rw-r--r--sys/amd64/include/cpufunc.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h
index 9440694..927d00f 100644
--- a/sys/amd64/include/cpufunc.h
+++ b/sys/amd64/include/cpufunc.h
@@ -273,6 +273,15 @@ outw(u_int port, u_short data)
__asm __volatile("outw %0, %w1" : : "a" (data), "Nd" (port));
}
+static __inline u_long
+popcntq(u_long mask)
+{
+ u_long result;
+
+ __asm __volatile("popcntq %1,%0" : "=r" (result) : "rm" (mask));
+ return (result);
+}
+
static __inline void
mfence(void)
{
OpenPOWER on IntegriCloud