Skip to contentSkip to conversation

x86 emulator: Emulate cld and std instructions

PATCH In review Mohammed Gamal 1 participant 2 messages Jul 30, 2008

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

PATCH 1/1 x86 emulator: Emulate cld and std instructions

This patch adds instructions 'cld' and 'std' to the emulator.

---

Quoted 1 line

From 23c0868c6a48a5e75693bd4552255a89cf26bdc8 Mon Sep 17 00:00:00 2001

From: Mohammed Gamal <mohd@mohd-laptop.(none)>
Date: Thu, 31 Jul 2008 00:04:34 +0300
Subject: [PATCH] Emulate cld and std instructions

---
 arch/x86/kvm/x86_emulate.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/x86/kvm/x86_emulate.c +8 -0
index d5da7f1..9c72a77 100644
@@ -1755,6 +1755,14 @@ special_insn:
 		ctxt->eflags |= X86_EFLAGS_IF;
 		c->dst.type = OP_NONE;	/* Disable writeback. */
 		break;
+	case 0xfc: /* cld */
+		ctxt->eflags &= ~EFLG_DF;
+		c->dst.type = OP_NONE;  /* Disable writeback. */
+		break;
+	case 0xfd: /* std */
+		ctxt->eflags |= EFLG_DF;
+		c->dst.type = OP_NONE;  /* Disable writeback. */
+		break;
 	case 0xfe ... 0xff:	/* Grp4/Grp5 */
 		rc = emulate_grp45(ctxt, ops);
 		if (rc != 0)
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 33 lines · Mohammed Gamal

This patch adds instructions 'cld' and 'std' to the emulator.

---
From 23c0868c6a48a5e75693bd4552255a89cf26bdc8 Mon Sep 17 00:00:00 2001
From: Mohammed Gamal <mohd@mohd-laptop.(none)>
Date: Thu, 31 Jul 2008 00:04:34 +0300
Subject: [PATCH] Emulate cld and std instructions

---
 arch/x86/kvm/x86_emulate.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
arch/x86/kvm/x86_emulate.c +8 -1
index d5da7f1..9c72a77 100644
@@ -1755,6 +1755,14 @@ special_insn:
               ctxt->eflags |= X86_EFLAGS_IF;
               c->dst.type = OP_NONE;  /* Disable writeback. */
               break;
+       case 0xfc: /* cld */
+               ctxt->eflags &= ~EFLG_DF;
+               c->dst.type = OP_NONE;  /* Disable writeback. */
+               break;
+       case 0xfd: /* std */
+               ctxt->eflags |= EFLG_DF;
+               c->dst.type = OP_NONE;  /* Disable writeback. */
+               break;
       case 0xfe ... 0xff:     /* Grp4/Grp5 */
               rc = emulate_grp45(ctxt, ops);
               if (rc != 0)
--
Quoted 2 lines

1.5.4.3

Please ignore this patch due to format errors. I will resend it.