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
11 # define __CTL_LOAD "lctlg"
12 # define __CTL_STORE "stctg"
14 # define __CTL_LOAD "lctl"
15 # define __CTL_STORE "stctl"
18 #define __ctl_load(array, low, high) { \
19 typedef struct { char _[sizeof(array)]; } addrtype; \
21 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
23 __CTL_LOAD " %1,%2,%0\n" \
24 : : "Q" (*(addrtype *)(&array)), "i" (low), "i" (high));\
27 #define __ctl_store(array, low, high) { \
28 typedef struct { char _[sizeof(array)]; } addrtype; \
30 BUILD_BUG_ON(sizeof(addrtype) != (high - low + 1) * sizeof(long));\
32 __CTL_STORE " %1,%2,%0\n" \
33 : "=Q" (*(addrtype *)(&array)) \
34 : "i" (low), "i" (high)); \
37 static inline void __ctl_set_bit(unsigned int cr, unsigned int bit)
41 __ctl_store(reg, cr, cr);
43 __ctl_load(reg, cr, cr);
46 static inline void __ctl_clear_bit(unsigned int cr, unsigned int bit)
50 __ctl_store(reg, cr, cr);
52 __ctl_load(reg, cr, cr);
55 void smp_ctl_set_bit(int cr, int bit);
56 void smp_ctl_clear_bit(int cr, int bit);
59 # define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit)
60 # define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit)
62 # define ctl_set_bit(cr, bit) __ctl_set_bit(cr, bit)
63 # define ctl_clear_bit(cr, bit) __ctl_clear_bit(cr, bit)
66 #endif /* __ASM_CTL_REG_H */