Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
David Howells | 527dcdc | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 2 | #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) |
| 22 | static 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 Deller | 92b5992 | 2013-06-29 22:08:03 +0200 | [diff] [blame] | 36 | #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 Howells | 527dcdc | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 41 | : /* no outputs */ \ |
Helge Deller | 92b5992 | 2013-06-29 22:08:03 +0200 | [diff] [blame] | 42 | : "r" (val), "i" (cr) : "memory"); } |
David Howells | 527dcdc | 2012-03-28 18:30:02 +0100 | [diff] [blame] | 43 | |
| 44 | #endif /* __PARISC_SPECIAL_INSNS_H */ |