diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2018-02-17 05:20:42 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2018-02-17 05:20:57 -0800 |
commit | 62a02d25b6e5d9f92c205260daa11355d0c62532 (patch) | |
tree | 9fa0855fa0acd81d5d855b01a865cdfb3456254a /gas/doc | |
parent | bb57c12e551e7b66db9d5d8623e2f294091f03c1 (diff) | |
download | gdb-62a02d25b6e5d9f92c205260daa11355d0c62532.zip gdb-62a02d25b6e5d9f92c205260daa11355d0c62532.tar.gz gdb-62a02d25b6e5d9f92c205260daa11355d0c62532.tar.bz2 |
Add .nop assembler directive
Implement the '.nop SIZE[, CONTROL]' assembler directive, which emits
SIZE bytes filled with no-op instructions. SIZE is absolute expression.
The optional CONTROL byte controls how no-op instructions should be
generated. If the comma and @var{control} are omitted, CONTROL is
assumed to be zero.
For Intel 80386 and AMD x86-64 targets, CONTROL byte specifies the size
limit of a single no-op instruction. The valid values of CONTROL byte
are between 0 and 8 for 16-bit mode, between 0 and 10 for 32-bit mode,
between 0 and 11 for 64-bit mode. When 0 is used, the no-op size limit
is set to the maximum supported size.
2 new relax states, rs_space_nop and rs_fill_nop, are added to enum
_relax_state, which are similar to rs_space and rs_fill, respectively,
but they fill with no-op instructions, instead of a single byte. A
target backend must override the default md_generate_nops to generate
proper no-op instructions. Otherwise, an error of unimplemented .nop
directive will be issued whenever .nop directive is used.
* NEWS: Mention .nop directive.
* as.h (_relax_state): Add rs_space_nop and rs_fill_nop.
* read.c (potable): Add .nop.
(s_nop): New function.
* read.h (s_nop): New prototype.
* write.c (cvt_frag_to_fill): Handle rs_space_nop and
rs_fill_nop.
(md_generate_nops): New function.
(relax_segment): Likewise.
(write_contents): Use md_generate_nops for rs_fill_nop.
* config/tc-i386.c (alt64_11): New.
(alt64_patt): Likewise.
(md_convert_frag): Handle rs_space_nop.
(i386_output_nops): New function.
(i386_generate_nops): Likewise.
(i386_align_code): Call i386_output_nops.
* config/tc-i386.h (i386_generate_nops): New.
(md_generate_nops): Likewise.
* doc/as.texinfo: Document .nop directive.
* testsuite/gas/i386/i386.exp: Run .nop directive tests.
* testsuite/gas/i386/nop-1.d: New file.
* testsuite/gas/i386/nop-1.s: Likewise.
* testsuite/gas/i386/nop-2.d: Likewise.
* testsuite/gas/i386/nop-2.s: Likewise.
* testsuite/gas/i386/nop-3.d: Likewise.
* testsuite/gas/i386/nop-3.s: Likewise.
* testsuite/gas/i386/nop-4.d: Likewise.
* testsuite/gas/i386/nop-4.s: Likewise.
* testsuite/gas/i386/nop-5.d: Likewise.
* testsuite/gas/i386/nop-5.s: Likewise.
* testsuite/gas/i386/nop-6.d: Likewise.
* testsuite/gas/i386/nop-6.s: Likewise.
* testsuite/gas/i386/nop-bad-1.l: Likewise.
* testsuite/gas/i386/nop-bad-1.s: Likewise.
* testsuite/gas/i386/x86-64-nop-1.d: Likewise.
* testsuite/gas/i386/x86-64-nop-2.d: Likewise.
* testsuite/gas/i386/x86-64-nop-3.d: Likewise.
* testsuite/gas/i386/x86-64-nop-4.d: Likewise.
* testsuite/gas/i386/x86-64-nop-5.d: Likewise.
* testsuite/gas/i386/x86-64-nop-6.d: Likewise.
Diffstat (limited to 'gas/doc')
-rw-r--r-- | gas/doc/as.texinfo | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gas/doc/as.texinfo b/gas/doc/as.texinfo index f4e0fdd..3084bcb 100644 --- a/gas/doc/as.texinfo +++ b/gas/doc/as.texinfo @@ -4479,6 +4479,7 @@ Some machine configurations provide additional directives. * MRI:: @code{.mri @var{val}} * Noaltmacro:: @code{.noaltmacro} * Nolist:: @code{.nolist} +* Nop:: @code{.nop @var{size}[, @var{control}]} * Octa:: @code{.octa @var{bignums}} * Offset:: @code{.offset @var{loc}} * Org:: @code{.org @var{new-lc}, @var{fill}} @@ -6101,6 +6102,23 @@ internal counter (which is zero initially). @code{.list} increments the counter, and @code{.nolist} decrements it. Assembly listings are generated whenever the counter is greater than zero. +@node Nop +@section @code{.nop @var{size}[, @var{control}]} + +@cindex @code{nop} directive +@cindex filling memory with no-op instructions +This directive emits @var{size} bytes filled with no-op instructions. +@var{size} is absolute expression, which must be a positve value. +@var{control} controls how no-op instructions should be generated. If +the comma and @var{control} are omitted, @var{control} is assumed to be +zero. + +Note: For Intel 80386 and AMD x86-64 targets, @var{control} specifies +the size limit of a no-op instruction. The valid values of @var{control} +are between 0 and 8 for 16-bit mode, between 0 and 10 for 32-bit mode, +between 0 and 11 for 64-bit mode. When 0 is used, the no-op instruction +size limit is set to the maximum supported size. + @node Octa @section @code{.octa @var{bignums}} |