Re: [PATCH] x86 emulator: Add Src2 decode set

2008-10-09 Thread Avi Kivity
Guillaume Thouvenin wrote:
 Instruction like shld has three operands, so we need to add a Src2
 decode set. We start with Src2None, Src2CL, and Src2Imm8 to support
 shld and we will expand it later.

   

Please add Src2One (implied '1') as well, so we can switch the existing
shift operators to Src2 later.

 Signed-off-by: Guillaume Thouvenin [EMAIL PROTECTED]
 ---
  arch/x86/kvm/x86_emulate.c|   47 
 --
  include/asm-x86/kvm_x86_emulate.h |1 
  2 files changed, 36 insertions(+), 12 deletions(-)

 diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c
 index a391e21..c9ef2da 100644
 --- a/arch/x86/kvm/x86_emulate.c
 +++ b/arch/x86/kvm/x86_emulate.c
 @@ -59,16 +59,21 @@
  #define SrcImm  (54)   /* Immediate operand. */
  #define SrcImmByte  (64)   /* 8-bit sign-extended immediate operand. */
  #define SrcMask (74)
 +/* Source 2 operand type */
 +#define Src2None(07)
 +#define Src2CL  (17)
 +#define Src2Imm8(27)
 +#define Src2Mask(77)
   

Please allocate bits for this at the end to avoid renumbering.

  
 + /*
 +  * Decode and fetch the second source operand: register, memory
 +  * or immediate.
 +  */
 + switch (c-d  Src2Mask) {
 + case Src2None:
 + break;
 + case Src2CL:
 + c-src2.val = c-regs[VCPU_REGS_RCX];
   

Mask to a single byte; also set the operand length.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] x86 emulator: Add Src2 decode set

2008-10-09 Thread Avi Kivity
Avi Kivity wrote:
  #define SrcMask (74)
 +/* Source 2 operand type */
 +#define Src2None(07)
 +#define Src2CL  (17)
 +#define Src2Imm8(27)
 


Src2ImmByte like SrcImmByte.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] x86 emulator: Add Src2 decode set

2008-10-09 Thread Guillaume Thouvenin
On Thu, 09 Oct 2008 11:06:50 +0200
Avi Kivity [EMAIL PROTECTED] wrote:

 
 The regular shift instructions (shl, rcl, etc) come in three varieties:
 shift by 1, shift by imm8, and shift by CL.  Right now they use
 SrcImmByte and decode the implied '1' and CL by hand.  If we change them
 to use Src2, they can reuse the Src2CL and Src2One support that you are
 adding now.

Ok I see but shld, rcld, etc come only in two varieties: immediate and
CL. So maybe it could be better to replace SrcImplicit (that is not
really useful) by SrcOne? and then we will have
 
 ...
 case SrcOne:
c-src.val = 1;
break;
 ...

and we can reuse Src2CL as well.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] x86 emulator: Add Src2 decode set

2008-10-09 Thread Avi Kivity
Guillaume Thouvenin wrote:
 I will add Src2One but I don't understand exactly what you mean by
 switching shift operators to Src2 later. I also applied other remarks,
 thanks for your help. The patch follows.
   

The regular shift instructions (shl, rcl, etc) come in three varieties:
shift by 1, shift by imm8, and shift by CL.  Right now they use
SrcImmByte and decode the implied '1' and CL by hand.  If we change them
to use Src2, they can reuse the Src2CL and Src2One support that you are
adding now.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] x86 emulator: Add Src2 decode set

2008-10-09 Thread Guillaume Thouvenin
On Thu, 09 Oct 2008 10:11:57 +0200
Avi Kivity [EMAIL PROTECTED] wrote:

 Guillaume Thouvenin wrote:
  Instruction like shld has three operands, so we need to add a Src2
  decode set. We start with Src2None, Src2CL, and Src2Imm8 to support
  shld and we will expand it later.
 

 
 Please add Src2One (implied '1') as well, so we can switch the existing
 shift operators to Src2 later.

I will add Src2One but I don't understand exactly what you mean by
switching shift operators to Src2 later. I also applied other remarks,
thanks for your help. The patch follows.
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html