debuggers.hg

view xen/include/asm-ia64/vcpumask.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children b22f9ab1716a
line source
1 #ifndef __XEN_VCPUMASK_H
2 #define __XEN_VCPUMASK_H
4 /* vcpu mask
5 stolen from cpumask.h */
6 typedef struct { DECLARE_BITMAP(bits, MAX_VIRT_CPUS); } vcpumask_t;
8 #define vcpu_set(vcpu, dst) __vcpu_set((vcpu), &(dst))
9 static inline void __vcpu_set(int vcpu, volatile vcpumask_t *dstp)
10 {
11 set_bit(vcpu, dstp->bits);
12 }
13 #define vcpus_clear(dst) __vcpus_clear(&(dst), MAX_VIRT_CPUS)
14 static inline void __vcpus_clear(vcpumask_t *dstp, int nbits)
15 {
16 bitmap_zero(dstp->bits, nbits);
17 }
18 /* No static inline type checking - see Subtlety (1) above. */
19 #define vcpu_isset(vcpu, vcpumask) test_bit((vcpu), (vcpumask).bits)
21 #define first_vcpu(src) __first_vcpu(&(src), MAX_VIRT_CPUS)
22 static inline int __first_vcpu(const vcpumask_t *srcp, int nbits)
23 {
24 return min_t(int, nbits, find_first_bit(srcp->bits, nbits));
25 }
27 #define next_vcpu(n, src) __next_vcpu((n), &(src), MAX_VIRT_CPUS)
28 static inline int __next_vcpu(int n, const vcpumask_t *srcp, int nbits)
29 {
30 return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1));
31 }
33 #if MAX_VIRT_CPUS > 1
34 #define for_each_vcpu_mask(vcpu, mask) \
35 for ((vcpu) = first_vcpu(mask); \
36 (vcpu) < MAX_VIRT_CPUS; \
37 (vcpu) = next_vcpu((vcpu), (mask)))
38 #else /* NR_CPUS == 1 */
39 #define for_each_vcpu_mask(vcpu, mask) for ((vcpu) = 0; (vcpu) < 1; (vcpu)++)
40 #endif /* NR_CPUS */
42 #define vcpumask_scnprintf(buf, len, src) \
43 __vcpumask_scnprintf((buf), (len), &(src), MAX_VIRT_CPUS)
44 static inline int __vcpumask_scnprintf(char *buf, int len,
45 const vcpumask_t *srcp, int nbits)
46 {
47 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
48 }
50 #endif /* __XEN_VCPUMASK_H */
52 /*
53 * Local variables:
54 * mode: C
55 * c-set-style: "BSD"
56 * c-basic-offset: 4
57 * tab-width: 4
58 * indent-tabs-mode: nil
59 * End:
60 */