Messages in this thread | | | Date | Thu, 04 Jul 2013 13:08:08 +0200 | From | Paolo Bonzini <> | Subject | Re: [PATCH] x86/kvm/emulate.c: simplify NOP (opcode 0x90) check |
| |
Il 04/07/2013 13:06, Denys Vlasenko ha scritto: >>> >> - case 0x90 ... 0x97: /* nop / xchg reg, rax */ >>> >> - if (ctxt->dst.addr.reg == reg_rmw(ctxt, VCPU_REGS_RAX)) >>> >> - break; >>> >> + case 0x90: /* nop */ >>> >> + break; >> > This does not work on 64bit and REX prefix. > Can you elaborate? > > 0x90 is special-cased in CPU to be a NOP regardless of bit width. > IOW, xchg %eax,%eax ordinarily would clear upper 32 bits of %rax, > but 0x90 doesn't do that. > > Do you mean that with REX.R==1, 0x90 will refer to R8?
Yes.
$ echo 'xchg %rax,%r8' | as $ objdump -d a.out
a.out: file format elf64-x86-64
Disassembly of section .text:
0000000000000000 <.text>: 0: 49 90 xchg %rax,%r8
Paolo
| |