svn commit: r249314 - head/sys/i386/include

Konstantin Belousov kib at FreeBSD.org
Tue Apr 9 17:55:40 UTC 2013


Author: kib
Date: Tue Apr  9 17:55:39 2013
New Revision: 249314
URL: http://svnweb.freebsd.org/changeset/base/249314

Log:
  Pass the segmented address of the counter, based on %fs, i.e. offset
  from the pcpu[0] to the counter base, instead of the linear address.

Modified:
  head/sys/i386/include/counter.h

Modified: head/sys/i386/include/counter.h
==============================================================================
--- head/sys/i386/include/counter.h	Tue Apr  9 17:43:48 2013	(r249313)
+++ head/sys/i386/include/counter.h	Tue Apr  9 17:55:39 2013	(r249314)
@@ -46,6 +46,8 @@
 		critical_exit();			\
 } while (0)
 
+extern struct pcpu __pcpu[MAXCPU];
+
 static inline void
 counter_64_inc_8b(uint64_t *p, int64_t inc)
 {
@@ -61,7 +63,7 @@ counter_64_inc_8b(uint64_t *p, int64_t i
 	"cmpxchg8b %%fs:(%%esi)\n\t"
 	"jnz	1b"
 	:
-	: "S" (p), "D" (&inc)
+	: "S" ((char *)p - (char *)&__pcpu[0]), "D" (&inc)
 	: "memory", "cc", "eax", "edx", "ebx", "ecx");
 }
 


More information about the svn-src-head mailing list