Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

176 lines
8.3KB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html>
  3. <!-- Copyright (C) 1988-2020 Free Software Foundation, Inc.
  4. Permission is granted to copy, distribute and/or modify this document
  5. under the terms of the GNU Free Documentation License, Version 1.3 or
  6. any later version published by the Free Software Foundation; with the
  7. Invariant Sections being "Funding Free Software", the Front-Cover
  8. Texts being (a) (see below), and with the Back-Cover Texts being (b)
  9. (see below). A copy of the license is included in the section entitled
  10. "GNU Free Documentation License".
  11. (a) The FSF's Front-Cover Text is:
  12. A GNU Manual
  13. (b) The FSF's Back-Cover Text is:
  14. You have freedom to copy and modify this GNU Manual, like GNU
  15. software. Copies published by the Free Software Foundation raise
  16. funds for GNU development. -->
  17. <!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
  18. <head>
  19. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  20. <title>SH Function Attributes (Using the GNU Compiler Collection (GCC))</title>
  21. <meta name="description" content="SH Function Attributes (Using the GNU Compiler Collection (GCC))">
  22. <meta name="keywords" content="SH Function Attributes (Using the GNU Compiler Collection (GCC))">
  23. <meta name="resource-type" content="document">
  24. <meta name="distribution" content="global">
  25. <meta name="Generator" content="makeinfo">
  26. <link href="index.html#Top" rel="start" title="Top">
  27. <link href="Option-Index.html#Option-Index" rel="index" title="Option Index">
  28. <link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
  29. <link href="Function-Attributes.html#Function-Attributes" rel="up" title="Function Attributes">
  30. <link href="Symbian-OS-Function-Attributes.html#Symbian-OS-Function-Attributes" rel="next" title="Symbian OS Function Attributes">
  31. <link href="S_002f390-Function-Attributes.html#S_002f390-Function-Attributes" rel="prev" title="S/390 Function Attributes">
  32. <style type="text/css">
  33. <!--
  34. a.summary-letter {text-decoration: none}
  35. blockquote.indentedblock {margin-right: 0em}
  36. blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
  37. blockquote.smallquotation {font-size: smaller}
  38. div.display {margin-left: 3.2em}
  39. div.example {margin-left: 3.2em}
  40. div.lisp {margin-left: 3.2em}
  41. div.smalldisplay {margin-left: 3.2em}
  42. div.smallexample {margin-left: 3.2em}
  43. div.smalllisp {margin-left: 3.2em}
  44. kbd {font-style: oblique}
  45. pre.display {font-family: inherit}
  46. pre.format {font-family: inherit}
  47. pre.menu-comment {font-family: serif}
  48. pre.menu-preformatted {font-family: serif}
  49. pre.smalldisplay {font-family: inherit; font-size: smaller}
  50. pre.smallexample {font-size: smaller}
  51. pre.smallformat {font-family: inherit; font-size: smaller}
  52. pre.smalllisp {font-size: smaller}
  53. span.nolinebreak {white-space: nowrap}
  54. span.roman {font-family: initial; font-weight: normal}
  55. span.sansserif {font-family: sans-serif; font-weight: normal}
  56. ul.no-bullet {list-style: none}
  57. -->
  58. </style>
  59. </head>
  60. <body lang="en">
  61. <a name="SH-Function-Attributes"></a>
  62. <div class="header">
  63. <p>
  64. Next: <a href="Symbian-OS-Function-Attributes.html#Symbian-OS-Function-Attributes" accesskey="n" rel="next">Symbian OS Function Attributes</a>, Previous: <a href="S_002f390-Function-Attributes.html#S_002f390-Function-Attributes" accesskey="p" rel="prev">S/390 Function Attributes</a>, Up: <a href="Function-Attributes.html#Function-Attributes" accesskey="u" rel="up">Function Attributes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  65. </div>
  66. <hr>
  67. <a name="SH-Function-Attributes-1"></a>
  68. <h4 class="subsection">6.33.31 SH Function Attributes</h4>
  69. <p>These function attributes are supported on the SH family of processors:
  70. </p>
  71. <dl compact="compact">
  72. <dt><code>function_vector</code></dt>
  73. <dd><a name="index-function_005fvector-function-attribute_002c-SH"></a>
  74. <a name="index-calling-functions-through-the-function-vector-on-SH2A"></a>
  75. <p>On SH2A targets, this attribute declares a function to be called using the
  76. TBR relative addressing mode. The argument to this attribute is the entry
  77. number of the same function in a vector table containing all the TBR
  78. relative addressable functions. For correct operation the TBR must be setup
  79. accordingly to point to the start of the vector table before any functions with
  80. this attribute are invoked. Usually a good place to do the initialization is
  81. the startup routine. The TBR relative vector table can have at max 256 function
  82. entries. The jumps to these functions are generated using a SH2A specific,
  83. non delayed branch instruction JSR/N @(disp8,TBR). You must use GAS and GLD
  84. from GNU binutils version 2.7 or later for this attribute to work correctly.
  85. </p>
  86. <p>In an application, for a function being called once, this attribute
  87. saves at least 8 bytes of code; and if other successive calls are being
  88. made to the same function, it saves 2 bytes of code per each of these
  89. calls.
  90. </p>
  91. </dd>
  92. <dt><code>interrupt_handler</code></dt>
  93. <dd><a name="index-interrupt_005fhandler-function-attribute_002c-SH"></a>
  94. <p>Use this attribute to
  95. indicate that the specified function is an interrupt handler. The compiler
  96. generates function entry and exit sequences suitable for use in an
  97. interrupt handler when this attribute is present.
  98. </p>
  99. </dd>
  100. <dt><code>nosave_low_regs</code></dt>
  101. <dd><a name="index-nosave_005flow_005fregs-function-attribute_002c-SH"></a>
  102. <p>Use this attribute on SH targets to indicate that an <code>interrupt_handler</code>
  103. function should not save and restore registers R0..R7. This can be used on SH3*
  104. and SH4* targets that have a second R0..R7 register bank for non-reentrant
  105. interrupt handlers.
  106. </p>
  107. </dd>
  108. <dt><code>renesas</code></dt>
  109. <dd><a name="index-renesas-function-attribute_002c-SH"></a>
  110. <p>On SH targets this attribute specifies that the function or struct follows the
  111. Renesas ABI.
  112. </p>
  113. </dd>
  114. <dt><code>resbank</code></dt>
  115. <dd><a name="index-resbank-function-attribute_002c-SH"></a>
  116. <p>On the SH2A target, this attribute enables the high-speed register
  117. saving and restoration using a register bank for <code>interrupt_handler</code>
  118. routines. Saving to the bank is performed automatically after the CPU
  119. accepts an interrupt that uses a register bank.
  120. </p>
  121. <p>The nineteen 32-bit registers comprising general register R0 to R14,
  122. control register GBR, and system registers MACH, MACL, and PR and the
  123. vector table address offset are saved into a register bank. Register
  124. banks are stacked in first-in last-out (FILO) sequence. Restoration
  125. from the bank is executed by issuing a RESBANK instruction.
  126. </p>
  127. </dd>
  128. <dt><code>sp_switch</code></dt>
  129. <dd><a name="index-sp_005fswitch-function-attribute_002c-SH"></a>
  130. <p>Use this attribute on the SH to indicate an <code>interrupt_handler</code>
  131. function should switch to an alternate stack. It expects a string
  132. argument that names a global variable holding the address of the
  133. alternate stack.
  134. </p>
  135. <div class="smallexample">
  136. <pre class="smallexample">void *alt_stack;
  137. void f () __attribute__ ((interrupt_handler,
  138. sp_switch (&quot;alt_stack&quot;)));
  139. </pre></div>
  140. </dd>
  141. <dt><code>trap_exit</code></dt>
  142. <dd><a name="index-trap_005fexit-function-attribute_002c-SH"></a>
  143. <p>Use this attribute on the SH for an <code>interrupt_handler</code> to return using
  144. <code>trapa</code> instead of <code>rte</code>. This attribute expects an integer
  145. argument specifying the trap number to be used.
  146. </p>
  147. </dd>
  148. <dt><code>trapa_handler</code></dt>
  149. <dd><a name="index-trapa_005fhandler-function-attribute_002c-SH"></a>
  150. <p>On SH targets this function attribute is similar to <code>interrupt_handler</code>
  151. but it does not save and restore all registers.
  152. </p></dd>
  153. </dl>
  154. <hr>
  155. <div class="header">
  156. <p>
  157. Next: <a href="Symbian-OS-Function-Attributes.html#Symbian-OS-Function-Attributes" accesskey="n" rel="next">Symbian OS Function Attributes</a>, Previous: <a href="S_002f390-Function-Attributes.html#S_002f390-Function-Attributes" accesskey="p" rel="prev">S/390 Function Attributes</a>, Up: <a href="Function-Attributes.html#Function-Attributes" accesskey="u" rel="up">Function Attributes</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Option-Index.html#Option-Index" title="Index" rel="index">Index</a>]</p>
  158. </div>
  159. </body>
  160. </html>