Skip to contentSkip to conversation

(big) real mode emulation - stc,cld

PATCH In review Nitin A Kamble 2 participants 5 messages Oct 31, 2007 4 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (big) real mode emulation - stc,cld

Hi Avi,
Attached is the patch to implement emulation of instructions

stc (opcode 0xf9)
cld (opcode 0xfc)

Please Apply.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

From 50365b0c900dc6d6f34395c6607b07f58aac3d70 Mon Sep 17 00:00:00 2001
From: Nitin A Kamble <[email protected]>
Date: Tue, 30 Oct 2007 19:43:07 -0800
Subject: [PATCH] Implement emulation of instructions

        stc (opcode 0xf9)
        cld (opcode 0xfc)
---
 drivers/kvm/x86_emulate.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
drivers/kvm/x86_emulate.c +11 -2
index 1357355..21f3831 100644
@@ -173,8 +173,9 @@ static u16 opcode_table[256] = {
 	ImplicitOps, ImplicitOps,
 	ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM,
 	/* 0xF8 - 0xFF */
-	ImplicitOps, 0, ImplicitOps, ImplicitOps,
-	0, 0, ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps, 0,
+	ByteOp | DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM
 };
 
 static u16 twobyte_table[256] = {
@@ -1606,6 +1607,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 */
 		ctxt->eflags &= ~X86_EFLAGS_IF;
 		c->dst.type = OP_NONE;	/* Disable writeback. */
@@ -1614,6 +1619,10 @@ special_insn:
 		ctxt->eflags |= X86_EFLAGS_IF;
 		c->dst.type = OP_NONE;	/* Disable writeback. */
 		break;
+	case 0xfc: /* cld */
+		ctxt->eflags |= X86_EFLAGS_DF;
+		c->dst.type = OP_NONE;	/* Disable writeback. */
+		break;
 	}
 	if (c->rep_prefix) {
 		if (c->regs[VCPU_REGS_RCX] == 0) {
Signature · 1 line
1.5.2.2

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

#2 lore raw
In reply to a message not in the archive

drivers/kvm/x86_emulate.c special_insn: · line 1626

Quoted 11 lines · Nitin A Kamble

Hi Avi,
Attached is the patch to implement emulation of instructions

stc (opcode 0xf9)
cld (opcode 0xfc)

drivers/kvm/x86_emulate.c +4 -0
+       case 0xfc: /* cld */
+               ctxt->eflags |= X86_EFLAGS_DF;
+               c->dst.type = OP_NONE;  /* Disable writeback. */
+               break;
        }

This is 'cld', but it looks like you're setting DF?

Signature · 8 lines
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
#4 lore raw
In reply to a message not in the archive
Quoted 1 line · Avi Kivity

This is 'cld', but it looks like you're setting DF?

Good catch. Same problem hand copy of the patch.
It should look like this.
+ case 0xfc: /* cld */
+ ctxt->eflags &= ~EFLG_DF;

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

#6 lore raw
In reply to a message not in the archive

Review

Quoted 10 lines · Nitin A Kamble
Quoted 2 lines · Avi Kivity

This is 'cld', but it looks like you're setting DF?

Good catch. Same problem hand copy of the patch.
It should look like this.

(quoted diff) +2 -0
+       case 0xfc: /* cld */
+               ctxt->eflags &= ~EFLG_DF;

'git gui' and 'git add -i' allow picking specific hunks out of a larger change.

Signature · 8 lines
Any sufficiently difficult bug is indistinguishable from a feature.


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
#8 lore raw
In reply to a message not in the archive
Quoted 2 lines · Avi Kivity

'git gui' and 'git add -i' allow picking specific hunks out of a larger change.

This seems like better way of cutting patches. Thanks a lot for sharing the trick.

Signature · 5 lines
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel