neingeist
/
arduinisten
Archived
1
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

109 lines
5.8 KiB
HTML

<html lang="en">
<head>
<title>i386-Prefixes - Using as</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="Using as">
<meta name="generator" content="makeinfo 4.7">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="i386_002dDependent.html#i386_002dDependent" title="i386-Dependent">
<link rel="prev" href="i386_002dRegs.html#i386_002dRegs" title="i386-Regs">
<link rel="next" href="i386_002dMemory.html#i386_002dMemory" title="i386-Memory">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This file documents the GNU Assembler "as".
Copyright (C) 1991, 92, 93, 94, 95, 96, 97, 98, 99, 2000, 2001, 2002,
2006, 2007 Free Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the
section entitled ``GNU Free Documentation License''.
man end-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family: serif; font-weight: normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="i386_002dPrefixes"></a>Next:&nbsp;<a rel="next" accesskey="n" href="i386_002dMemory.html#i386_002dMemory">i386-Memory</a>,
Previous:&nbsp;<a rel="previous" accesskey="p" href="i386_002dRegs.html#i386_002dRegs">i386-Regs</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="i386_002dDependent.html#i386_002dDependent">i386-Dependent</a>
<hr><br>
</div>
<h4 class="subsection">9.13.7 Instruction Prefixes</h4>
<p><a name="index-i386-instruction-prefixes-905"></a><a name="index-instruction-prefixes_002c-i386-906"></a><a name="index-prefixes_002c-i386-907"></a>Instruction prefixes are used to modify the following instruction. They
are used to repeat string instructions, to provide section overrides, to
perform bus lock operations, and to change operand and address sizes.
(Most instructions that normally operate on 32-bit operands will use
16-bit operands if the instruction has an &ldquo;operand size&rdquo; prefix.)
Instruction prefixes are best written on the same line as the instruction
they act upon. For example, the <span class="samp">scas</span> (scan string) instruction is
repeated with:
<pre class="smallexample"> repne scas %es:(%edi),%al
</pre>
<p>You may also place prefixes on the lines immediately preceding the
instruction, but this circumvents checks that <code>as</code> does
with prefixes, and will not work with all prefixes.
<p>Here is a list of instruction prefixes:
<p><a name="index-section-override-prefixes_002c-i386-908"></a>
<ul>
<li>Section override prefixes <span class="samp">cs</span>, <span class="samp">ds</span>, <span class="samp">ss</span>, <span class="samp">es</span>,
<span class="samp">fs</span>, <span class="samp">gs</span>. These are automatically added by specifying
using the <var>section</var>:<var>memory-operand</var> form for memory references.
<p><a name="index-size-prefixes_002c-i386-909"></a><li>Operand/Address size prefixes <span class="samp">data16</span> and <span class="samp">addr16</span>
change 32-bit operands/addresses into 16-bit operands/addresses,
while <span class="samp">data32</span> and <span class="samp">addr32</span> change 16-bit ones (in a
<code>.code16</code> section) into 32-bit operands/addresses. These prefixes
<em>must</em> appear on the same line of code as the instruction they
modify. For example, in a 16-bit <code>.code16</code> section, you might
write:
<pre class="smallexample"> addr32 jmpl *(%ebx)
</pre>
<p><a name="index-bus-lock-prefixes_002c-i386-910"></a><a name="index-inhibiting-interrupts_002c-i386-911"></a><li>The bus lock prefix <span class="samp">lock</span> inhibits interrupts during execution of
the instruction it precedes. (This is only valid with certain
instructions; see a 80386 manual for details).
<p><a name="index-coprocessor-wait_002c-i386-912"></a><li>The wait for coprocessor prefix <span class="samp">wait</span> waits for the coprocessor to
complete the current instruction. This should never be needed for the
80386/80387 combination.
<p><a name="index-repeat-prefixes_002c-i386-913"></a><li>The <span class="samp">rep</span>, <span class="samp">repe</span>, and <span class="samp">repne</span> prefixes are added
to string instructions to make them repeat <span class="samp">%ecx</span> times (<span class="samp">%cx</span>
times if the current address size is 16-bits).
<a name="index-REX-prefixes_002c-i386-914"></a><li>The <span class="samp">rex</span> family of prefixes is used by x86-64 to encode
extensions to i386 instruction set. The <span class="samp">rex</span> prefix has four
bits &mdash; an operand size overwrite (<code>64</code>) used to change operand size
from 32-bit to 64-bit and X, Y and Z extensions bits used to extend the
register set.
<p>You may write the <span class="samp">rex</span> prefixes directly. The <span class="samp">rex64xyz</span>
instruction emits <span class="samp">rex</span> prefix with all the bits set. By omitting
the <code>64</code>, <code>x</code>, <code>y</code> or <code>z</code> you may write other
prefixes as well. Normally, there is no need to write the prefixes
explicitly, since gas will automatically generate them based on the
instruction operands.
</ul>
</body></html>