lkml.org 
[lkml]   [2012]   [Jan]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: fix mov immediate emulation for 64-bit operands
Hi,

Nadav Amit <nadav.amit@gmail.com> wrote:
> On Jan 7, 2012, at 10:25 PM, H. Peter Anvin wrote:
>
> > On 01/07/2012 12:21 PM, Nadav Amit wrote:
> >> MOV immediate instruction (opcodes 0xB8-0xBF) may take 64-bit operand.
> >> The previous emulation implementation assumes the operand is no longer than 32.
> >>
> >> Signed-off-by: Nadav Amit <nadav.amit@gmail.com>
> >
> > There are exactly two such instructions: MOV immediate (B8-BF) and MOV
> > moff (A0-A3); you may want to check the latter too.
> >
> > -hpa
> >
>
> These instructions (A0-A3) seem to be already covered by the decode_abs function.

Like these how about introducing a new flag and change the following entries in the
decode table to indicate possible 64bit immediate:

/* 0xB8 - 0xBF */
X8(I(DstReg | SrcImm | Mov, em_mov)),

Checking the opcode byte at the operand decoding stage, like below, does not look nice:
(IMO so better ask Avi)

+ if (size == 8 && ((ctxt->b & 0xF8) != 0xB8 || ctxt->twobyte))
size = 4;

I am now cleaning up x86_decode_insn() to make each decoding stage clearer.

Takuya


\
 
 \ /
  Last update: 2012-01-08 02:29    [W:0.187 / U:1.432 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site