Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /*
  2.  * Copyright (c) 2009 Loren Merritt
  3.  *
  4.  * This file is part of FFmpeg.
  5.  *
  6.  * FFmpeg is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2.1 of the License, or (at your option) any later version.
  10.  *
  11.  * FFmpeg is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with FFmpeg; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19.  */
  20.  
  21. #include "config.h"
  22.  
  23. #define GLUE(a, b) a ## b
  24. #define JOIN(a, b) GLUE(a, b)
  25. #define X(s) JOIN(EXTERN_ASM, s)
  26.  
  27. #if ARCH_PPC64
  28.  
  29. #define PTR  .quad
  30. #define lp   ld
  31. #define lpx  ldx
  32. #define stp  std
  33. #define stpu stdu
  34. #define PS   8
  35. #define L(s) JOIN(., s)
  36.  
  37. .macro extfunc name
  38.     .global X(\name)
  39. #if _CALL_ELF == 2
  40.     .text
  41. X(\name):
  42.     addis %r2, %r12, .TOC.-X(\name)@ha
  43.     addi %r2, %r2, .TOC.-X(\name)@l
  44.     .localentry X(\name), .-X(\name)
  45. #else
  46.     .section .opd, "aw"
  47. X(\name):
  48.     .quad L(\name), .TOC.@tocbase, 0
  49.     .previous
  50.     .type X(\name), STT_FUNC
  51. L(\name):
  52. #endif
  53. .endm
  54.  
  55. .macro movrel rd, sym, gp
  56.     ld      \rd, \sym@got(r2)
  57. .endm
  58.  
  59. .macro get_got rd
  60. .endm
  61.  
  62. #else /* ARCH_PPC64 */
  63.  
  64. #define PTR  .int
  65. #define lp   lwz
  66. #define lpx  lwzx
  67. #define stp  stw
  68. #define stpu stwu
  69. #define PS   4
  70. #define L(s) s
  71.  
  72. .macro extfunc name
  73.     .global X(\name)
  74.     .type   X(\name), STT_FUNC
  75. X(\name):
  76. \name:
  77. .endm
  78.  
  79. .macro movrel rd, sym, gp
  80. #if CONFIG_PIC
  81.     lwz     \rd, \sym@got(\gp)
  82. #else
  83.     lis     \rd, \sym@ha
  84.     la      \rd, \sym@l(\rd)
  85. #endif
  86. .endm
  87.  
  88. .macro get_got rd
  89. #if CONFIG_PIC
  90.     bcl     20, 31, .Lgot\@
  91. .Lgot\@:
  92.     mflr    \rd
  93.     addis   \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@ha
  94.     addi    \rd, \rd, _GLOBAL_OFFSET_TABLE_ - .Lgot\@@l
  95. #endif
  96. .endm
  97.  
  98. #endif /* ARCH_PPC64 */
  99.  
  100. #if HAVE_IBM_ASM
  101.  
  102. .macro DEFINE_REG n
  103.     .equiv r\n, \n
  104.     .equiv f\n, \n
  105.     .equiv v\n, \n
  106. .endm
  107.  
  108. DEFINE_REG 0
  109. DEFINE_REG 1
  110. DEFINE_REG 2
  111. DEFINE_REG 3
  112. DEFINE_REG 4
  113. DEFINE_REG 5
  114. DEFINE_REG 6
  115. DEFINE_REG 7
  116. DEFINE_REG 8
  117. DEFINE_REG 9
  118. DEFINE_REG 10
  119. DEFINE_REG 11
  120. DEFINE_REG 12
  121. DEFINE_REG 13
  122. DEFINE_REG 14
  123. DEFINE_REG 15
  124. DEFINE_REG 16
  125. DEFINE_REG 17
  126. DEFINE_REG 18
  127. DEFINE_REG 19
  128. DEFINE_REG 20
  129. DEFINE_REG 21
  130. DEFINE_REG 22
  131. DEFINE_REG 23
  132. DEFINE_REG 24
  133. DEFINE_REG 25
  134. DEFINE_REG 26
  135. DEFINE_REG 27
  136. DEFINE_REG 28
  137. DEFINE_REG 29
  138. DEFINE_REG 30
  139. DEFINE_REG 31
  140.  
  141. #endif /* HAVE_IBM_ASM */
  142.