2 * Copyright IBM Corp. 1999, 2009
4 * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com>
7 #ifndef __ASM_CTL_REG_H
8 #define __ASM_CTL_REG_H
12 #define __ctl_load(array, low, high) ({ \
13 typedef struct { char _[sizeof(array)]; } addrtype; \
16 : : "Q" (*(addrtype *)(&array)), \
17 "i" (low), "i" (high)); \
20 #define __ctl_store(array, low, high) ({ \
21 typedef struct { char _[sizeof(array)]; } addrtype; \
24 : "=Q" (*(addrtype *)(&array)) \
25 : "i" (low), "i" (high)); \
28 #else /* CONFIG_64BIT */
30 #define __ctl_load(array, low, high) ({ \
31 typedef struct { char _[sizeof(array)]; } addrtype; \
34 : : "Q" (*(addrtype *)(&array)), \
35 "i" (low), "i" (high)); \
38 #define __ctl_store(array, low, high) ({ \
39 typedef struct { char _[sizeof(array)]; } addrtype; \
42 : "=Q" (*(addrtype *)(&array)) \
43 : "i" (low), "i" (high)); \
46 #endif /* CONFIG_64BIT */
48 #define __ctl_set_bit(cr, bit) ({ \
49 unsigned long __dummy; \
50 __ctl_store(__dummy, cr, cr); \
51 __dummy |= 1UL << (bit); \
52 __ctl_load(__dummy, cr, cr); \
55 #define __ctl_clear_bit(cr, bit) ({ \
56 unsigned long __dummy; \
57 __ctl_store(__dummy, cr, cr); \
58 __dummy &= ~(1UL << (bit)); \
59 __ctl_load(__dummy, cr, cr); \
64 extern void smp_ctl_set_bit(int cr
, int bit
);
65 extern void smp_ctl_clear_bit(int cr
, int bit
);
66 #define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
67 #define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
71 #define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
72 #define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
74 #endif /* CONFIG_SMP */
76 #endif /* __ASM_CTL_REG_H */