⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i386-prefixes.html

📁 gcc手册
💻 HTML
字号:
<html lang="en">

<head>

<title>Using as</title>

<meta http-equiv="Content-Type" content="text/html">

<meta name="description" content="Using as">

<meta name="generator" content="makeinfo 4.3">

<link href="http://www.gnu.org/software/texinfo/" rel="generator-home">

</head>

<body>

<div class="node">

<p>

Node:<a name="i386-Prefixes">i386-Prefixes</a>,

Next:<a rel="next" accesskey="n" href="i386-Memory.html#i386-Memory">i386-Memory</a>,

Previous:<a rel="previous" accesskey="p" href="i386-Regs.html#i386-Regs">i386-Regs</a>,

Up:<a rel="up" accesskey="u" href="i386-Dependent.html#i386-Dependent">i386-Dependent</a>

<hr><br>

</div>



<h4 class="section">Instruction Prefixes</h4>



   <p>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 "operand size" prefix.) 

Instruction prefixes are best written on the same line as the instruction

they act upon. For example, the <code>scas</code> (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:



     <ul>

<li>Section override prefixes <code>cs</code>, <code>ds</code>, <code>ss</code>, <code>es</code>,

<code>fs</code>, <code>gs</code>.  These are automatically added by specifying

using the <var>section</var>:<var>memory-operand</var> form for memory references.



     <li>Operand/Address size prefixes <code>data16</code> and <code>addr16</code>

change 32-bit operands/addresses into 16-bit operands/addresses,

while <code>data32</code> and <code>addr32</code> 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>



     <li>The bus lock prefix <code>lock</code> inhibits interrupts during execution of

the instruction it precedes.  (This is only valid with certain

instructions; see a 80386 manual for details).



     <li>The wait for coprocessor prefix <code>wait</code> waits for the coprocessor to

complete the current instruction.  This should never be needed for the

80386/80387 combination.



     <li>The <code>rep</code>, <code>repe</code>, and <code>repne</code> prefixes are added

to string instructions to make them repeat <code>%ecx</code> times (<code>%cx</code>

times if the current address size is 16-bits). 

<li>The <code>rex</code> family of prefixes is used by x86-64 to encode

extensions to i386 instruction set.  The <code>rex</code> prefix has four

bits -- 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 <code>rex</code> prefixes directly. The <code>rex64xyz</code>

instruction emits <code>rex</code> 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>



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -