asmmacro.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #ifndef _ASM_IA64_ASMMACRO_H
  2. #define _ASM_IA64_ASMMACRO_H
  3. /*
  4. * Copyright (C) 2000-2001, 2003-2004 Hewlett-Packard Co
  5. * David Mosberger-Tang <davidm@hpl.hp.com>
  6. */
  7. #include <linux/config.h>
  8. #define ENTRY(name) \
  9. .align 32; \
  10. .proc name; \
  11. name:
  12. #define ENTRY_MIN_ALIGN(name) \
  13. .align 16; \
  14. .proc name; \
  15. name:
  16. #define GLOBAL_ENTRY(name) \
  17. .global name; \
  18. ENTRY(name)
  19. #define END(name) \
  20. .endp name
  21. /*
  22. * Helper macros to make unwind directives more readable:
  23. */
  24. /* prologue_gr: */
  25. #define ASM_UNW_PRLG_RP 0x8
  26. #define ASM_UNW_PRLG_PFS 0x4
  27. #define ASM_UNW_PRLG_PSP 0x2
  28. #define ASM_UNW_PRLG_PR 0x1
  29. #define ASM_UNW_PRLG_GRSAVE(ninputs) (32+(ninputs))
  30. /*
  31. * Helper macros for accessing user memory.
  32. */
  33. .section "__ex_table", "a" // declare section & section attributes
  34. .previous
  35. # define EX(y,x...) \
  36. .xdata4 "__ex_table", 99f-., y-.; \
  37. [99:] x
  38. # define EXCLR(y,x...) \
  39. .xdata4 "__ex_table", 99f-., y-.+4; \
  40. [99:] x
  41. /*
  42. * Mark instructions that need a load of a virtual address patched to be
  43. * a load of a physical address. We use this either in critical performance
  44. * path (ivt.S - TLB miss processing) or in places where it might not be
  45. * safe to use a "tpa" instruction (mca_asm.S - error recovery).
  46. */
  47. .section ".data.patch.vtop", "a" // declare section & section attributes
  48. .previous
  49. #define LOAD_PHYSICAL(pr, reg, obj) \
  50. [1:](pr)movl reg = obj; \
  51. .xdata4 ".data.patch.vtop", 1b-.
  52. /*
  53. * For now, we always put in the McKinley E9 workaround. On CPUs that don't need it,
  54. * we'll patch out the work-around bundles with NOPs, so their impact is minimal.
  55. */
  56. #define DO_MCKINLEY_E9_WORKAROUND
  57. #ifdef DO_MCKINLEY_E9_WORKAROUND
  58. .section ".data.patch.mckinley_e9", "a"
  59. .previous
  60. /* workaround for Itanium 2 Errata 9: */
  61. # define FSYS_RETURN \
  62. .xdata4 ".data.patch.mckinley_e9", 1f-.; \
  63. 1:{ .mib; \
  64. nop.m 0; \
  65. mov r16=ar.pfs; \
  66. br.call.sptk.many b7=2f;; \
  67. }; \
  68. 2:{ .mib; \
  69. nop.m 0; \
  70. mov ar.pfs=r16; \
  71. br.ret.sptk.many b6;; \
  72. }
  73. #else
  74. # define FSYS_RETURN br.ret.sptk.many b6
  75. #endif
  76. /*
  77. * Up until early 2004, use of .align within a function caused bad unwind info.
  78. * TEXT_ALIGN(n) expands into ".align n" if a fixed GAS is available or into nothing
  79. * otherwise.
  80. */
  81. #ifdef HAVE_WORKING_TEXT_ALIGN
  82. # define TEXT_ALIGN(n) .align n
  83. #else
  84. # define TEXT_ALIGN(n)
  85. #endif
  86. #ifdef HAVE_SERIALIZE_DIRECTIVE
  87. # define dv_serialize_data .serialize.data
  88. # define dv_serialize_instruction .serialize.instruction
  89. #else
  90. # define dv_serialize_data
  91. # define dv_serialize_instruction
  92. #endif
  93. #endif /* _ASM_IA64_ASMMACRO_H */