Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /* Replace functions for the ARC relocs.
  2.    Copyright 2015
  3.    Free Software Foundation, Inc.
  4.  
  5.    This file is part of GAS, the GNU Assembler, GDB, the GNU debugger, and
  6.    the GNU Binutils.
  7.  
  8.    GAS/GDB is free software; you can redistribute it and/or modify
  9.    it under the terms of the GNU General Public License as published by
  10.    the Free Software Foundation; either version 3, or (at your option)
  11.    any later version.
  12.  
  13.    GAS/GDB is distributed in the hope that it will be useful,
  14.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16.    GNU General Public License for more details.
  17.  
  18.    You should have received a copy of the GNU General Public License
  19.    along with GAS or GDB; see the file COPYING3.  If not, write to
  20.    the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
  21.    MA 02110-1301, USA.  */
  22.  
  23. /* mask  = 00000000000000000000000000000000.  */
  24. #ifndef REPLACE_none
  25. #define REPLACE_none
  26. ATTRIBUTE_UNUSED static unsigned
  27. replace_none (unsigned insn, int value ATTRIBUTE_UNUSED)
  28. {
  29.  
  30.   return insn;
  31. }
  32.  
  33. #endif /* REPLACE_none */
  34.  
  35. /* mask  = 11111111.  */
  36. #ifndef REPLACE_bits8
  37. #define REPLACE_bits8
  38. ATTRIBUTE_UNUSED static unsigned
  39. replace_bits8 (unsigned insn, int value ATTRIBUTE_UNUSED)
  40. {
  41.   insn |= ((value >> 0) & 0x00ff) << 0;
  42.  
  43.   return insn;
  44. }
  45.  
  46. #endif /* REPLACE_bits8 */
  47.  
  48. /* mask  = 1111111111111111.  */
  49. #ifndef REPLACE_bits16
  50. #define REPLACE_bits16
  51. ATTRIBUTE_UNUSED static unsigned
  52. replace_bits16 (unsigned insn, int value ATTRIBUTE_UNUSED)
  53. {
  54.   insn |= ((value >> 0) & 0xffff) << 0;
  55.  
  56.   return insn;
  57. }
  58.  
  59. #endif /* REPLACE_bits16 */
  60.  
  61. /* mask  = 111111111111111111111111.  */
  62. #ifndef REPLACE_bits24
  63. #define REPLACE_bits24
  64. ATTRIBUTE_UNUSED static unsigned
  65. replace_bits24 (unsigned insn, int value ATTRIBUTE_UNUSED)
  66. {
  67.   insn |= ((value >> 0) & 0xffffff) << 0;
  68.  
  69.   return insn;
  70. }
  71.  
  72. #endif /* REPLACE_bits24 */
  73.  
  74. /* mask  = 11111111111111111111111111111111.  */
  75. #ifndef REPLACE_word32
  76. #define REPLACE_word32
  77. ATTRIBUTE_UNUSED static unsigned
  78. replace_word32 (unsigned insn, int value ATTRIBUTE_UNUSED)
  79. {
  80.   insn |= ((value >> 0) & 0xffffffff) << 0;
  81.  
  82.   return insn;
  83. }
  84.  
  85. #endif /* REPLACE_word32 */
  86.  
  87. /* mask  = 0000000000000000000000000000000011111111111111111111111111111111.  */
  88. #ifndef REPLACE_limm
  89. #define REPLACE_limm
  90. ATTRIBUTE_UNUSED static unsigned
  91. replace_limm (unsigned insn, int value ATTRIBUTE_UNUSED)
  92. {
  93.   insn |= ((value >> 0) & 0xffffffff) << 0;
  94.  
  95.   return insn;
  96. }
  97.  
  98. #endif /* REPLACE_limm */
  99.  
  100. /* mask  = 000000000000000011111111111111111111111111111111.  */
  101. #ifndef REPLACE_limms
  102. #define REPLACE_limms
  103. ATTRIBUTE_UNUSED static unsigned
  104. replace_limms (unsigned insn, int value ATTRIBUTE_UNUSED)
  105. {
  106.   insn |= ((value >> 0) & 0xffffffff) << 0;
  107.  
  108.   return insn;
  109. }
  110.  
  111. #endif /* REPLACE_limms */
  112.  
  113. /* mask  = 00000111111111102222222222000000.  */
  114. #ifndef REPLACE_disp21h
  115. #define REPLACE_disp21h
  116. ATTRIBUTE_UNUSED static unsigned
  117. replace_disp21h (unsigned insn, int value ATTRIBUTE_UNUSED)
  118. {
  119.   insn |= ((value >> 0) & 0x03ff) << 17;
  120.   insn |= ((value >> 10) & 0x03ff) << 6;
  121.  
  122.   return insn;
  123. }
  124.  
  125. #endif /* REPLACE_disp21h */
  126.  
  127. /* mask  = 00000111111111002222222222000000.  */
  128. #ifndef REPLACE_disp21w
  129. #define REPLACE_disp21w
  130. ATTRIBUTE_UNUSED static unsigned
  131. replace_disp21w (unsigned insn, int value ATTRIBUTE_UNUSED)
  132. {
  133.   insn |= ((value >> 0) & 0x01ff) << 18;
  134.   insn |= ((value >> 9) & 0x03ff) << 6;
  135.  
  136.   return insn;
  137. }
  138.  
  139. #endif /* REPLACE_disp21w */
  140.  
  141. /* mask  = 00000111111111102222222222003333.  */
  142. #ifndef REPLACE_disp25h
  143. #define REPLACE_disp25h
  144. ATTRIBUTE_UNUSED static unsigned
  145. replace_disp25h (unsigned insn, int value ATTRIBUTE_UNUSED)
  146. {
  147.   insn |= ((value >> 0) & 0x03ff) << 17;
  148.   insn |= ((value >> 10) & 0x03ff) << 6;
  149.   insn |= ((value >> 20) & 0x000f) << 0;
  150.  
  151.   return insn;
  152. }
  153.  
  154. #endif /* REPLACE_disp25h */
  155.  
  156. /* mask  = 00000111111111002222222222003333.  */
  157. #ifndef REPLACE_disp25w
  158. #define REPLACE_disp25w
  159. ATTRIBUTE_UNUSED static unsigned
  160. replace_disp25w (unsigned insn, int value ATTRIBUTE_UNUSED)
  161. {
  162.   insn |= ((value >> 0) & 0x01ff) << 18;
  163.   insn |= ((value >> 9) & 0x03ff) << 6;
  164.   insn |= ((value >> 19) & 0x000f) << 0;
  165.  
  166.   return insn;
  167. }
  168.  
  169. #endif /* REPLACE_disp25w */
  170.  
  171. /* mask  = 00000000000000000000000111111111.  */
  172. #ifndef REPLACE_disp9
  173. #define REPLACE_disp9
  174. ATTRIBUTE_UNUSED static unsigned
  175. replace_disp9 (unsigned insn, int value ATTRIBUTE_UNUSED)
  176. {
  177.   insn |= ((value >> 0) & 0x01ff) << 0;
  178.  
  179.   return insn;
  180. }
  181.  
  182. #endif /* REPLACE_disp9 */
  183.  
  184. /* mask  = 00000000111111112000000000000000.  */
  185. #ifndef REPLACE_disp9ls
  186. #define REPLACE_disp9ls
  187. ATTRIBUTE_UNUSED static unsigned
  188. replace_disp9ls (unsigned insn, int value ATTRIBUTE_UNUSED)
  189. {
  190.   insn |= ((value >> 0) & 0x00ff) << 16;
  191.   insn |= ((value >> 8) & 0x0001) << 15;
  192.  
  193.   return insn;
  194. }
  195.  
  196. #endif /* REPLACE_disp9ls */
  197.  
  198. /* mask  = 0000000111111111.  */
  199. #ifndef REPLACE_disp9s
  200. #define REPLACE_disp9s
  201. ATTRIBUTE_UNUSED static unsigned
  202. replace_disp9s (unsigned insn, int value ATTRIBUTE_UNUSED)
  203. {
  204.   insn |= ((value >> 0) & 0x01ff) << 0;
  205.  
  206.   return insn;
  207. }
  208.  
  209. #endif /* REPLACE_disp9s */
  210.  
  211. /* mask  = 0000011111111111.  */
  212. #ifndef REPLACE_disp13s
  213. #define REPLACE_disp13s
  214. ATTRIBUTE_UNUSED static unsigned
  215. replace_disp13s (unsigned insn, int value ATTRIBUTE_UNUSED)
  216. {
  217.   insn |= ((value >> 0) & 0x07ff) << 0;
  218.  
  219.   return insn;
  220. }
  221.  
  222. #endif /* REPLACE_disp13s */
  223.  
  224. /* mask  = 0000022222200111.  */
  225. #ifndef REPLACE_disp9s1
  226. #define REPLACE_disp9s1
  227. ATTRIBUTE_UNUSED static unsigned
  228. replace_disp9s1 (unsigned insn, int value ATTRIBUTE_UNUSED)
  229. {
  230.   insn |= ((value >> 0) & 0x0007) << 0;
  231.   insn |= ((value >> 3) & 0x003f) << 5;
  232.  
  233.   return insn;
  234. }
  235.  
  236. #endif /* REPLACE_disp9s1 */
  237.