feature-fixups.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #ifndef __ASM_POWERPC_FEATURE_FIXUPS_H
  2. #define __ASM_POWERPC_FEATURE_FIXUPS_H
  3. /*
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version
  7. * 2 of the License, or (at your option) any later version.
  8. */
  9. #ifdef __ASSEMBLY__
  10. /*
  11. * Feature section common macros
  12. *
  13. * Note that the entries now contain offsets between the table entry
  14. * and the code rather than absolute code pointers in order to be
  15. * useable with the vdso shared library. There is also an assumption
  16. * that values will be negative, that is, the fixup table has to be
  17. * located after the code it fixes up.
  18. */
  19. #ifdef CONFIG_PPC64
  20. #ifdef __powerpc64__
  21. /* 64 bits kernel, 64 bits code */
  22. #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
  23. 99: \
  24. .section sect,"a"; \
  25. .align 3; \
  26. 98: \
  27. .llong msk; \
  28. .llong val; \
  29. .llong label##b-98b; \
  30. .llong 99b-98b; \
  31. .previous
  32. #else /* __powerpc64__ */
  33. /* 64 bits kernel, 32 bits code (ie. vdso32) */
  34. #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
  35. 99: \
  36. .section sect,"a"; \
  37. .align 3; \
  38. 98: \
  39. .llong msk; \
  40. .llong val; \
  41. .long 0xffffffff; \
  42. .long label##b-98b; \
  43. .long 0xffffffff; \
  44. .long 99b-98b; \
  45. .previous
  46. #endif /* !__powerpc64__ */
  47. #else /* CONFIG_PPC64 */
  48. /* 32 bits kernel, 32 bits code */
  49. #define MAKE_FTR_SECTION_ENTRY(msk, val, label, sect) \
  50. 99: \
  51. .section sect,"a"; \
  52. .align 2; \
  53. 98: \
  54. .long msk; \
  55. .long val; \
  56. .long label##b-98b; \
  57. .long 99b-98b; \
  58. .previous
  59. #endif /* !CONFIG_PPC64 */
  60. /* CPU feature dependent sections */
  61. #define BEGIN_FTR_SECTION_NESTED(label) label:
  62. #define BEGIN_FTR_SECTION BEGIN_FTR_SECTION_NESTED(97)
  63. #define END_FTR_SECTION_NESTED(msk, val, label) \
  64. MAKE_FTR_SECTION_ENTRY(msk, val, label, __ftr_fixup)
  65. #define END_FTR_SECTION(msk, val) \
  66. END_FTR_SECTION_NESTED(msk, val, 97)
  67. #define END_FTR_SECTION_IFSET(msk) END_FTR_SECTION((msk), (msk))
  68. #define END_FTR_SECTION_IFCLR(msk) END_FTR_SECTION((msk), 0)
  69. /* Firmware feature dependent sections */
  70. #define BEGIN_FW_FTR_SECTION_NESTED(label) label:
  71. #define BEGIN_FW_FTR_SECTION BEGIN_FW_FTR_SECTION_NESTED(97)
  72. #define END_FW_FTR_SECTION_NESTED(msk, val, label) \
  73. MAKE_FTR_SECTION_ENTRY(msk, val, label, __fw_ftr_fixup)
  74. #define END_FW_FTR_SECTION(msk, val) \
  75. END_FW_FTR_SECTION_NESTED(msk, val, 97)
  76. #define END_FW_FTR_SECTION_IFSET(msk) END_FW_FTR_SECTION((msk), (msk))
  77. #define END_FW_FTR_SECTION_IFCLR(msk) END_FW_FTR_SECTION((msk), 0)
  78. #endif /* __ASSEMBLY__ */
  79. #endif /* __ASM_POWERPC_FEATURE_FIXUPS_H */