x86 Assembly Language Reference Manual
この本のみを検索
PDF 文書ファイルをダウンロードする

............................Contents


Preface
xvii

1. Assembler Input
1
...Introduction 1
...Source Files in Assembly Language Format 2
......File Organization 2
......Statements 3
......Values and Symbol Types 4
......Expressions 6
......Expression Syntax 7
......Expression Semantics (Absolute vs. Relocatable) 9
......Machine Instruction Syntax 10
......Instruction Description 12
... Pseudo Operations 14
......General Pseudo Operations 14
......Symbol Definition Pseudo Operations 19

2. Instruction-Set Mapping
21
...Introduction 22
......Notational Conventions 23
......References 26
...Segment Register Instructions 26
...... Load Full Pointer (lds,les, lfs, lgs, and lss) 26
......Pop Stack into Word (pop) 27
......Push Word/Long onto Stack (push) 28
...I/O Instructions 29
......Input from Port (in, ins) 29
......Output from Port (out, outs) 31
...Flag Instructions 32
......Load Flags into AH Register (lahf) 32
......Store AH into Flags (sahf) 33
......Pop Stack into Flag (popf) 33
......Push Flag Register Onto Stack (pushf) 34
......Complement Carry Flag (cmc) 35
......Clear Carry Flag (clc) 35
......Set Carry Flag (stc) 36
......Clear Interrupt Flag (cli) 36
......Set Interrupt Flag (sti) 37
......Clear Direction Flag (cld) 37
......Set Direction Flag (std) 38
...Arithmetic Logical Instructions 38
......Integer Addition (add) 38
......Integer Add With Carry (adc) 39
......Integer Subtraction (sub) 40
......Integer Subtraction With Borrow (sbb) 41
......Compare Two Operands (cmp) 42
......Increment by 1 (inc) 43
......Decrease by 1 (dec) 44
......Logical Comparison or Test (test) 45
......Shift (sal, shl, sar, shr) 46
......Double Precision Shift Left (shld) 48
......Double Precision Shift Right (shrd) 49
......One's Complement Negation (not) 50
......Two's Complement Negation (neg) 50
......Check Array Index Against Bounds (bound) 51
......Logical And (and) 52
......Logical Inclusive OR (or) 54
......Logical Exclusive OR (xor) 55
...Multiply and Divide Instructions 56
......Signed Multiply (imul) 57
......Unsigned Multiplication of AL, AX or EAX(mul) 58
......Unsigned Divide (div) 60
......Signed Divide (idiv) 61
...Conversion Instructions 62
......Convert Byte to Word (cbtw) 62
......Convert Word to Long (cwtl) 63
......Convert Signed Word to Signed Double Word (cwtd) 63
......Convert Signed Long to Signed Double Long (cltd) 64
...Decimal Arithmetic Instructions 64
......Decimal Adjust AL after Addition (daa) 64
......Decimal Adjust AL after Subtraction (das) 65
......ASCII Adjust after Addition (aaa) 65
......ASCII Adjust after Subtraction (aas) 66
......ASCII Adjust AX after Multiply (aam) 67
......ASCII Adjust AX before Division (aad) 68
...Coprocessor Instructions 69
......Wait (wait, fwait) 69
...String Instructions 69
......Move Data from String to String (movs) 70
......Compare String Operands (cmps) 71
......Store String Data (stos) 72
......The Load String Operand (lods) 73
......Compare String Data (scas) 75
......Look-Up Translation Table (xlat) 76
......Repeat String Operation (rep, repnz, repz) 77
...Procedure Call and Return Instructions 78
......Far Call -- Procedure Call (lcall) 78
......Near Call -- Procedure Call (call) 79
......Return from Procedure (ret) 80
......Long Return (lret) 81
......Enter/Make Stack Frame for Procedure Parameters (enter) 82
......High Level Procedure Exit (leave) 83
...Jump Instructions 83
......Jump if ECX is Zero (jcxz) 83
......Loop Control with CX Counter (loop, loopnz, loopz) 84
......Jump (jmp, ljmp) 85
...Interrupt Instructions 87
......Call to Interrupt Procedure (int, into) 87
......Interrupt Return (iret) 89
...Protection Model Instructions 90
......Store Local Descriptor Table Register (sldt) 90
......Store Task Register (str) 90
......Load Local Descriptor Table Register (lldt) 91
......Load Task Register (ltr) 92
......Verify a Segment for Reading or Writing (verr, verw) 92
......Store Global/Interrupt Descriptor Table Register (sgdt, sidt) 93
......Load Global/Interrupt Descriptor Table (lgdt, lidt) 94
......Store Machine Status Word (smsw) 95
......Load Machine Status Word (lmsw) 96
......Load Access Rights (lar) 96
......Load Segment Limit (lsl) 97
......Clear Task-Switched (clts) 98
......Adjust RPL Field of Selector (arpl) 99
...Bit Instructions 100
......Bit Scan Forward (bsf) 100
......Bit Scan Reverse (bsr) 100
......Bit Test (bt) 101
......Bit Test And Complement (btc) 102
......Bit Test And Reset (btr) 102
......Bit Test And Set (bts) 103
...Exchange Instructions 103
......Compare and Exchange (cmpxchg)[486] 103
...Floating-Point Transcendental Instructions 104
......Floating-Point Sine (fsin) 104
......Floating-Point Cosine (fcos) 104
......Floating-Point Sine and Cosine (fsincos) 104
...Floating-Point Constant Instructions 105
......Floating-Point Load One (fld) 105
...Processor Control Floating-Point Instructions 105
......Floating-Point Load Control Word (fldcw) 105
......Floating-Point Load Environment (fldenv) 106
...Miscellaneous Floating-Point Instructions 106
......Floating-Point Different Reminder (fprem) 106
...Floating-Point Comparison Instructions 106
......Floating-Point Unsigned Compare (fucom) 106
......Floating-Point Unsigned Compare And Pop (fucomp) 107
......Floating-Point Unsigned Compare And Pop Two (fucompp)107
...Load and Move Instructions 108
......Load Effective Address (lea) 108
......Move (mov) 109
......Move Segment Registers (movw) 109
......Move Control Registers (mov) 110
......Move Debug Registers (mov) 111
......Move Test Registers (mov) 111
......Move With Sign Extend (movsx) 112
......Move With Zero Extend (movzb) 112
...Pop Instructions 113
......Pop All General Registers (popa) 113
...Push Instructions 114
......Push All General Registers (pusha) 114
...Rotate Instructions 114
......Rotate With Carry Left (rcl) 114
......Rotate With Carry Right (rcr) 115
......Rotate Left (rol) 116
......Rotate Right (ror) 117
...Byte Instructions 118
......Byte Set On Condition (setcc) 118
......Byte Swap (bswap) [486] 120
...Exchange Instructions 120
......Exchange And Add (xadd) [486] 120
......Exchange Register / Memory With Register (xchg) 120
...Miscellaneous Instructions 121
......Write Back and Invalidate Cache (wbinvd) [486 only] 121
......Invalidate (invd) [486 only] 122
......Invalidate Page (invlpg) [486 only] 122
......LOCK Prefix (lock) 122
......No Operation (nop) 123
......Halt (hlt) 124
...Real Transfer Instructions 125
......Load Real (fld) 125
......Store Real (fst) 125
......Store Real and Pop (fstp) 126
......Exchange Registers (fxch) 126
...Integer Transfer Instructions 127
......Integer Load (fild) 127
......Integer Store (fist) 127
......Integer Store and Pop (fistp) 127
...Packed Decimal Transfer Instructions 128
......Packed Decimal (BCD) Load (fbld) 128
......Packed Decimal (BCD) Store and Pop (fbstp) 128
...Addition Instructions 129
......Real Add (fadd) 129
......Real Add and Pop (faddp) 129
......Integer Add (fiadd) 129
...Subtraction Instructions 130
......Subtract Real and Pop (fsub) 130
......Subtract Real (fsubp) 130
......Subtract Real Reversed (fsubr) 130
......Subtract Real Reversed and Pop (fsubrp) 131
......Integer Subtract (fisubrp) 131
......Integer Subtract Reverse (fisubr) 131
...Multiplication Instructions 132
......Multiply Real (fmul) 132
......Multiply Real and Pop (fmulp) 132
......Integer Multiply (fimul) 132
...Division Instructions 133
......Divide Real (fdiv) 133
......Divide Real and Pop (fdivp) 133
......Divide Real Reversed (fdivr) 133
......Divide Real Reversed and Pop (fdivrp) 134
......Integer Divide (fidiv) 134
......Integer Divide Reversed (fidivr) 134
...Miscellaneous Arithmetic Operations 136
......Square Root (fsqrt) 136
......Scale (fscale) 136
......Partial Remainder (fprem) 136
......Round to Integer (frndint) 137
......Extract Exponent and Significand (fxtract) 137
......Absolute Value (fabs) 137
......Change Sign (fchs) 138
...Comparison Instructions 138
......Compare Real (fcom) 138
......Compare Real and Pop (fcomp) 139
......Compare Real and Pop Twice (fcompp) 139
......Integer Compare (ficom) 139
......Integer Compare and Pop (ficomp) 140
......Test (ftst) 140
......Examine (fxam) 140
...Transcendental Instructions 141
......Partial Tangent (fptan) 141
......Partial Arctangent (fpatan) 142
......x 2 - 1 (f2xm1) 142
......Y * log2 X (fyl2x) 142
......Y * log2 (X+1) (fyl2xp1) 143
...Constant Instructions 143
......Load log E (fldl2e) 143 2
......Load log 10 (fldl2t) 143 2
......Load log 2 (fldlg2) 144 10
......Load log 2 (fldln2) 144 e
......Load pi (fldpi) 144
......Load + 0 (fldz) 145
...Processor Control Instructions 145
......Initialize Processor (finit, fnint) 145
......No Operation (fnop) 145
......Save State (fsave, fnsave) 146
......Store Control Word (fstcw, fnstcw) 146
......Store Environment (fstenv, fnstenv) 146
......Store Status Word (fstsw, fnstsw) 147
......Restore State (frstor) 147
......CPU Wait (fwait, wait) 147
......Clear Exceptions (fclex, fnclex) 148
......Decrement Stack Pointer (fdecstp) 148
......Free Registers (ffree) 148
......Increment Stack Pointer (fincstp) 149

3. Assembler Output
151
...Introduction 151
...Object Files in Executable and Linking Format (ELF) 152
......ELF Header 153
......Section Header 155
......Sections 159
......Symbol Tables 162
......String Tables 164

A. Using the Assembler Command Line
167
...Assembler Command Line 167
...Assembler Command Line Options 168
...Disassembling Object Code 169

Index
171