asm-compat.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #define PPC_MIN_STKFRM 112
  29. /* Move to CR, single-entry optimized version. Only available
  30. * on POWER4 and later.
  31. */
  32. #ifdef CONFIG_POWER4_ONLY
  33. #define PPC_MTOCRF stringify_in_c(mtocrf)
  34. #else
  35. #define PPC_MTOCRF stringify_in_c(mtcrf)
  36. #endif
  37. #else /* 32-bit */
  38. /* operations for longs and pointers */
  39. #define PPC_LL stringify_in_c(lwz)
  40. #define PPC_STL stringify_in_c(stw)
  41. #define PPC_STLU stringify_in_c(stwu)
  42. #define PPC_LCMPI stringify_in_c(cmpwi)
  43. #define PPC_LONG stringify_in_c(.long)
  44. #define PPC_LONG_ALIGN stringify_in_c(.balign 4)
  45. #define PPC_TLNEI stringify_in_c(twnei)
  46. #define PPC_LLARX(t, a, b, eh) PPC_LWARX(t, a, b, eh)
  47. #define PPC_STLCX stringify_in_c(stwcx.)
  48. #define PPC_CNTLZL stringify_in_c(cntlzw)
  49. #define PPC_MTOCRF stringify_in_c(mtcrf)
  50. #define PPC_LR_STKOFF 4
  51. #define PPC_MIN_STKFRM 16
  52. #endif
  53. #ifdef __KERNEL__
  54. #ifdef CONFIG_IBM405_ERR77
  55. /* Erratum #77 on the 405 means we need a sync or dcbt before every
  56. * stwcx. The old ATOMIC_SYNC_FIX covered some but not all of this.
  57. */
  58. #define PPC405_ERR77(ra,rb) stringify_in_c(dcbt ra, rb;)
  59. #define PPC405_ERR77_SYNC stringify_in_c(sync;)
  60. #else
  61. #define PPC405_ERR77(ra,rb)
  62. #define PPC405_ERR77_SYNC
  63. #endif
  64. #endif
  65. #endif /* _ASM_POWERPC_ASM_COMPAT_H */