special_insns.h 976 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef __PARISC_SPECIAL_INSNS_H
  2. #define __PARISC_SPECIAL_INSNS_H
  3. #define mfctl(reg) ({ \
  4. unsigned long cr; \
  5. __asm__ __volatile__( \
  6. "mfctl " #reg ",%0" : \
  7. "=r" (cr) \
  8. ); \
  9. cr; \
  10. })
  11. #define mtctl(gr, cr) \
  12. __asm__ __volatile__("mtctl %0,%1" \
  13. : /* no outputs */ \
  14. : "r" (gr), "i" (cr) : "memory")
  15. /* these are here to de-mystefy the calling code, and to provide hooks */
  16. /* which I needed for debugging EIEM problems -PB */
  17. #define get_eiem() mfctl(15)
  18. static inline void set_eiem(unsigned long val)
  19. {
  20. mtctl(val, 15);
  21. }
  22. #define mfsp(reg) ({ \
  23. unsigned long cr; \
  24. __asm__ __volatile__( \
  25. "mfsp " #reg ",%0" : \
  26. "=r" (cr) \
  27. ); \
  28. cr; \
  29. })
  30. #define mtsp(val, cr) \
  31. { if (__builtin_constant_p(val) && ((val) == 0)) \
  32. __asm__ __volatile__("mtsp %%r0,%0" : : "i" (cr) : "memory"); \
  33. else \
  34. __asm__ __volatile__("mtsp %0,%1" \
  35. : /* no outputs */ \
  36. : "r" (val), "i" (cr) : "memory"); }
  37. #endif /* __PARISC_SPECIAL_INSNS_H */