asm-compat.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #ifndef _ASM_POWERPC_ASM_COMPAT_H
  2. #define _ASM_POWERPC_ASM_COMPAT_H
  3. #include <asm/types.h>
  4. #include <asm/ppc-opcode.h>
  5. #ifdef __ASSEMBLY__
  6. # define stringify_in_c(...) __VA_ARGS__
  7. # define ASM_CONST(x) x
  8. #else
  9. /* This version of stringify will deal with commas... */
  10. # define __stringify_in_c(...) #__VA_ARGS__
  11. # define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " "
  12. # define __ASM_CONST(x) x##UL
  13. # define ASM_CONST(x) __ASM_CONST(x)
  14. #endif
  15. #ifdef __powerpc64__
  16. /* operations for longs and pointers */
  17. #define PPC_LL stringify_in_c(ld)
  18. #define PPC_STL stringify_in_c(std)
  19. #define PPC_STLU stringify_in_c(stdu)
  20. #define PPC_LCMPI stringify_in_c(cmpdi)
  21. #define PPC_LONG stringify_in_c(.llong)
  22. #define PPC_LONG_ALIGN stringify_in_c(.balign 8)
  23. #define PPC_TLNEI stringify_in_c(tdnei)
  24. #define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh)
  25. #define PPC_STLCX stringify_in_c(stdcx.)
  26. #define PPC_CNTLZL stringify_in_c(cntlzd)
  27. #define PPC_LR_STKOFF 16
  28. /* Move to CR, single-entry optimized version. Only available
  29. * on POWER4 and later.
  30. */
  31. #ifdef CONFIG_POWER4_ONLY
  32. #define PPC_MTOCRF stringify_in_c(mtocrf)
  33. #else
  34. #define PPC_MTOCRF stringify_in_c(mtcrf)
  35. #endif
  36. #else /* 32-bit */
  37. /* operations for longs and pointers */
  38. #define PPC_LL stringify_in_c(lwz)
  39. #define PPC_STL stringify_in_c(stw)
  40. #define PPC_STLU stringify_in_c(stwu)
  41. #define PPC_LCMPI stringify_in_c(cmpwi)
  42. #define PPC_LONG stringify_in_c(.long)
  43. #define PPC_LONG_ALIGN stringify_in_c(.balign 4)
  44. #define PPC_TLNEI stringify_in_c(twnei)
  45. #define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
  46. #define PPC_STLCX stringify_in_c(stwcx.)
  47. #define PPC_CNTLZL stringify_in_c(cntlzw)
  48. #define PPC_MTOCRF stringify_in_c(mtcrf)
  49. #define PPC_LR_STKOFF 4
  50. #endif
  51. #ifdef __KERNEL__
  52. #ifdef CONFIG_IBM405_ERR77
  53. /* Erratum #77 on the 405 means we need a sync or dcbt before every
  54. * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
  55. */
  56. #define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
  57. #define PPC405_ERR77_SYNC stringify_in_c(sync;)
  58. #else
  59. #define PPC405_ERR77(ra,rb)
  60. #define PPC405_ERR77_SYNC
  61. #endif
  62. #endif
  63. #endif /* _ASM_POWERPC_ASM_COMPAT_H */