Skip to contentSkip to conversation

x86 emulator: Add 2 operand imul instruction (opcode 0x0f 0xaf)

PATCH In review Mohammed Gamal 2 participants 6 messages Aug 18, 2010 – Aug 19, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86 emulator: Add 2 operand imul instruction (opcode 0x0f 0xaf)

---
 arch/x86/kvm/emulate.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +4 -1
index cb3282c..3311c68 100644
@@ -2474,7 +2474,7 @@ static struct opcode twobyte_table[256] = {
 	N, D(DstMem | SrcReg | ModRM | BitOp | Lock),
 	D(DstMem | SrcReg | Src2ImmByte | ModRM),
 	D(DstMem | SrcReg | Src2CL | ModRM),
-	D(ModRM), N,
+	D(ModRM), D(DstReg | SrcMem | ModRM),
 	/* 0xB0 - 0xB7 */
 	D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock),
 	N, D(DstMem | SrcReg | ModRM | BitOp | Lock),
@@ -3567,6 +3567,9 @@ twobyte_insn:
 		break;
 	case 0xae:              /* clflush */
 		break;
+	case 0xaf:
+		emulate_2op_SrcV_nobyte("imul", c->src, c->dst, ctxt->eflags);
+		break;
 	case 0xb0 ... 0xb1:	/* cmpxchg */
 		/*
 		 * Save real source value, then compare EAX against
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 19 lines · Mohammed Gamal
---
  arch/x86/kvm/emulate.c |    5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index cb3282c..3311c68 100644
@@ -2474,7 +2474,7 @@ static struct opcode twobyte_table[256] = {
  	N, D(DstMem | SrcReg | ModRM | BitOp | Lock),
  	D(DstMem | SrcReg | Src2ImmByte | ModRM),
  	D(DstMem | SrcReg | Src2CL | ModRM),
-	D(ModRM), N,
+	D(ModRM), D(DstReg | SrcMem | ModRM),
  	/* 0xB0 - 0xB7 */
  	D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock),
  	N, D(DstMem | SrcReg | ModRM | BitOp | Lock),

arch/x86/kvm/emulate.c twobyte_insn: · line 3575

Quoted 9 lines
arch/x86/kvm/emulate.c +3 -0
@@ -3567,6 +3567,9 @@ twobyte_insn:
  		break;
  	case 0xae:              /* clflush */
  		break;
+	case 0xaf:
+		emulate_2op_SrcV_nobyte("imul", c->src, c->dst, ctxt->eflags);
+		break;
  	case 0xb0 ... 0xb1:	/* cmpxchg */
  		/*
  		 * Save real source value, then compare EAX against

I already added this, please look at the non-atomic-injection branch.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#2 lore raw
Quoted 26 lines · Avi Kivity
Quoted 25 lines · Mohammed Gamal

---
 arch/x86/kvm/emulate.c |    5 ++++-

 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index cb3282c..3311c68 100644
@@ -2474,7 +2474,7 @@ static struct opcode twobyte_table[256] = {
        N, D(DstMem | SrcReg | ModRM | BitOp | Lock),
        D(DstMem | SrcReg | Src2ImmByte | ModRM),
        D(DstMem | SrcReg | Src2CL | ModRM),
-       D(ModRM), N,
+       D(ModRM), D(DstReg | SrcMem | ModRM),
        /* 0xB0 - 0xB7 */

       D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock),
       N, D(DstMem | SrcReg | ModRM | BitOp | Lock),

arch/x86/kvm/emulate.c +0 -0
@@ -3567,6 +3567,9 @@ twobyte_insn:
                break;

       case 0xae:              /* clflush */
               break;
+       case 0xaf:

Quoted 9 lines
Quoted 6 lines

+               emulate_2op_SrcV_nobyte("imul", c->src, c->dst, ctxt->eflags);
+               break;
       case 0xb0 ... 0xb1:     /* cmpxchg */
               /*
                * Save real source value, then compare EAX against

I already added this, please look at the non-atomic-injection branch.

Looks like you beat me to it. I'll pull again.

Quoted 5 lines

--
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.

#3 lore raw
Quoted 36 lines · Mohammed Gamal
Quoted 26 lines · Avi Kivity
Quoted 25 lines · Mohammed Gamal

---
 arch/x86/kvm/emulate.c |    5 ++++-

 1 files changed, 4 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index cb3282c..3311c68 100644
@@ -2474,7 +2474,7 @@ static struct opcode twobyte_table[256] = {
        N, D(DstMem | SrcReg | ModRM | BitOp | Lock),
        D(DstMem | SrcReg | Src2ImmByte | ModRM),
        D(DstMem | SrcReg | Src2CL | ModRM),
-       D(ModRM), N,
+       D(ModRM), D(DstReg | SrcMem | ModRM),
        /* 0xB0 - 0xB7 */

       D(ByteOp | DstMem | SrcReg | ModRM | Lock), D(DstMem | SrcReg | ModRM | Lock),
       N, D(DstMem | SrcReg | ModRM | BitOp | Lock),

arch/x86/kvm/emulate.c +0 -0
@@ -3567,6 +3567,9 @@ twobyte_insn:
                break;

       case 0xae:              /* clflush */
               break;
+       case 0xaf:

Quoted 9 lines
Quoted 6 lines

+               emulate_2op_SrcV_nobyte("imul", c->src, c->dst, ctxt->eflags);
+               break;
       case 0xb0 ... 0xb1:     /* cmpxchg */
               /*
                * Save real source value, then compare EAX against

I already added this, please look at the non-atomic-injection branch.

Quoted 1 line

Looks like you beat me to it. I'll pull again.

Pulled again and no signs of such patch. imul is not implemented there. Did you push your changes?

#4 lore raw
Quoted 3 lines · Mohammed Gamal

Pulled again and no signs of such patch. imul is not implemented there. Did you push your changes?

It's 738cee07673.

Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
#5 lore raw
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Mohammed Gamal

Pulled again and no signs of such patch. imul is not implemented there. Did you push your changes?

It's 738cee07673.d

Pulled again and it is there now, thanks.

Quoted 6 lines

--
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.