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>,
Laurent Vivier <Laurent.Vivier-6ktuUTfB/bM@public.gmane.org>
Subject: [PATCH] (big) real mode emulation - jump conditional relative
Date: Thu, 13 Sep 2007 11:55:05 -0700 [thread overview]
Message-ID: <1189709705.28738.9.camel@lnitindesktop.sc.intel.com> (raw)
In-Reply-To: <1189707324.28738.0.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 365 bytes --]
Hi Avi,
Attached is the patch to implement instruction:
jump conditional relative (like: jnz jo etc)
opcode : 0x0f80 - 0x0f8f
Please apply.
--
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: jmp_conditional_rel.patch --]
[-- Type: text/x-patch, Size: 2540 bytes --]
commit 3a29a61aabc299ccd5b41d50207e2dfbc7b38236
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 14:57:28 2007 -0700
Implement emulation of instruction:
jump conditional rel
opcodes: 0x0f80 - 0x0f8f
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 18c2b2c..007961b 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -188,7 +188,10 @@ static u16 twobyte_table[256] = {
/* 0x70 - 0x7F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x80 - 0x8F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
/* 0x90 - 0x9F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/* 0xA0 - 0xA7 */
@@ -479,6 +482,42 @@ static int read_descriptor(struct x86_emulate_ctxt *ctxt,
return rc;
}
+static int
+test_cc(unsigned int condition, unsigned int flags)
+{
+ int rc = 0;
+
+ switch ((condition & 15) >> 1) {
+ case 0: /* o */
+ rc |= (flags & EFLG_OF);
+ break;
+ case 1: /* b/c/nae */
+ rc |= (flags & EFLG_CF);
+ break;
+ case 2: /* z/e */
+ rc |= (flags & EFLG_ZF);
+ break;
+ case 3: /* be/na */
+ rc |= (flags & (EFLG_CF|EFLG_ZF));
+ break;
+ case 4: /* s */
+ rc |= (flags & EFLG_SF);
+ break;
+ case 5: /* p/pe */
+ rc |= (flags & EFLG_PF);
+ break;
+ case 7: /* le/ng */
+ rc |= (flags & EFLG_ZF);
+ /* fall through */
+ case 6: /* l/nge */
+ rc |= (!(flags & EFLG_SF) != !(flags & EFLG_OF));
+ break;
+ }
+
+ /* Odd condition identifiers (lsb == 1) have inverted sense. */
+ return (!!rc ^ (condition & 1));
+}
+
int
x86_emulate_memop(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
{
@@ -1487,6 +1526,26 @@ twobyte_special_insn:
}
rc = X86EMUL_CONTINUE;
break;
+ case 0x80 ... 0x8f: /* jnz rel, etc*/ {
+ long int rel;
+ switch (op_bytes) {
+ case 2:
+ rel = insn_fetch(s16, 2, _eip);
+ break;
+ case 4:
+ rel = insn_fetch(s32, 4, _eip);
+ break;
+ case 8:
+ rel = insn_fetch(s64, 8, _eip);
+ break;
+ default:
+ DPRINTF("jnz: Invalid op_bytes\n");
+ goto cannot_emulate;
+ }
+ if (test_cc(b, _eflags))
+ JMP_REL(rel);
+ }
+ break;
case 0xc7: /* Grp9 (cmpxchg8b) */
{
u64 old, new;
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #2: Type: text/plain, Size: 228 bytes --]
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
[-- 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
next prev parent reply other threads:[~2007-09-13 18:55 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1188349132.9270.7.camel@lnitindesktop.sc.intel.com>
[not found] ` <20070829020005.GA32726@jim.sh>
[not found] ` <20070829020005.GA32726-lSbMZ+N7itA@public.gmane.org>
2007-09-01 14:10 ` [PATCH] (big) real mode emulation - push imm8 Avi Kivity
[not found] ` <1188349132.9270.7.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-12 7:54 ` Avi Kivity
[not found] ` <46E79B2A.60506-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-12 8:16 ` Laurent Vivier
[not found] ` <46E7A073.6030601-6ktuUTfB/bM@public.gmane.org>
2007-09-12 8:28 ` Avi Kivity
[not found] ` <46E7A317.208-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-13 0:36 ` Kamble, Nitin A
[not found] ` <47DF6B76DC88174EB18F2393E76FC46EB20712F4@scsmsx412.amr.corp.intel.com>
[not found] ` <47DF6B76DC88174EB18F2393E76FC46EB20712F4-1a9uaKK1+wJcIJlls4ac1rfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2007-09-13 18:15 ` Nitin A Kamble
[not found] ` <1189707324.28738.0.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 18:28 ` Nitin A Kamble
[not found] ` <1189708119.28738.5.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:13 ` Avi Kivity
2007-09-13 18:55 ` Nitin A Kamble [this message]
[not found] ` <1189709705.28738.9.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 20:48 ` [PATCH] (big) real mode emulation - jump conditional relative Anthony Liguori
[not found] ` <46E9A215.9020304-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-09-13 20:53 ` Kamble, Nitin A
2007-09-13 23:18 ` [PATCH] (big) real mode emulation - jump conditional short relative Nitin A Kamble
[not found] ` <1189725509.28738.12.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 23:26 ` [PATCH] (big) real mode emulation - or instruction correction Nitin A Kamble
[not found] ` <1189725983.28738.15.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 23:36 ` [PATCH] (big) real mode emulation - sub imm Nitin A Kamble
[not found] ` <1189726560.28738.18.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 23:47 ` [PATCH] (big) real mode emulation - cmp correction Nitin A Kamble
[not found] ` <1189727241.28738.21.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 23:54 ` [PATCH] (big) real mode emulation - mov correction Nitin A Kamble
[not found] ` <1189727640.28738.24.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 0:02 ` [PATCH] (big) real mode emulation - lea Nitin A Kamble
[not found] ` <1189728138.28738.27.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 0:15 ` [PATCH] (big) real mode emulation - mov imm Nitin A Kamble
[not found] ` <1189728902.28738.31.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 0:22 ` [PATCH] (big) real mode emulation - initialization fixes Nitin A Kamble
[not found] ` <1189729357.28738.33.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 0:40 ` [PATCH] (big) real mode emulation - popf Nitin A Kamble
[not found] ` <1189730445.28738.36.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 18:20 ` [PATCH] (big) real mode emulation - jmp abs Nitin A Kamble
[not found] ` <1189794045.28738.47.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 18:43 ` [PATCH] (big) real mode emulation - inc reg Nitin A Kamble
[not found] ` <1189795407.28738.50.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 18:50 ` [PATCH] (big) real mode emulation - dec reg Nitin A Kamble
[not found] ` <1189795841.28738.53.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-18 22:14 ` [PATCH] (big) real mode emulation - correct code placement Nitin A Kamble
[not found] ` <1190153661.4620.3.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-19 12:12 ` Avi Kivity
2007-09-15 7:39 ` [PATCH] (big) real mode emulation - inc reg Avi Kivity
2007-09-15 7:41 ` [PATCH] (big) real mode emulation - jmp abs Avi Kivity
2007-09-15 7:45 ` [PATCH] (big) real mode emulation - popf Avi Kivity
2007-09-14 17:08 ` [PATCH] (big) real mode emulation - initialization fixes Avi Kivity
[not found] ` <46EAC01F.7040609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-14 17:33 ` Nitin A Kamble
[not found] ` <1189791233.28738.42.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 17:42 ` Avi Kivity
2007-09-15 7:43 ` Avi Kivity
2007-09-15 7:48 ` [PATCH] (big) real mode emulation - mov imm Avi Kivity
2007-09-15 7:36 ` [PATCH] (big) real mode emulation - lea Avi Kivity
2007-09-15 7:33 ` [PATCH] (big) real mode emulation - or instruction correction Avi Kivity
2007-09-15 7:29 ` [PATCH] (big) real mode emulation - jump conditional relative 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=1189709705.28738.9.camel@lnitindesktop.sc.intel.com \
--to=nitin.a.kamble-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=Laurent.Vivier-6ktuUTfB/bM@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