Merge tag 'for-5.8/dm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[linux/fpc-iii.git] / arch / parisc / include / asm / special_insns.h
bloba303ae9a77f41fe8ceef5490ab2be5b394fc199d
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __PARISC_SPECIAL_INSNS_H
3 #define __PARISC_SPECIAL_INSNS_H
5 #define lpa(va) ({ \
6 unsigned long pa; \
7 __asm__ __volatile__( \
8 "copy %%r0,%0\n\t" \
9 "lpa %%r0(%1),%0" \
10 : "=r" (pa) \
11 : "r" (va) \
12 : "memory" \
13 ); \
14 pa; \
17 #define lpa_user(va) ({ \
18 unsigned long pa; \
19 __asm__ __volatile__( \
20 "copy %%r0,%0\n\t" \
21 "lpa %%r0(%%sr3,%1),%0" \
22 : "=r" (pa) \
23 : "r" (va) \
24 : "memory" \
25 ); \
26 pa; \
29 #define mfctl(reg) ({ \
30 unsigned long cr; \
31 __asm__ __volatile__( \
32 "mfctl " #reg ",%0" : \
33 "=r" (cr) \
34 ); \
35 cr; \
38 #define mtctl(gr, cr) \
39 __asm__ __volatile__("mtctl %0,%1" \
40 : /* no outputs */ \
41 : "r" (gr), "i" (cr) : "memory")
43 /* these are here to de-mystefy the calling code, and to provide hooks */
44 /* which I needed for debugging EIEM problems -PB */
45 #define get_eiem() mfctl(15)
46 static inline void set_eiem(unsigned long val)
48 mtctl(val, 15);
51 #define mfsp(reg) ({ \
52 unsigned long cr; \
53 __asm__ __volatile__( \
54 "mfsp " #reg ",%0" : \
55 "=r" (cr) \
56 ); \
57 cr; \
60 #define mtsp(val, cr) \
61 { if (__builtin_constant_p(val) && ((val) == 0)) \
62 __asm__ __volatile__("mtsp %%r0,%0" : : "i" (cr) : "memory"); \
63 else \
64 __asm__ __volatile__("mtsp %0,%1" \
65 : /* no outputs */ \
66 : "r" (val), "i" (cr) : "memory"); }
68 #endif /* __PARISC_SPECIAL_INSNS_H */