asm-compat.h 2.3 KB

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