From 706c56e4a9c40faaac5ad4fb91e9128eafe186ce Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Tue, 9 Apr 2013 17:55:39 +0000 Subject: [PATCH] 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. --- sys/i386/include/counter.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/i386/include/counter.h b/sys/i386/include/counter.h index f45d9535869..3e93b362114 100644 --- a/sys/i386/include/counter.h +++ b/sys/i386/include/counter.h @@ -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 inc) "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"); }