Skip to contentSkip to conversation

(big) real mode emulation - inc dec instructions emulation

PATCH Applied Nitin A Kamble 2 participants 2 messages Oct 16, 2007 1 message not in the archive KVM

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (big) real mode emulation - inc dec instructions emulation

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

inc : opcodes 0x40-0x47
&
dec : opcodes 0x48-0x4f

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 0247f659963dc3fbe61081b92f6f7c6a29cc5100 Mon Sep 17 00:00:00 2001
From: Nitin A Kamble <[email protected]>
Date: Fri, 12 Oct 2007 17:40:33 -0700
Subject: [PATCH] Implement emulation of instruction : inc & dec

Instructions:

	inc r16/r32 (opcode 0x40-0x47)
	dec r16/r32 (opcode 0x48-0x4f)
---
 drivers/kvm/x86_emulate.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)
drivers/kvm/x86_emulate.c +18 -2
index fa33fcd..1e4f026 100644
@@ -96,8 +96,12 @@ static u8 opcode_table[256] = {
 	ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
 	ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
 	0, 0, 0, 0,
-	/* 0x40 - 0x4F */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	/* 0x40 - 0x47 */
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	/* 0x48 - 0x4F */
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
 	/* 0x50 - 0x57 */
 	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
 	ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1371,6 +1375,18 @@ special_insn:
 	if (c->twobyte)
 		goto twobyte_special_insn;
 	switch (c->b) {
+	case 0x40 ... 0x47: /* inc r16/r32 */
+		c->dst.bytes = c->op_bytes;
+		c->dst.ptr = (unsigned long *)&c->regs[c->b & 0x7];
+		c->dst.val = *c->dst.ptr;
+		emulate_1op("inc", c->dst, ctxt->eflags);
+		break;
+	case 0x48 ... 0x4f: /* dec r16/r32 */
+		c->dst.bytes = c->op_bytes;
+		c->dst.ptr = (unsigned long *)&c->regs[c->b & 0x7];
+		c->dst.val = *c->dst.ptr;
+		emulate_1op("dec", c->dst, ctxt->eflags);
+		break;
 	case 0x50 ... 0x57:  /* push reg */
 		if (c->op_bytes == 2)
 			c->src.val = (u16) c->regs[c->b & 0x7];
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

A message that is not in the archive (sent off-list or not yet received): 1192556351.874.3.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org

Applied
#2 lore raw
Quoted 8 lines · Nitin A Kamble

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

inc : opcodes 0x40-0x47
&
dec : opcodes 0x48-0x4f

Applied, thanks.

Signature · 8 lines
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


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