powerpc_darwin_mach_dep.s 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #if defined(__ppc64__)
  2. #define MODE_CHOICE(x, y) y
  3. #else
  4. #define MODE_CHOICE(x, y) x
  5. #endif
  6. #define machine_choice MODE_CHOICE(ppc7400,ppc64)
  7. ; Define some pseudo-opcodes for size-independent load & store of GPRs ...
  8. #define lgu MODE_CHOICE(lwzu, ldu)
  9. #define lg MODE_CHOICE(lwz,ld)
  10. #define sg MODE_CHOICE(stw,std)
  11. #define sgu MODE_CHOICE(stwu,stdu)
  12. ; ... and the size of GPRs and their storage indicator.
  13. #define GPR_BYTES MODE_CHOICE(4,8)
  14. #define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */
  15. #define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */
  16. ; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04.
  17. #define LINKAGE_SIZE MODE_CHOICE(24,48)
  18. #define PARAM_AREA MODE_CHOICE(32,64)
  19. #define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */
  20. ; The whole stack frame **MUST** be 16byte-aligned.
  21. #define SAVE_SIZE (LINKAGE_SIZE+PARAM_AREA)
  22. #if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050
  23. ; We no longer need the pic symbol stub for Darwin >= 9.
  24. #define BLGCP1 _GC_push_one
  25. #undef WANT_STUB
  26. #else
  27. #define BLGCP1 L_GC_push_one$stub
  28. #define WANT_STUB
  29. #endif
  30. .machine machine_choice
  31. ; GC_push_regs function. Under some optimization levels GCC will clobber
  32. ; some of the non-volatile registers before we get a chance to save them
  33. ; therefore, this cannot be inline asm.
  34. .text
  35. .align LOG2_GPR_BYTES
  36. .globl _GC_push_regs
  37. _GC_push_regs:
  38. ; Prolog
  39. mflr r0
  40. sg r0,SAVED_LR_OFFSET(r1)
  41. sgu r1,-SAVE_SIZE(r1)
  42. L_body:
  43. ; 'Push' r13-r31
  44. mr r3,r13
  45. bl BLGCP1
  46. mr r3,r14
  47. bl BLGCP1
  48. mr r3,r15
  49. bl BLGCP1
  50. mr r3,r16
  51. bl BLGCP1
  52. mr r3,r17
  53. bl BLGCP1
  54. mr r3,r18
  55. bl BLGCP1
  56. mr r3,r19
  57. bl BLGCP1
  58. mr r3,r20
  59. bl BLGCP1
  60. mr r3,r21
  61. bl BLGCP1
  62. mr r3,r22
  63. bl BLGCP1
  64. mr r3,r23
  65. bl BLGCP1
  66. mr r3,r24
  67. bl BLGCP1
  68. mr r3,r25
  69. bl BLGCP1
  70. mr r3,r26
  71. bl BLGCP1
  72. mr r3,r27
  73. bl BLGCP1
  74. mr r3,r28
  75. bl BLGCP1
  76. mr r3,r29
  77. bl BLGCP1
  78. mr r3,r30
  79. bl BLGCP1
  80. mr r3,r31
  81. bl BLGCP1
  82. L_epilog:
  83. ; Epilog
  84. lg r0,SAVE_SIZE+SAVED_LR_OFFSET(r1)
  85. addi r1,r1,SAVE_SIZE
  86. mtlr r0
  87. ; Return
  88. blr
  89. LFE0:
  90. ; eh frames, for those that want 'em.
  91. #define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78)
  92. #define EH_FRAME_OFFSET MODE_CHOICE(0x40,0x70)
  93. .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support
  94. EH_frame1:
  95. .set L$set$0,LECIE1-LSCIE1
  96. .long L$set$0 ; Length of Common Information Entry
  97. LSCIE1:
  98. .long 0 ; CIE Identifier Tag
  99. .byte 0x1 ; CIE Version
  100. .ascii "zR\0" ; CIE Augmentation
  101. .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
  102. .byte EH_DATA_ALIGN_FACT ; sleb128 -4/-8; CIE Data Alignment Factor
  103. .byte 0x41 ; CIE RA Column
  104. .byte 0x1 ; uleb128 0x1; Augmentation size
  105. .byte 0x10 ; FDE Encoding (pcrel)
  106. .byte 0xc ; DW_CFA_def_cfa
  107. .byte 0x1 ; uleb128 0x1
  108. .byte 0 ; uleb128 0
  109. .align LOG2_GPR_BYTES
  110. LECIE1:
  111. .globl _GC_push_regs.eh
  112. _GC_push_regs.eh:
  113. LSFDE1:
  114. .set L$set$1,LEFDE1-LASFDE1
  115. .long L$set$1 ; FDE Length
  116. LASFDE1:
  117. .long LASFDE1-EH_frame1 ; FDE CIE offset
  118. .g_long _GC_push_regs-. ; FDE initial location
  119. .set L$set$2,LFE0-_GC_push_regs
  120. .g_long L$set$2 ; FDE address range
  121. .byte 0 ; uleb128 0; Augmentation size
  122. .byte 0x4 ; DW_CFA_advance_loc4
  123. .set L$set$3,L_body-_GC_push_regs
  124. .long L$set$3
  125. .byte 0xe ; DW_CFA_def_cfa_offset
  126. .byte EH_FRAME_OFFSET ; uleb128 0x40/0x70
  127. .byte 0x11 ; DW_CFA_offset_extended_sf
  128. .byte 0x41 ; uleb128 0x41
  129. .byte 0x7e ; sleb128 -2
  130. .byte 0x4 ; DW_CFA_advance_loc4
  131. .set L$set$4,L_epilog-L_body
  132. .long L$set$4
  133. .byte 0xe ; DW_CFA_def_cfa_offset
  134. .byte 0 ; uleb128 0
  135. .align LOG2_GPR_BYTES
  136. LEFDE1:
  137. .data
  138. #ifdef WANT_STUB
  139. ; PIC stub stuff, generated by GCC
  140. .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32
  141. .align LOG2_GPR_BYTES
  142. L_GC_push_one$stub:
  143. .indirect_symbol _GC_push_one
  144. mflr r0
  145. bcl 20,31,L0$_GC_push_one
  146. L0$_GC_push_one:
  147. mflr r11
  148. addis r11,r11,ha16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)
  149. mtlr r0
  150. lgu r12,lo16(L_GC_push_one$lazy_ptr-L0$_GC_push_one)(r11)
  151. mtctr r12
  152. bctr
  153. .data
  154. .lazy_symbol_pointer
  155. L_GC_push_one$lazy_ptr:
  156. .indirect_symbol _GC_push_one
  157. .g_long dyld_stub_binding_helper
  158. #endif