c-i370.texi 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. @c Copyright (C) 2000-2015 Free Software Foundation, Inc.
  2. @c This is part of the GAS manual.
  3. @c For copying conditions, see the file as.texinfo.
  4. @ifset GENERIC
  5. @page
  6. @node ESA/390-Dependent
  7. @chapter ESA/390 Dependent Features
  8. @end ifset
  9. @ifclear GENERIC
  10. @node Machine Dependencies
  11. @chapter ESA/390 Dependent Features
  12. @end ifclear
  13. @cindex i370 support
  14. @cindex ESA/390 support
  15. @menu
  16. * ESA/390 Notes:: Notes
  17. * ESA/390 Options:: Options
  18. * ESA/390 Syntax:: Syntax
  19. * ESA/390 Floating Point:: Floating Point
  20. * ESA/390 Directives:: ESA/390 Machine Directives
  21. * ESA/390 Opcodes:: Opcodes
  22. @end menu
  23. @node ESA/390 Notes
  24. @section Notes
  25. The ESA/390 @code{@value{AS}} port is currently intended to be a back-end
  26. for the @sc{gnu} @sc{cc} compiler. It is not HLASM compatible, although
  27. it does support a subset of some of the HLASM directives. The only
  28. supported binary file format is ELF; none of the usual MVS/VM/OE/USS
  29. object file formats, such as ESD or XSD, are supported.
  30. When used with the @sc{gnu} @sc{cc} compiler, the ESA/390 @code{@value{AS}}
  31. will produce correct, fully relocated, functional binaries, and has been
  32. used to compile and execute large projects. However, many aspects should
  33. still be considered experimental; these include shared library support,
  34. dynamically loadable objects, and any relocation other than the 31-bit
  35. relocation.
  36. @node ESA/390 Options
  37. @section Options
  38. @code{@value{AS}} has no machine-dependent command-line options for the ESA/390.
  39. @cindex ESA/390 Syntax
  40. @node ESA/390 Syntax
  41. @section Syntax
  42. The opcode/operand syntax follows the ESA/390 Principles of Operation
  43. manual; assembler directives and general syntax are loosely based on the
  44. prevailing AT&T/SVR4/ELF/Solaris style notation. HLASM-style directives
  45. are @emph{not} supported for the most part, with the exception of those
  46. described herein.
  47. A leading dot in front of directives is optional, and the case of
  48. directives is ignored; thus for example, .using and USING have the same
  49. effect.
  50. A colon may immediately follow a label definition. This is
  51. simply for compatibility with how most assembly language programmers
  52. write code.
  53. @samp{#} is the line comment character.
  54. @samp{;} can be used instead of a newline to separate statements.
  55. Since @samp{$} has no special meaning, you may use it in symbol names.
  56. Registers can be given the symbolic names r0..r15, fp0, fp2, fp4, fp6.
  57. By using thesse symbolic names, @code{@value{AS}} can detect simple
  58. syntax errors. The name rarg or r.arg is a synonym for r11, rtca or r.tca
  59. for r12, sp, r.sp, dsa r.dsa for r13, lr or r.lr for r14, rbase or r.base
  60. for r3 and rpgt or r.pgt for r4.
  61. @samp{*} is the current location counter. Unlike @samp{.} it is always
  62. relative to the last USING directive. Note that this means that
  63. expressions cannot use multiplication, as any occurrence of @samp{*}
  64. will be interpreted as a location counter.
  65. All labels are relative to the last USING. Thus, branches to a label
  66. always imply the use of base+displacement.
  67. Many of the usual forms of address constants / address literals
  68. are supported. Thus,
  69. @example
  70. .using *,r3
  71. L r15,=A(some_routine)
  72. LM r6,r7,=V(some_longlong_extern)
  73. A r1,=F'12'
  74. AH r0,=H'42'
  75. ME r6,=E'3.1416'
  76. MD r6,=D'3.14159265358979'
  77. O r6,=XL4'cacad0d0'
  78. .ltorg
  79. @end example
  80. should all behave as expected: that is, an entry in the literal
  81. pool will be created (or reused if it already exists), and the
  82. instruction operands will be the displacement into the literal pool
  83. using the current base register (as last declared with the @code{.using}
  84. directive).
  85. @node ESA/390 Floating Point
  86. @section Floating Point
  87. @cindex floating point, ESA/390 (@sc{ieee})
  88. @cindex ESA/390 floating point (@sc{ieee})
  89. The assembler generates only @sc{ieee} floating-point numbers. The older
  90. floating point formats are not supported.
  91. @node ESA/390 Directives
  92. @section ESA/390 Assembler Directives
  93. @code{@value{AS}} for the ESA/390 supports all of the standard ELF/SVR4
  94. assembler directives that are documented in the main part of this
  95. documentation. Several additional directives are supported in order
  96. to implement the ESA/390 addressing model. The most important of these
  97. are @code{.using} and @code{.ltorg}
  98. @cindex ESA/390-only directives
  99. These are the additional directives in @code{@value{AS}} for the ESA/390:
  100. @table @code
  101. @item .dc
  102. A small subset of the usual DC directive is supported.
  103. @item .drop @var{regno}
  104. Stop using @var{regno} as the base register. The @var{regno} must
  105. have been previously declared with a @code{.using} directive in the
  106. same section as the current section.
  107. @item .ebcdic @var{string}
  108. Emit the EBCDIC equivalent of the indicated string. The emitted string
  109. will be null terminated. Note that the directives @code{.string} etc. emit
  110. ascii strings by default.
  111. @item EQU
  112. The standard HLASM-style EQU directive is not supported; however, the
  113. standard @code{@value{AS}} directive .equ can be used to the same effect.
  114. @item .ltorg
  115. Dump the literal pool accumulated so far; begin a new literal pool.
  116. The literal pool will be written in the current section; in order to
  117. generate correct assembly, a @code{.using} must have been previously
  118. specified in the same section.
  119. @item .using @var{expr},@var{regno}
  120. Use @var{regno} as the base register for all subsequent RX, RS, and SS form
  121. instructions. The @var{expr} will be evaluated to obtain the base address;
  122. usually, @var{expr} will merely be @samp{*}.
  123. This assembler allows two @code{.using} directives to be simultaneously
  124. outstanding, one in the @code{.text} section, and one in another section
  125. (typically, the @code{.data} section). This feature allows
  126. dynamically loaded objects to be implemented in a relatively
  127. straightforward way. A @code{.using} directive must always be specified
  128. in the @code{.text} section; this will specify the base register that
  129. will be used for branches in the @code{.text} section. A second
  130. @code{.using} may be specified in another section; this will specify
  131. the base register that is used for non-label address literals.
  132. When a second @code{.using} is specified, then the subsequent
  133. @code{.ltorg} must be put in the same section; otherwise an error will
  134. result.
  135. Thus, for example, the following code uses @code{r3} to address branch
  136. targets and @code{r4} to address the literal pool, which has been written
  137. to the @code{.data} section. The is, the constants @code{=A(some_routine)},
  138. @code{=H'42'} and @code{=E'3.1416'} will all appear in the @code{.data}
  139. section.
  140. @example
  141. .data
  142. .using LITPOOL,r4
  143. .text
  144. BASR r3,0
  145. .using *,r3
  146. B START
  147. .long LITPOOL
  148. START:
  149. L r4,4(,r3)
  150. L r15,=A(some_routine)
  151. LTR r15,r15
  152. BNE LABEL
  153. AH r0,=H'42'
  154. LABEL:
  155. ME r6,=E'3.1416'
  156. .data
  157. LITPOOL:
  158. .ltorg
  159. @end example
  160. Note that this dual-@code{.using} directive semantics extends
  161. and is not compatible with HLASM semantics. Note that this assembler
  162. directive does not support the full range of HLASM semantics.
  163. @end table
  164. @node ESA/390 Opcodes
  165. @section Opcodes
  166. For detailed information on the ESA/390 machine instruction set, see
  167. @cite{ESA/390 Principles of Operation} (IBM Publication Number DZ9AR004).