movs.h 1.4 KB

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