public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Nitin A Kamble <nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Cc: kvm-devel <kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
Subject: Re: [Patch] (big) real mode emulation - jmp rel
Date: Thu, 16 Aug 2007 16:54:22 -0700	[thread overview]
Message-ID: <1187308462.10269.12.camel@lnitindesktop.sc.intel.com> (raw)
In-Reply-To: <1187296469.5500.7.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>


[-- Attachment #1.1.1: Type: text/plain, Size: 574 bytes --]

Hi Avi,
   If you are fine with macro then attached are the updated patches for
"jmp rel" & "jmp rel short" instruction emulation.

On Thu, 2007-08-16 at 13:34 -0700, Nitin A Kamble wrote:
> Avi,
> 	In my opinion converting this small function to file-scope function,
> would make code look ugly. I think the earlier Macro definition was
> better.

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

[-- Attachment #1.1.2: jmprel_2.patch --]
[-- Type: text/x-patch, Size: 1540 bytes --]

commit 38177680ad53b330d0f8b4fcec20953a7a7dfa2d
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date:   Thu Aug 16 19:10:14 2007 -0700

    Implement instruction "jmp rel" opcode 0xe9
    
    Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>

diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index b4f439c..6519cf9 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -145,8 +145,10 @@ static u8 opcode_table[256] = {
 	0, 0, 0, 0,
 	/* 0xD8 - 0xDF */
 	0, 0, 0, 0, 0, 0, 0, 0,
-	/* 0xE0 - 0xEF */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	/* 0xE0 - 0xE7 */
+	0, 0, 0, 0, 0, 0, 0, 0,
+	/* 0xE8 - 0xEF */
+	0, SrcImm|ImplicitOps, 0, 0, 0, 0, 0, 0,
 	/* 0xF0 - 0xF7 */
 	0, 0, 0, 0,
 	ImplicitOps, 0,
@@ -447,6 +449,12 @@ struct operand {
 			   (((reg) + _inc) & ((1UL << (ad_bytes << 3)) - 1)); \
 	} while (0)
 
+#define jmp_rel(rel) 							\
+	do {								\
+		_eip += (int)(rel);					\
+		_eip = ((op_bytes == 2) ? (uint16_t)_eip : (uint32_t)_eip); \
+	} while (0)
+
 /*
  * Given the 'reg' portion of a ModRM byte, and a register block, return a
  * pointer into the block that addresses the relevant register.
@@ -1200,6 +1208,10 @@ special_insn:
 	case 0xae ... 0xaf:	/* scas */
 		DPRINTF("Urk! I don't handle SCAS.\n");
 		goto cannot_emulate;
+	case 0xe9: /* jmp rel */
+		jmp_rel(src.val);
+		no_wb = 1; /* Disable writeback. */
+		break;
 	case 0xf4:              /* hlt */
 		ctxt->vcpu->halt_request = 1;
 		goto done;

[-- Attachment #1.1.3: jmp_rel_short.patch --]
[-- Type: text/x-patch, Size: 971 bytes --]

commit 38f7db6830c862cd0470aaa07cabe616ff741d69
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date:   Fri Aug 10 18:48:05 2007 -0700

    Implement "jmp rel short" opcode: 0xeb
    
    Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>

diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 40fb6ee..16ea385 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -148,7 +148,7 @@ static u8 opcode_table[256] = {
 	/* 0xE0 - 0xE7 */
 	0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0xE8 - 0xEF */
-	0, SrcImm|ImplicitOps, 0, 0, 0, 0, 0, 0,
+	0, SrcImm|ImplicitOps, 0, SrcImmByte|ImplicitOps, 0, 0, 0, 0,
 	/* 0xF0 - 0xF7 */
 	0, 0, 0, 0,
 	ImplicitOps, 0,
@@ -1208,6 +1208,7 @@ special_insn:
 	case 0xae ... 0xaf:	/* scas */
 		DPRINTF("Urk! I don't handle SCAS.\n");
 		goto cannot_emulate;
+	case 0xeb: /* jmp rel short */
 	case 0xe9: /* jmp rel */
 		jmp_rel(src.val);
 		no_wb = 1; /* Disable writeback. */

[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 315 bytes --]

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

[-- Attachment #3: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

  parent reply	other threads:[~2007-08-16 23:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-10 22:32 [Patch] (big) real mode emulation - jmp rel Nitin A Kamble
     [not found] ` <1186785157.6097.19.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-08-13  8:49   ` Avi Kivity
     [not found]     ` <46C01B0E.7080304-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-16  1:15       ` Nitin A Kamble
     [not found]         ` <1187226935.24576.5.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-08-16 10:25           ` Avi Kivity
     [not found]             ` <46C42610.8020707-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-16 20:34               ` Nitin A Kamble
     [not found]                 ` <1187296469.5500.7.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-08-16 23:54                   ` Nitin A Kamble [this message]
2007-08-17 12:24                   ` Avi Kivity
     [not found]                     ` <46C59385.6060108-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-08-17 22:24                       ` Nitin A Kamble
     [not found]                         ` <1187389499.9011.14.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-08-19  8:03                           ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1187308462.10269.12.camel@lnitindesktop.sc.intel.com \
    --to=nitin.a.kamble-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org \
    --cc=kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox