Re: [PATCH] x86/kvm/emulate.c: simplify NOP (opcode 0x90) check
From: Paolo Bonzini
Date: Thu Jul 04 2013 - 07:08:22 EST
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/