Skip to contentSkip to conversation

x86 emulator: Add stc instruction (opcode 0xf9)

PATCH In review Mohammed Gamal 3 participants 4 messages Aug 5, 2010

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

PATCH 1/1 x86 emulator: Add stc instruction (opcode 0xf9)

---
 arch/x86/kvm/emulate.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +5 -1
index f0f4a43..f345df0 100644
@@ -2269,7 +2269,7 @@ static struct opcode opcode_table[256] = {
 	N, N, N, N,
 	D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3),
 	/* 0xF8 - 0xFF */
-	D(ImplicitOps), N, D(ImplicitOps), D(ImplicitOps),
+	D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps),
 	D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5),
 };
 
@@ -3129,6 +3129,10 @@ special_insn:
 		ctxt->eflags &= ~EFLG_CF;
 		c->dst.type = OP_NONE;	/* Disable writeback. */
 		break;
+	case 0xf9: /* stc */
+		ctxt->eflags |= EFLG_CF;
+		c->dst.type = OP_NONE;	/* Disable writeback */
+		break;
 	case 0xfa: /* cli */
 		if (emulator_bad_iopl(ctxt, ops)) {
 			emulate_gp(ctxt, 0);
Signature · 1 line
1.7.0.4
#1 lore raw
Quoted 19 lines · Mohammed Gamal
---
 arch/x86/kvm/emulate.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index f0f4a43..f345df0 100644
@@ -2269,7 +2269,7 @@ static struct opcode opcode_table[256] = {
 	N, N, N, N,
 	D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3),
 	/* 0xF8 - 0xFF */
-	D(ImplicitOps), N, D(ImplicitOps), D(ImplicitOps),
+	D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps),
 	D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5),
 };
 

arch/x86/kvm/emulate.c special_insn: · line 3134

Quoted 6 lines
arch/x86/kvm/emulate.c +3 -0
@@ -3129,6 +3129,10 @@ special_insn:
 		ctxt->eflags &= ~EFLG_CF;
 		c->dst.type = OP_NONE;	/* Disable writeback. */
 		break;
+	case 0xf9: /* stc */
+		ctxt->eflags |= EFLG_CF;
+		c->dst.type = OP_NONE;	/* Disable writeback */

With "disable writeback when decode dest operand" patch (which should be applied already) this is no longer needed.

Quoted 11 lines
arch/x86/kvm/emulate.c +1 -0
+		break;
 	case 0xfa: /* cli */
 		if (emulator_bad_iopl(ctxt, ops)) {
 			emulate_gp(ctxt, 0);
Signature · 6 lines
1.7.0.4

--
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

--
Gleb.

#2 lore raw
Quoted 19 lines · Gleb Natapov
Quoted 18 lines · Mohammed Gamal

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

 1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index f0f4a43..f345df0 100644
@@ -2269,7 +2269,7 @@ static struct opcode opcode_table[256] = {
       N, N, N, N,
       D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3),
       /* 0xF8 - 0xFF */
-     D(ImplicitOps), N, D(ImplicitOps), D(ImplicitOps),
+     D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps),
       D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5),
  };
 
Quoted 9 lines
Quoted 7 lines
arch/x86/kvm/emulate.c +0 -0
@@ -3129,6 +3129,10 @@ special_insn:
               ctxt->eflags &= ~EFLG_CF;

              c->dst.type = OP_NONE;  /* Disable writeback. */ break;
+     case 0xf9: /* stc */
+             ctxt->eflags |= EFLG_CF;
+             c->dst.type = OP_NONE;  /* Disable writeback */

With "disable writeback when decode dest operand" patch (which should be applied already) this is no longer needed.

Right. Should I wait for it to be merged and resend?

Quoted 16 lines
Quoted 8 lines

+             break;
      case 0xfa: /* cli */
              if (emulator_bad_iopl(ctxt, ops)) {
                      emulate_gp(ctxt, 0);
--
1.7.0.4

Quoted 4 lines

--
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

--
                       Gleb.

#3 lore raw
Quoted 29 lines · Mohammed Gamal
Quoted 19 lines · Gleb Natapov
Quoted 18 lines · Mohammed Gamal
---
  arch/x86/kvm/emulate.c |    6 +++++-
  1 files changed, 5 insertions(+), 1 deletions(-)
arch/x86/kvm/emulate.c +1 -1
index f0f4a43..f345df0 100644
@@ -2269,7 +2269,7 @@ static struct opcode opcode_table[256] = {
       N, N, N, N,
       D(ImplicitOps | Priv), D(ImplicitOps), G(ByteOp, group3), G(0, group3),
       /* 0xF8 - 0xFF */
-     D(ImplicitOps), N, D(ImplicitOps), D(ImplicitOps),
+     D(ImplicitOps), D(ImplicitOps), D(ImplicitOps), D(ImplicitOps),
       D(ImplicitOps), D(ImplicitOps), G(0, group4), G(0, group5),
  };
 
Quoted 9 lines

arch/x86/kvm/emulate.c special_insn: · line 3134

Quoted 7 lines
arch/x86/kvm/emulate.c +3 -0
@@ -3129,6 +3129,10 @@ special_insn:
               ctxt->eflags&= ~EFLG_CF;
               c->dst.type = OP_NONE;  /* Disable writeback. */
               break;
+     case 0xf9: /* stc */
+             ctxt->eflags |= EFLG_CF;
+             c->dst.type = OP_NONE;  /* Disable writeback */

With "disable writeback when decode dest operand" patch (which should be applied already) this is no longer needed.

Quoted 1 line

Right. Should I wait for it to be merged and resend?

It's merged (in next branch), but I'll just drop that line when applying.

Signature · 1 line
error compiling committee.c: too many arguments to function