movs.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef __MOVS_H__
  3. #define __MOVS_H__
  4. /*
  5. ** movs.h
  6. **
  7. ** Inline assembly macros to generate movs & related instructions
  8. */
  9. /* Set DFC register value */
  10. #define SET_DFC(x) \
  11. __asm__ __volatile__ (" movec %0,%/dfc" : : "d" (x));
  12. /* Get DFC register value */
  13. #define GET_DFC(x) \
  14. __asm__ __volatile__ (" movec %/dfc, %0" : "=d" (x) : );
  15. /* Set SFC register value */
  16. #define SET_SFC(x) \
  17. __asm__ __volatile__ (" movec %0,%/sfc" : : "d" (x));
  18. /* Get SFC register value */
  19. #define GET_SFC(x) \
  20. __asm__ __volatile__ (" movec %/sfc, %0" : "=d" (x) : );
  21. #define SET_VBR(x) \
  22. __asm__ __volatile__ (" movec %0,%/vbr" : : "r" (x));
  23. #define GET_VBR(x) \
  24. __asm__ __volatile__ (" movec %/vbr, %0" : "=g" (x) : );
  25. /* Set a byte using the "movs" instruction */
  26. #define SET_CONTROL_BYTE(addr,value) \
  27. __asm__ __volatile__ (" movsb %0, %1@" : : "d" (value), "a" (addr));
  28. /* Get a byte using the "movs" instruction */
  29. #define GET_CONTROL_BYTE(addr,value) \
  30. __asm__ __volatile__ (" movsb %1@, %0" : "=d" (value) : "a" (addr));
  31. /* Set a (long)word using the "movs" instruction */
  32. #define SET_CONTROL_WORD(addr,value) \
  33. __asm__ __volatile__ (" movsl %0, %1@" : : "d" (value), "a" (addr));
  34. /* Get a (long)word using the "movs" instruction */
  35. #define GET_CONTROL_WORD(addr,value) \
  36. __asm__ __volatile__ (" movsl %1@, %0" : "=d" (value) : "a" (addr));
  37. #endif