Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/include/counter.h
Show First 20 Lines • Show All 63 Lines • ▼ Show 20 Lines | counter_u64_zero_one_cpu(void *arg) | ||||
*((uint64_t *)((char *)arg + sizeof(struct pcpu) * | *((uint64_t *)((char *)arg + sizeof(struct pcpu) * | ||||
PCPU_GET(cpuid))) = 0; | PCPU_GET(cpuid))) = 0; | ||||
} | } | ||||
static inline void | static inline void | ||||
counter_u64_zero_inline(counter_u64_t c) | counter_u64_zero_inline(counter_u64_t c) | ||||
{ | { | ||||
smp_rendezvous(smp_no_rendevous_barrier, counter_u64_zero_one_cpu, | smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, | ||||
smp_no_rendevous_barrier, c); | smp_no_rendezvous_barrier, c); | ||||
} | } | ||||
#endif | #endif | ||||
#define counter_u64_add_protected(c, i) counter_u64_add(c, i) | #define counter_u64_add_protected(c, i) counter_u64_add(c, i) | ||||
static inline void | static inline void | ||||
counter_u64_add(counter_u64_t c, int64_t inc) | counter_u64_add(counter_u64_t c, int64_t inc) | ||||
{ | { | ||||
__asm __volatile("addq\t%1,%%gs:(%0)" | __asm __volatile("addq\t%1,%%gs:(%0)" | ||||
: | : | ||||
: "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc) | : "r" ((char *)c - (char *)&__pcpu[0]), "ri" (inc) | ||||
: "memory", "cc"); | : "memory", "cc"); | ||||
} | } | ||||
#endif /* ! __MACHINE_COUNTER_H__ */ | #endif /* ! __MACHINE_COUNTER_H__ */ |