blob: 3d4dd68e181b44b2a8c2d089067bdca3ad0ab674 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
David Howells527dcdc2012-03-28 18:30:02 +01002#ifndef __PARISC_SPECIAL_INSNS_H
3#define __PARISC_SPECIAL_INSNS_H
4
5#define mfctl(reg) ({ \
6 unsigned long cr; \
7 __asm__ __volatile__( \
8 "mfctl " #reg ",%0" : \
9 "=r" (cr) \
10 ); \
11 cr; \
12})
13
14#define mtctl(gr, cr) \
15 __asm__ __volatile__("mtctl %0,%1" \
16 : /* no outputs */ \
17 : "r" (gr), "i" (cr) : "memory")
18
19/* these are here to de-mystefy the calling code, and to provide hooks */
20/* which I needed for debugging EIEM problems -PB */
21#define get_eiem() mfctl(15)
22static inline void set_eiem(unsigned long val)
23{
24 mtctl(val, 15);
25}
26
27#define mfsp(reg) ({ \
28 unsigned long cr; \
29 __asm__ __volatile__( \
30 "mfsp " #reg ",%0" : \
31 "=r" (cr) \
32 ); \
33 cr; \
34})
35
Helge Deller92b59922013-06-29 22:08:03 +020036#define mtsp(val, cr) \
37 { if (__builtin_constant_p(val) && ((val) == 0)) \
38 __asm__ __volatile__("mtsp %%r0,%0" : : "i" (cr) : "memory"); \
39 else \
40 __asm__ __volatile__("mtsp %0,%1" \
David Howells527dcdc2012-03-28 18:30:02 +010041 : /* no outputs */ \
Helge Deller92b59922013-06-29 22:08:03 +020042 : "r" (val), "i" (cr) : "memory"); }
David Howells527dcdc2012-03-28 18:30:02 +010043
44#endif /* __PARISC_SPECIAL_INSNS_H */