|
XCHG -- Exchange Register/Memory with Register
Opcode | Instruction | Clocks |
Description | Example |
90 + r | xchgw r16,ax | 3 |
Exchange word register with AX | xchgw %bx,%ax |
90 + r | xchgw ax,r16 | 3 |
Exchange word register with AX | xchgw %ax,%bx |
90 + r | xchgl r32,eax | 3 |
Exchange dword register with EAX | xchgl %ebx,%eax |
90 + r | xchgl eax,r32 | 3 |
Exchange dword register with EAX | xchgl %eax,%ebx |
86 /r | xchgb r8,r/m8 | 3 |
Exchange byte register with EA byte | xchgb %bh,%dl
xchgb %bh,(%ebx,1)
xchgb %bh,m8(%ebx,1)
xchgb %bh,m8(%ebx,%ebp,1) |
86 /r | xchgb r/m8,r8 | 3/5 |
Exchange byte register with EA byte | xchgb %dl,%bh
xchgb (%ebx,1),%bh
xchgb m8(%ebx,1),%bh
xchgb m8(%ebx,%ebp,1),%bh |
87 /r | xchgw r16,r/m16 | 3 |
Exchange word register with EA word | xchgw %bx,%cx
xchgw %bx,(%ebx,1)
xchgw %bx,(%ebx,2)
xchgw %bx,(%ebx,%ebp,1) |
87 /r | xchgw r/m16,r16 | 3/5 |
Exchange word register with EA word | xchgw %cx,%bx
xchgw (%ebx,1),%bx
xchgw (%ebx,2),%bx
xchgw (%ebx,%ebp,1),%bx |
87 /r | xchgl r32,r/m32 | 3 |
Exchange dword register with EA dword | xchgl %ebx,%ecx
xchgl %ebx,(%ebx,2)
xchgl %ebx,(%ebx,4)
xchgl %ebx,(%ebx,%ebp,1) |
87 /r | xchgl r/m32,r32 | 3/5 |
Exchange dword register with EA dword | xchgl %ecx,%ebx
xchgl (%ebx,2),%ebx
xchgl (%ebx,4),%ebx
xchgl (%ebx,%ebp,1),%ebx |
Operation
temp := DEST
DEST := SRC
SRC := temp
Description
XCHG exchanges two operands. The operands can be in either order. If a memory operand is involved, BUS LOCK is asserted for the duration of the exchange, regardless of the presence or absence of the LOCK prefix or of the value of the IOPL.
Flags Affected
None
Protected Mode Exceptions
#GP(0) if either operand is in a nonwritable segment; #GP(0) for an illegal memory operand effective address in the CS, DS, ES, FS, or GS segments; #SS(0) for an illegal address in the SS segment; #PF(fault-code) for a page fault
Real Address Mode Exceptions
Interrupt 13 if any part of the operand would lie outside of the effective address space from 0 to 0FFFFH
Virtual 8086 Mode Exceptions
Same exceptions as in Real Address Mode; #PF(fault-code) for a page fault
[Home Page dell'ITIS "Fermi"]
[80386 Programmer's Reference Manual Index]
[Previous]
[Next]
|