asm-compat.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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_LCMPLI stringify_in_c(cmpldi)
  22. #define PPC_LCMP stringify_in_c(cmpd)
  23. #define PPC_LONG stringify_in_c(.llong)
  24. #define PPC_LONG_ALIGN stringify_in_c(.balign 8)
  25. #define PPC_TLNEI stringify_in_c(tdnei)
  26. #define PPC_LLARX(t, a, b, eh) PPC_LDARX(t, a, b, eh)
  27. #define PPC_STLCX stringify_in_c(stdcx.)
  28. #define PPC_CNTLZL stringify_in_c(cntlzd)
  29. #define PPC_MTOCRF(FXM, RS) MTOCRF((FXM), RS)
  30. #define PPC_LR_STKOFF 16
  31. #define PPC_MIN_STKFRM 112
  32. #ifdef __BIG_ENDIAN__
  33. #define LWZX_BE stringify_in_c(lwzx)
  34. #define LDX_BE stringify_in_c(ldx)
  35. #define STWX_BE stringify_in_c(stwx)
  36. #define STDX_BE stringify_in_c(stdx)
  37. #else
  38. #define LWZX_BE stringify_in_c(lwbrx)
  39. #define LDX_BE stringify_in_c(ldbrx)
  40. #define STWX_BE stringify_in_c(stwbrx)
  41. #define STDX_BE stringify_in_c(stdbrx)
  42. #endif
  43. #else /* 32-bit */
  44. /* operations for longs and pointers */
  45. #define PPC_LL stringify_in_c(lwz)
  46. #define PPC_STL stringify_in_c(stw)
  47. #define PPC_STLU stringify_in_c(stwu)
  48. #define PPC_LCMPI stringify_in_c(cmpwi)
  49. #define PPC_LCMPLI stringify_in_c(cmplwi)
  50. #define PPC_LCMP stringify_in_c(cmpw)
  51. #define PPC_LONG stringify_in_c(.long)
  52. #define PPC_LONG_ALIGN stringify_in_c(.balign 4)
  53. #define PPC_TLNEI stringify_in_c(twnei)
  54. #define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
  55. #define PPC_STLCX stringify_in_c(stwcx.)
  56. #define PPC_CNTLZL stringify_in_c(cntlzw)
  57. #define PPC_MTOCRF stringify_in_c(mtcrf)
  58. #define PPC_LR_STKOFF 4
  59. #define PPC_MIN_STKFRM 16
  60. #endif
  61. #ifdef __KERNEL__
  62. #ifdef CONFIG_IBM405_ERR77
  63. /* Erratum #77 on the 405 means we need a sync or dcbt before every
  64. * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
  65. */
  66. #define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
  67. #define PPC405_ERR77_SYNC stringify_in_c(sync;)
  68. #else
  69. #define PPC405_ERR77(ra,rb)
  70. #define PPC405_ERR77_SYNC
  71. #endif
  72. #endif
  73. #endif /* _ASM_POWERPC_ASM_COMPAT_H */