lkml.org 
[lkml]   [2013]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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


\
 
 \ /
  Last update: 2013-07-04 14:01    [W:0.058 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site