* Re: [PATCH] (big) real mode emulation - push imm8
[not found] ` <20070829020005.GA32726-lSbMZ+N7itA@public.gmane.org>
@ 2007-09-01 14:10 ` Avi Kivity
0 siblings, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-01 14:10 UTC (permalink / raw)
To: Jim Paris; +Cc: kvm-devel
Jim Paris wrote:
>> And regarding the patches in the dos format, I tried sending patches to
>> my yahoo/gmail account and I don't see them in the DOS format. It's
>> strange it is reaching you in the DOS format. I don't know a way to
>> avoid it right now. Please let me know if there is any known trick or
>> method to avoid this issue.
>>
>
> Your attachments look correct to me. They have CR/LF endings in the
> base64 encoded data, but that is the correct "canonical form" for
> text/* attachments as described by MIME (RFC2049 etc). Avi, I think
> your client should be converting to the "local form" when you save
> them -- Evolution and Mutt at least do this.
>
>
Okay. I'll just run dos2unix then, and file a bug report against
thunderbird.
> Regardless, Nitin might be able to avoid the problems by sending the
> attachments with a non-text mime-type, maybe by renaming them to *.dat?
>
>
That might cause them not to be viewed inline, so I'd rather not.
--
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[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>
0 siblings, 1 reply; 36+ messages in thread
From: Avi Kivity @ 2007-09-12 7:54 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement the push imm8 instruction opcode
> 0x6a.
>
> Please apply or comment.
>
>
The patches look good, but I am holding on right now because of the
emulator split. If that is not merged in the next couple of days, I
will merge your patches.
> And regarding the patches in the dos format, I tried sending patches to
> my yahoo/gmail account and I don't see them in the DOS format. It's
> strange it is reaching you in the DOS format. I don't know a way to
> avoid it right now. Please let me know if there is any known trick or
> method to avoid this issue.
>
>
It's probably an issue at my end (Thunderbird). I'll just have to
remember to run dos2unix on the patches.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[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>
0 siblings, 1 reply; 36+ messages in thread
From: Laurent Vivier @ 2007-09-12 8:16 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
[-- Attachment #1.1: Type: text/plain, Size: 923 bytes --]
Avi Kivity wrote:
> Nitin A Kamble wrote:
>> Hi Avi,
>> Attached is the patch to implement the push imm8 instruction opcode
>> 0x6a.
>>
>> Please apply or comment.
>>
>>
>
> The patches look good, but I am holding on right now because of the
> emulator split. If that is not merged in the next couple of days, I
> will merge your patches.
I'm currently working on this.
But first of all I'm trying to install a FC-6 to reproduce the problem (I don't
have it with a Debian etch): I don't know why but I have some problems with the
fedora installer (even If I take older kvm or qemu). The merge seems good.
Avi, if you want you can apply all modification you have on the x86_emulator,
I'll rewrite the emulator split according these modifications.
Tx,
Laurent
--
------------- Laurent.Vivier-6ktuUTfB/bM@public.gmane.org --------------
"Software is hard" - Donald Knuth
[-- Attachment #1.2: OpenPGP digital signature --]
[-- 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
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[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>
[not found] ` <47DF6B76DC88174EB18F2393E76FC46EB20712F4@scsmsx412.amr.corp.intel.com>
0 siblings, 2 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-12 8:28 UTC (permalink / raw)
To: Laurent Vivier; +Cc: kvm-devel
Laurent Vivier wrote:
> Avi Kivity wrote:
>
>> Nitin A Kamble wrote:
>>
>>> Hi Avi,
>>> Attached is the patch to implement the push imm8 instruction opcode
>>> 0x6a.
>>>
>>> Please apply or comment.
>>>
>>>
>>>
>> The patches look good, but I am holding on right now because of the
>> emulator split. If that is not merged in the next couple of days, I
>> will merge your patches.
>>
>
> I'm currently working on this.
>
>
Thanks!
> But first of all I'm trying to install a FC-6 to reproduce the problem (I don't
> have it with a Debian etch): I don't know why but I have some problems with the
> fedora installer (even If I take older kvm or qemu). The merge seems good.
>
> Avi, if you want you can apply all modification you have on the x86_emulator,
> I'll rewrite the emulator split according these modifications.
>
Okay, I'll apply Nitin's patches.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[not found] ` <46E7A317.208-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-09-13 0:36 ` Kamble, Nitin A
0 siblings, 0 replies; 36+ messages in thread
From: Kamble, Nitin A @ 2007-09-13 0:36 UTC (permalink / raw)
To: Avi Kivity, Laurent Vivier; +Cc: kvm-devel
[-- Attachment #1: Type: text/plain, Size: 1631 bytes --]
Hi Avi,
Thanks for pushing my patch in.
Can you also take the attached patch? It will make my daily merges
easier.
Thanks & Regards,
Nitin
Linux Open Source Technology Center, Intel Corporation
------------------------------------------------------------------------
--------
The Mind is like a parachute; it works much better when it's open.
-----Original Message-----
From: Avi Kivity [mailto:avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org]
Sent: Wednesday, September 12, 2007 1:28 AM
To: Laurent Vivier
Cc: Kamble, Nitin A; kvm-devel
Subject: Re: [kvm-devel] [PATCH] (big) real mode emulation - push imm8
Laurent Vivier wrote:
> Avi Kivity wrote:
>
>> Nitin A Kamble wrote:
>>
>>> Hi Avi,
>>> Attached is the patch to implement the push imm8 instruction
opcode
>>> 0x6a.
>>>
>>> Please apply or comment.
>>>
>>>
>>>
>> The patches look good, but I am holding on right now because of the
>> emulator split. If that is not merged in the next couple of days, I
>> will merge your patches.
>>
>
> I'm currently working on this.
>
>
Thanks!
> But first of all I'm trying to install a FC-6 to reproduce the problem
(I don't
> have it with a Debian etch): I don't know why but I have some problems
with the
> fedora installer (even If I take older kvm or qemu). The merge seems
good.
>
> Avi, if you want you can apply all modification you have on the
x86_emulator,
> I'll rewrite the emulator split according these modifications.
>
Okay, I'll apply Nitin's patches.
--
error compiling committee.c: too many arguments to function
[-- Attachment #2: Type: message/rfc822, Size: 9895 bytes --]
[-- Attachment #2.1.1.1: Type: text/plain, Size: 470 bytes --]
Hi Avi,
Attached is the patch to sort remaining op-codes entries in the
x86_emulate.c
This patch is just restructuring current code, not new logic added to
the file. It makes my life simpler with merging my x86 emulation tree.
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 #2.1.1.2: opcodes_sorted2.patch --]
[-- Type: text/x-patch, Size: 5828 bytes --]
commit 0af0b63e81cc345009d63703e5a7228fc9edd4d2
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 6 16:46:31 2007 -0700
sort remaining opcodes in the master tree, to make merge with my tree easiser.
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 7439b34..97b7616 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -976,19 +976,8 @@ done_prefixes:
dst.val = src.val;
lock_prefix = 1;
break;
- case 0xa0 ... 0xa1: /* mov */
- dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX];
- dst.val = src.val;
- _eip += ad_bytes; /* skip src displacement */
- break;
- case 0xa2 ... 0xa3: /* mov */
- dst.val = (unsigned long)_regs[VCPU_REGS_RAX];
- _eip += ad_bytes; /* skip dst displacement */
- break;
case 0x88 ... 0x8b: /* mov */
- case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
- dst.val = src.val;
- break;
+ goto mov;
case 0x8f: /* pop (sole member of Grp1a) */
/* 64-bit mode: POP always pops a 64-bit operand. */
if (mode == X86EMUL_MODE_PROT64)
@@ -999,6 +988,15 @@ done_prefixes:
goto done;
register_address_increment(_regs[VCPU_REGS_RSP], dst.bytes);
break;
+ case 0xa0 ... 0xa1: /* mov */
+ dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX];
+ dst.val = src.val;
+ _eip += ad_bytes; /* skip src displacement */
+ break;
+ case 0xa2 ... 0xa3: /* mov */
+ dst.val = (unsigned long)_regs[VCPU_REGS_RAX];
+ _eip += ad_bytes; /* skip dst displacement */
+ break;
case 0xc0 ... 0xc1:
grp2: /* Grp2 */
switch (modrm_reg) {
@@ -1026,6 +1024,10 @@ done_prefixes:
break;
}
break;
+ case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
+ mov:
+ dst.val = src.val;
+ break;
case 0xd0 ... 0xd1: /* Grp2 */
src.val = 1;
goto grp2;
@@ -1164,6 +1166,8 @@ special_insn:
dst.ptr = (void *) register_address(
ctxt->ss_base, _regs[VCPU_REGS_RSP]);
break;
+ case 0x58 ... 0x5f: /* pop reg */
+ dst.ptr = (unsigned long *)&_regs[b & 0x7];
case 0x6c: /* insb */
case 0x6d: /* insw/insd */
if (kvm_emulate_pio_string(ctxt->vcpu, NULL,
@@ -1195,6 +1199,22 @@ special_insn:
) == 0)
return -1;
return 0;
+ case 0xc3: /* ret */
+ dst.ptr = &_eip;
+ goto pop_instruction;
+ case 0xf4: /* hlt */
+ ctxt->vcpu->halt_request = 1;
+ goto done;
+
+pop_instruction:
+ if ((rc = ops->read_std(register_address(ctxt->ss_base,
+ _regs[VCPU_REGS_RSP]), dst.ptr, op_bytes, ctxt->vcpu))
+ != 0)
+ goto done;
+
+ register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
+ no_wb = 1; /* Disable writeback. */
+ break;
}
if (rep_prefix) {
if (_regs[VCPU_REGS_RCX] == 0) {
@@ -1243,24 +1263,7 @@ special_insn:
case 0xae ... 0xaf: /* scas */
DPRINTF("Urk! I don't handle SCAS.\n");
goto cannot_emulate;
- case 0xf4: /* hlt */
- ctxt->vcpu->halt_request = 1;
- goto done;
- case 0xc3: /* ret */
- dst.ptr = &_eip;
- goto pop_instruction;
- case 0x58 ... 0x5f: /* pop reg */
- dst.ptr = (unsigned long *)&_regs[b & 0x7];
-
-pop_instruction:
- if ((rc = ops->read_std(register_address(ctxt->ss_base,
- _regs[VCPU_REGS_RSP]), dst.ptr, op_bytes, ctxt->vcpu))
- != 0)
- goto done;
- register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
- no_wb = 1; /* Disable writeback. */
- break;
}
goto writeback;
@@ -1354,6 +1357,16 @@ twobyte_insn:
/* Odd cmov opcodes (lsb == 1) have inverted sense. */
no_wb ^= b & 1;
break;
+ case 0xa3:
+ bt: /* bt */
+ src.val &= (dst.bytes << 3) - 1; /* only subword offset */
+ emulate_2op_SrcV_nobyte("bt", src, dst, _eflags);
+ break;
+ case 0xab:
+ bts: /* bts */
+ src.val &= (dst.bytes << 3) - 1; /* only subword offset */
+ emulate_2op_SrcV_nobyte("bts", src, dst, _eflags);
+ break;
case 0xb0 ... 0xb1: /* cmpxchg */
/*
* Save real source value, then compare EAX against
@@ -1371,30 +1384,15 @@ twobyte_insn:
dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX];
}
break;
- case 0xa3:
- bt: /* bt */
- src.val &= (dst.bytes << 3) - 1; /* only subword offset */
- emulate_2op_SrcV_nobyte("bt", src, dst, _eflags);
- break;
case 0xb3:
btr: /* btr */
src.val &= (dst.bytes << 3) - 1; /* only subword offset */
emulate_2op_SrcV_nobyte("btr", src, dst, _eflags);
break;
- case 0xab:
- bts: /* bts */
- src.val &= (dst.bytes << 3) - 1; /* only subword offset */
- emulate_2op_SrcV_nobyte("bts", src, dst, _eflags);
- break;
case 0xb6 ... 0xb7: /* movzx */
dst.bytes = op_bytes;
dst.val = (d & ByteOp) ? (u8) src.val : (u16) src.val;
break;
- case 0xbb:
- btc: /* btc */
- src.val &= (dst.bytes << 3) - 1; /* only subword offset */
- emulate_2op_SrcV_nobyte("btc", src, dst, _eflags);
- break;
case 0xba: /* Grp8 */
switch (modrm_reg & 3) {
case 0:
@@ -1407,6 +1405,11 @@ twobyte_insn:
goto btc;
}
break;
+ case 0xbb:
+ btc: /* btc */
+ src.val &= (dst.bytes << 3) - 1; /* only subword offset */
+ emulate_2op_SrcV_nobyte("btc", src, dst, _eflags);
+ break;
case 0xbe ... 0xbf: /* movsx */
dst.bytes = op_bytes;
dst.val = (d & ByteOp) ? (s8) src.val : (s16) src.val;
@@ -1418,14 +1421,14 @@ twobyte_special_insn:
/* Disable writeback. */
no_wb = 1;
switch (b) {
+ case 0x06:
+ emulate_clts(ctxt->vcpu);
+ break;
case 0x09: /* wbinvd */
break;
case 0x0d: /* GrpP (prefetch) */
case 0x18: /* Grp16 (prefetch/nop) */
break;
- case 0x06:
- emulate_clts(ctxt->vcpu);
- break;
case 0x20: /* mov cr, reg */
if (modrm_mod != 3)
goto cannot_emulate;
[-- Attachment #2.1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
[-- Attachment #3: 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 #4: 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[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>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 18:15 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 2870 bytes --]
Hi Avi,
Attached is the updated version of the patch, to match the latest tip
of the tree.
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
On Wed, 2007-09-12 at 17:36 -0700, Kamble, Nitin A wrote:
> Hi Avi,
> Thanks for pushing my patch in.
>
> Can you also take the attached patch? It will make my daily merges
> easier.
>
> Thanks & Regards,
> Nitin
> Linux Open Source Technology Center, Intel Corporation
> ------------------------------------------------------------------------
> --------
> The Mind is like a parachute; it works much better when it's open.
>
> -----Original Message-----
> From: Avi Kivity [mailto:avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org]
> Sent: Wednesday, September 12, 2007 1:28 AM
> To: Laurent Vivier
> Cc: Kamble, Nitin A; kvm-devel
> Subject: Re: [kvm-devel] [PATCH] (big) real mode emulation - push imm8
>
> Laurent Vivier wrote:
> > Avi Kivity wrote:
> >
> >> Nitin A Kamble wrote:
> >>
> >>> Hi Avi,
> >>> Attached is the patch to implement the push imm8 instruction
> opcode
> >>> 0x6a.
> >>>
> >>> Please apply or comment.
> >>>
> >>>
> >>>
> >> The patches look good, but I am holding on right now because of the
> >> emulator split. If that is not merged in the next couple of days, I
> >> will merge your patches.
> >>
> >
> > I'm currently working on this.
> >
> >
> Thanks!
>
> > But first of all I'm trying to install a FC-6 to reproduce the problem
> (I don't
> > have it with a Debian etch): I don't know why but I have some problems
> with the
> > fedora installer (even If I take older kvm or qemu). The merge seems
> good.
> >
> > Avi, if you want you can apply all modification you have on the
> x86_emulator,
> > I'll rewrite the emulator split according these modifications.
> >
>
> Okay, I'll apply Nitin's patches.
>
>
> email message attachment
> > -------- Forwarded Message --------
> > From: Kamble, Nitin A <nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> > Reply-To: Kamble, Nitin A <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: [PATCH] (big) real mode emulation - sort opcode entries 2
> > Date: Thu, 6 Sep 2007 14:54:55 -0700
> >
> > Hi Avi,
> > Attached is the patch to sort remaining op-codes entries in the
> > x86_emulate.c
> > This patch is just restructuring current code, not new logic added to
> > the file. It makes my life simpler with merging my x86 emulation tree.
> >
> > please apply.
> >
[-- Attachment #1.1.2: opcodes_sorted3.patch --]
[-- Type: text/x-patch, Size: 0 bytes --]
[-- 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
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[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-13 18:55 ` [PATCH] (big) real mode emulation - jump conditional relative Nitin A Kamble
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 18:28 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier, Bernhard Kaindl
[-- Attachment #1.1.1: Type: text/plain, Size: 513 bytes --]
The patch was empty in the last email. My mistake. Reattaching it.
Thanks to Bernhard for pointing it out.
--
Thanks & Regards,
Nitin
Open Source Technology Center, Intel Corporation
-----------------------------------------------------------------
The mind is like a parachute; it works much better when it's open
On Thu, 2007-09-13 at 11:15 -0700, Nitin A Kamble wrote:
> Hi Avi,
> Attached is the updated version of the patch, to match the latest tip
> of the tree.
>
> Please apply.
[-- Attachment #1.1.2: opcodes_sorted3.patch --]
[-- Type: text/x-patch, Size: 5608 bytes --]
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 18c2b2c..cd3c5f7 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -978,19 +978,8 @@ push:
dst.val = src.val;
lock_prefix = 1;
break;
- case 0xa0 ... 0xa1: /* mov */
- dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX];
- dst.val = src.val;
- _eip += ad_bytes; /* skip src displacement */
- break;
- case 0xa2 ... 0xa3: /* mov */
- dst.val = (unsigned long)_regs[VCPU_REGS_RAX];
- _eip += ad_bytes; /* skip dst displacement */
- break;
case 0x88 ... 0x8b: /* mov */
- case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
- dst.val = src.val;
- break;
+ goto mov;
case 0x8f: /* pop (sole member of Grp1a) */
/* 64-bit mode: POP always pops a 64-bit operand. */
if (mode == X86EMUL_MODE_PROT64)
@@ -1001,6 +990,15 @@ push:
goto done;
register_address_increment(_regs[VCPU_REGS_RSP], dst.bytes);
break;
+ case 0xa0 ... 0xa1: /* mov */
+ dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX];
+ dst.val = src.val;
+ _eip += ad_bytes; /* skip src displacement */
+ break;
+ case 0xa2 ... 0xa3: /* mov */
+ dst.val = (unsigned long)_regs[VCPU_REGS_RAX];
+ _eip += ad_bytes; /* skip dst displacement */
+ break;
case 0xc0 ... 0xc1:
grp2: /* Grp2 */
switch (modrm_reg) {
@@ -1028,6 +1026,10 @@ push:
break;
}
break;
+ case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
+ mov:
+ dst.val = src.val;
+ break;
case 0xd0 ... 0xd1: /* Grp2 */
src.val = 1;
goto grp2;
@@ -1186,6 +1188,17 @@ special_insn:
dst.ptr = (void *) register_address(
ctxt->ss_base, _regs[VCPU_REGS_RSP]);
break;
+ case 0x58 ... 0x5f: /* pop reg */
+ dst.ptr = (unsigned long *)&_regs[b & 0x7];
+pop_instruction:
+ if ((rc = ops->read_std(register_address(ctxt->ss_base,
+ _regs[VCPU_REGS_RSP]), dst.ptr, op_bytes, ctxt->vcpu))
+ != 0)
+ goto done;
+
+ register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
+ no_wb = 1; /* Disable writeback. */
+ break;
case 0x6c: /* insb */
case 0x6d: /* insw/insd */
if (kvm_emulate_pio_string(ctxt->vcpu, NULL,
@@ -1217,12 +1230,15 @@ special_insn:
) == 0)
return -1;
return 0;
-
case 0x9c: /* pushf */
src.val = (unsigned long) _eflags;
goto push;
- break;
-
+ case 0xc3: /* ret */
+ dst.ptr = &_eip;
+ goto pop_instruction;
+ case 0xf4: /* hlt */
+ ctxt->vcpu->halt_request = 1;
+ goto done;
}
if (rep_prefix) {
if (_regs[VCPU_REGS_RCX] == 0) {
@@ -1271,24 +1287,7 @@ special_insn:
case 0xae ... 0xaf: /* scas */
DPRINTF("Urk! I don't handle SCAS.\n");
goto cannot_emulate;
- case 0xf4: /* hlt */
- ctxt->vcpu->halt_request = 1;
- goto done;
- case 0xc3: /* ret */
- dst.ptr = &_eip;
- goto pop_instruction;
- case 0x58 ... 0x5f: /* pop reg */
- dst.ptr = (unsigned long *)&_regs[b & 0x7];
-
-pop_instruction:
- if ((rc = ops->read_std(register_address(ctxt->ss_base,
- _regs[VCPU_REGS_RSP]), dst.ptr, op_bytes, ctxt->vcpu))
- != 0)
- goto done;
- register_address_increment(_regs[VCPU_REGS_RSP], op_bytes);
- no_wb = 1; /* Disable writeback. */
- break;
}
goto writeback;
@@ -1382,6 +1381,16 @@ twobyte_insn:
/* Odd cmov opcodes (lsb == 1) have inverted sense. */
no_wb ^= b & 1;
break;
+ case 0xa3:
+ bt: /* bt */
+ src.val &= (dst.bytes << 3) - 1; /* only subword offset */
+ emulate_2op_SrcV_nobyte("bt", src, dst, _eflags);
+ break;
+ case 0xab:
+ bts: /* bts */
+ src.val &= (dst.bytes << 3) - 1; /* only subword offset */
+ emulate_2op_SrcV_nobyte("bts", src, dst, _eflags);
+ break;
case 0xb0 ... 0xb1: /* cmpxchg */
/*
* Save real source value, then compare EAX against
@@ -1399,30 +1408,15 @@ twobyte_insn:
dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX];
}
break;
- case 0xa3:
- bt: /* bt */
- src.val &= (dst.bytes << 3) - 1; /* only subword offset */
- emulate_2op_SrcV_nobyte("bt", src, dst, _eflags);
- break;
case 0xb3:
btr: /* btr */
src.val &= (dst.bytes << 3) - 1; /* only subword offset */
emulate_2op_SrcV_nobyte("btr", src, dst, _eflags);
break;
- case 0xab:
- bts: /* bts */
- src.val &= (dst.bytes << 3) - 1; /* only subword offset */
- emulate_2op_SrcV_nobyte("bts", src, dst, _eflags);
- break;
case 0xb6 ... 0xb7: /* movzx */
dst.bytes = op_bytes;
dst.val = (d & ByteOp) ? (u8) src.val : (u16) src.val;
break;
- case 0xbb:
- btc: /* btc */
- src.val &= (dst.bytes << 3) - 1; /* only subword offset */
- emulate_2op_SrcV_nobyte("btc", src, dst, _eflags);
- break;
case 0xba: /* Grp8 */
switch (modrm_reg & 3) {
case 0:
@@ -1435,6 +1429,11 @@ twobyte_insn:
goto btc;
}
break;
+ case 0xbb:
+ btc: /* btc */
+ src.val &= (dst.bytes << 3) - 1; /* only subword offset */
+ emulate_2op_SrcV_nobyte("btc", src, dst, _eflags);
+ break;
case 0xbe ... 0xbf: /* movsx */
dst.bytes = op_bytes;
dst.val = (d & ByteOp) ? (s8) src.val : (s16) src.val;
@@ -1446,14 +1445,14 @@ twobyte_special_insn:
/* Disable writeback. */
no_wb = 1;
switch (b) {
+ case 0x06:
+ emulate_clts(ctxt->vcpu);
+ break;
case 0x09: /* wbinvd */
break;
case 0x0d: /* GrpP (prefetch) */
case 0x18: /* Grp16 (prefetch/nop) */
break;
- case 0x06:
- emulate_clts(ctxt->vcpu);
- break;
case 0x20: /* mov cr, reg */
if (modrm_mod != 3)
goto cannot_emulate;
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - jump conditional relative
[not found] ` <1189707324.28738.0.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 18:28 ` Nitin A Kamble
@ 2007-09-13 18:55 ` Nitin A Kamble
[not found] ` <1189709705.28738.9.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 18:55 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - jump conditional relative
[not found] ` <1189709705.28738.9.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-13 20:48 ` Anthony Liguori
[not found] ` <46E9A215.9020304-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
2007-09-13 23:18 ` [PATCH] (big) real mode emulation - jump conditional short relative Nitin A Kamble
2007-09-15 7:29 ` [PATCH] (big) real mode emulation - jump conditional relative Avi Kivity
2 siblings, 1 reply; 36+ messages in thread
From: Anthony Liguori @ 2007-09-13 20:48 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w
Cc: kvm-devel, Laurent Vivier, Avi Kivity
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instruction:
> jump conditional relative (like: jnz jo etc)
> opcode : 0x0f80 - 0x0f8f
> Please apply.
>
Hi Nitin,
Out of curiousity, how far do you think we are from being able to run a
big real mode guest?
Regards,
Anthony Liguori
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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/
> ------------------------------------------------------------------------
>
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - jump conditional relative
[not found] ` <46E9A215.9020304-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org>
@ 2007-09-13 20:53 ` Kamble, Nitin A
0 siblings, 0 replies; 36+ messages in thread
From: Kamble, Nitin A @ 2007-09-13 20:53 UTC (permalink / raw)
To: Anthony Liguori; +Cc: kvm-devel, Laurent Vivier, Avi Kivity
Hi Anthony,
I think not very far. Currently I am able to complete int 10 call, and
it is going back to protected mode after the big real mode with SuSE
10.1. Currently it is getting to a bad place in protected mode after
emulation. I am debugging it.
Thanks & Regards,
Nitin
Linux Open Source Technology Center, Intel Corporation
------------------------------------------------------------------------
--------
The Mind is like a parachute; it works much better when it's open.
-----Original Message-----
From: Anthony Liguori [mailto:anthony-rdkfGonbjUSkNkDKm+mE6A@public.gmane.org]
Sent: Thursday, September 13, 2007 1:48 PM
To: Kamble, Nitin A
Cc: Avi Kivity; kvm-devel; Laurent Vivier
Subject: Re: [kvm-devel] [PATCH] (big) real mode emulation - jump
conditional relative
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instruction:
> jump conditional relative (like: jnz jo etc)
> opcode : 0x0f80 - 0x0f8f
> Please apply.
>
Hi Nitin,
Out of curiousity, how far do you think we are from being able to run a
big real mode guest?
Regards,
Anthony Liguori
>
------------------------------------------------------------------------
>
>
------------------------------------------------------------------------
-
> 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/
>
------------------------------------------------------------------------
>
> _______________________________________________
> kvm-devel mailing list
> kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - jump conditional short relative
[not found] ` <1189709705.28738.9.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 20:48 ` Anthony Liguori
@ 2007-09-13 23:18 ` Nitin A Kamble
[not found] ` <1189725509.28738.12.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:29 ` [PATCH] (big) real mode emulation - jump conditional relative Avi Kivity
2 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 23:18 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 381 bytes --]
Hi Avi,
This patch is extension to the previous "jump conditional" patch. it
implements more jump conditional instruction, opcodes 0x70-0x7f.
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: jcc_short.patch --]
[-- Type: text/x-patch, Size: 1532 bytes --]
commit c8ea6835e9e4af29339b6abd7800fdd570a23d3a
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 19:21:43 2007 -0700
Implement emulation of more jump conditional instructions
jcc shortrel
opcodes: 0x70 - 0x7f
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 60feccc..eaf89fa 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -111,8 +111,12 @@ static u8 opcode_table[256] = {
0, 0, ImplicitOps|Mov, 0,
SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* insb, insw/insd */
SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* outsb, outsw/outsd */
- /* 0x70 - 0x7F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0x70 - 0x77 */
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ /* 0x78 - 0x7F */
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
/* 0x80 - 0x87 */
ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImm | ModRM,
ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImmByte | ModRM,
@@ -1269,6 +1273,12 @@ pop_instruction:
) == 0)
return -1;
return 0;
+ case 0x70 ... 0x7f: /* jcc (short) */ {
+ int rel = insn_fetch(s8, 1, _eip);
+ if (test_cc(b, _eflags))
+ JMP_REL(rel);
+ break;
+ }
case 0x9c: /* pushf */
src.val = (unsigned long) _eflags;
goto push;
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - or instruction correction
[not found] ` <1189725509.28738.12.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-13 23:26 ` Nitin A Kamble
[not found] ` <1189725983.28738.15.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 23:26 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 326 bytes --]
Hi Avi,
This patch corrects the emulation of the instruction "or" for opcodes
0xc & 0cd.
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: or_correction.patch --]
[-- Type: text/x-patch, Size: 1240 bytes --]
commit e7b48d62cfaf4261ec228ee58bcb3d30b434ab8c
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 19:30:26 2007 -0700
Correct the emulation of or instruction, opcodes 0xc & 0xd.
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 eaf89fa..2ffe7f8 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -913,10 +913,27 @@ done_prefixes:
add: /* add */
emulate_2op_SrcV("add", src, dst, _eflags);
break;
- case 0x08 ... 0x0d:
+ case 0x08 ... 0x0b:
or: /* or */
emulate_2op_SrcV("or", src, dst, _eflags);
break;
+ case 0x0c: /* or al imm8 */
+ dst.type = OP_REG;
+ dst.ptr = &_regs[VCPU_REGS_RAX];
+ dst.val = *(u8 *)dst.ptr;
+ dst.bytes = 1;
+ dst.orig_val = dst.val;
+ goto or;
+ case 0x0d: /* or ax imm16, or eax imm32 */
+ dst.type = OP_REG;
+ dst.bytes = op_bytes;
+ dst.ptr = &_regs[VCPU_REGS_RAX];
+ if (op_bytes == 2)
+ dst.val = *(u16 *)dst.ptr;
+ else
+ dst.val = *(u32 *)dst.ptr;
+ dst.orig_val = dst.val;
+ goto or;
case 0x10 ... 0x15:
adc: /* adc */
emulate_2op_SrcV("adc", src, dst, _eflags);
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - sub imm
[not found] ` <1189725983.28738.15.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-13 23:36 ` Nitin A Kamble
[not found] ` <1189726560.28738.18.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:33 ` [PATCH] (big) real mode emulation - or instruction correction Avi Kivity
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 23:36 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 370 bytes --]
Hi Avi,
Attached patch implement emulation of instructions:
sub al imm8 (opcode 0x2c)
sub ax imm16, sub eax imm32 (opcode 0x2d)
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: sub_imm.patch --]
[-- Type: text/x-patch, Size: 1614 bytes --]
commit 6c2690c56af49dd810b504d7c5b8983e4bf25604
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 19:39:56 2007 -0700
Implement emulation of instructions:
sub al imm8 (opcode 0x2c)
sub ax imm16, sub eax imm32 (opcode 0x2d)
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 2ffe7f8..5ca4626 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -87,7 +87,7 @@ static u8 opcode_table[256] = {
/* 0x28 - 0x2F */
ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
- 0, 0, 0, 0,
+ SrcImmByte, SrcImm, 0, 0,
/* 0x30 - 0x37 */
ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
@@ -963,10 +963,24 @@ done_prefixes:
dst.val = *(u32 *)dst.ptr;
dst.orig_val = dst.val;
goto and;
- case 0x28 ... 0x2d:
+ case 0x28 ... 0x2b:
sub: /* sub */
emulate_2op_SrcV("sub", src, dst, _eflags);
break;
+ case 0x2c: /* sub al imm8 */
+ dst.type = OP_REG;
+ dst.ptr = &_regs[VCPU_REGS_RAX];
+ dst.val = *(u8 *)dst.ptr;
+ dst.bytes = 1;
+ dst.orig_val = dst.val;
+ goto sub;
+ case 0x2d: /* sub ax imm16, sub eax imm32 */
+ dst.type = OP_REG;
+ dst.bytes = 2;
+ dst.ptr = &_regs[VCPU_REGS_RAX];
+ dst.val = *(u16 *)dst.ptr;
+ dst.orig_val = dst.val;
+ goto sub;
case 0x30 ... 0x35:
xor: /* xor */
emulate_2op_SrcV("xor", src, dst, _eflags);
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - cmp correction
[not found] ` <1189726560.28738.18.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-13 23:47 ` Nitin A Kamble
[not found] ` <1189727241.28738.21.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 23:47 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 340 bytes --]
Hi Avi,
Attached is the patch to correct the implementation of instruction:
cmp
opcodes: 0x3c, 0x3d
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: cmp_correction.patch --]
[-- Type: text/x-patch, Size: 1258 bytes --]
commit 637711de0b9b2431c32cfdd880fed6baabec3982
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 19:52:21 2007 -0700
Correct emulation of instruction
cmp
opcodes: 0x3c & 0x3d
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 5ca4626..2e4c631 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -985,10 +985,31 @@ done_prefixes:
xor: /* xor */
emulate_2op_SrcV("xor", src, dst, _eflags);
break;
- case 0x38 ... 0x3d:
+ case 0x38 ... 0x3b:
cmp: /* cmp */
emulate_2op_SrcV("cmp", src, dst, _eflags);
break;
+ case 0x3c:
+ dst.type = OP_REG;
+ dst.ptr = &_regs[VCPU_REGS_RAX];
+ dst.val = *(u8 *)dst.ptr;
+ dst.bytes = 1;
+ dst.orig_val = dst.val;
+ goto cmp;
+ case 0x3d:
+ dst.ptr = (unsigned long *) &_regs[VCPU_REGS_RAX];
+ switch ((dst.bytes = op_bytes)) {
+ case 2:
+ dst.val = *(u16 *) dst.ptr;
+ break;
+ case 4:
+ dst.val = *(u32 *) dst.ptr;
+ break;
+ case 8:
+ dst.val = *(u64 *) dst.ptr;
+ break;
+ }
+ goto cmp;
case 0x63: /* movsxd */
if (mode != X86EMUL_MODE_PROT64)
goto cannot_emulate;
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - mov correction
[not found] ` <1189727241.28738.21.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-13 23:54 ` Nitin A Kamble
[not found] ` <1189727640.28738.24.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-13 23:54 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 344 bytes --]
Hi Avi,
The attached patch corrects the emulation of instruction:
mov
opcodes: 0x88 - 0x8b
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: mov_correction.patch --]
[-- Type: text/x-patch, Size: 778 bytes --]
commit e976ee1c4f89211f971c704c28617dd6a3b84dc9
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 19:59:00 2007 -0700
Correct behavior of instruction:
mov
opcodes: 0x88 - 0x8b
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 2e4c631..e3fb9ba 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1074,6 +1074,11 @@ push:
lock_prefix = 1;
break;
case 0x88 ... 0x8b: /* mov */
+ if ((modrm_mod == 0x3) && (d & SrcMem)) {
+ d &= ~SrcMem;
+ d |= SrcReg;
+ goto modrm_done;
+ }
goto mov;
case 0x8f: /* pop (sole member of Grp1a) */
/* 64-bit mode: POP always pops a 64-bit operand. */
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - lea
[not found] ` <1189727640.28738.24.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 0:02 ` Nitin A Kamble
[not found] ` <1189728138.28738.27.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 0:02 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 315 bytes --]
Hi Avi,
Attached is the patch to implement instruction:
lea
opcode: 0x8d
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: lea.patch --]
[-- Type: text/x-patch, Size: 1184 bytes --]
commit 7e19bcbeb8feebf9ee80c0948ca64c03729d7dda
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 20:07:11 2007 -0700
Implement emulation of instruction:
lea r16/r32, m
opcode: 0x8d:
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 e3fb9ba..2d2801f 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -125,7 +125,7 @@ static u8 opcode_table[256] = {
/* 0x88 - 0x8F */
ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov,
ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov,
- 0, 0, 0, DstMem | SrcNone | ModRM | Mov,
+ 0, ModRM | DstReg, 0, DstMem | SrcNone | ModRM | Mov,
/* 0x90 - 0x9F */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps, 0, 0, 0,
/* 0xA0 - 0xA7 */
@@ -1080,6 +1080,9 @@ push:
goto modrm_done;
}
goto mov;
+ case 0x8d: /* lea r16/r32, m */
+ dst.val = modrm_val;
+ break;
case 0x8f: /* pop (sole member of Grp1a) */
/* 64-bit mode: POP always pops a 64-bit operand. */
if (mode == X86EMUL_MODE_PROT64)
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - mov imm
[not found] ` <1189728138.28738.27.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 0:15 ` Nitin A Kamble
[not found] ` <1189728902.28738.31.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:36 ` [PATCH] (big) real mode emulation - lea Avi Kivity
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 0:15 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 339 bytes --]
Hi Avi,
Attached is the patch to implement instruction:
mov rl/rh/r, imm
opcodes: 0xb0 - 0xbf
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: mov_imm.patch --]
[-- Type: text/x-patch, Size: 1903 bytes --]
commit 910f3167e57c224206a2ef5fe2cb248494724087
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 20:18:51 2007 -0700
Implement emulation of instruction
mov rl/rh/r imm
opcodes: 0xb0 - 0xbf
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 2d2801f..c2540c3 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -137,8 +137,12 @@ static u8 opcode_table[256] = {
0, 0, ByteOp | ImplicitOps | Mov, ImplicitOps | Mov,
ByteOp | ImplicitOps | Mov, ImplicitOps | Mov,
ByteOp | ImplicitOps, ImplicitOps,
- /* 0xB0 - 0xBF */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ /* 0xB0 - 0xB7 */
+ Mov | SrcImmByte, Mov | SrcImmByte, Mov | SrcImmByte, Mov | SrcImmByte,
+ Mov | SrcImmByte, Mov | SrcImmByte, Mov | SrcImmByte, Mov | SrcImmByte,
+ /* 0xB8 - 0xBF */
+ Mov | SrcImm, Mov | SrcImm, Mov | SrcImm, Mov | SrcImm,
+ Mov | SrcImm, Mov | SrcImm, Mov | SrcImm, Mov | SrcImm,
/* 0xC0 - 0xC7 */
ByteOp | DstMem | SrcImm | ModRM, DstMem | SrcImmByte | ModRM,
0, ImplicitOps, 0, 0,
@@ -1102,6 +1106,23 @@ push:
dst.val = (unsigned long)_regs[VCPU_REGS_RAX];
_eip += ad_bytes; /* skip dst displacement */
break;
+ case 0xb0 ... 0xb3: /* mov rl, imm8 */
+ dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX + (b & 0x3)];
+ dst.val = src.val;
+ dst.type = OP_REG;
+ dst.bytes = 1;
+ break;
+ case 0xb4 ... 0xb7: /* mov rh, imm8 */
+ dst.ptr = ((void *)&_regs[VCPU_REGS_RAX + (b & 0x3)] + 1);
+ dst.val = src.val;
+ dst.type = OP_REG;
+ dst.bytes = 1;
+ break;
+ case 0xb8 ... 0xbf: /* mov r, imm */
+ dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX + (b & 0x7)];
+ dst.val = src.val;
+ dst.type = OP_REG;
+ break;
case 0xc0 ... 0xc1:
grp2: /* Grp2 */
switch (modrm_reg) {
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - initialization fixes
[not found] ` <1189728902.28738.31.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 0:22 ` Nitin A Kamble
[not found] ` <1189729357.28738.33.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:48 ` [PATCH] (big) real mode emulation - mov imm Avi Kivity
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 0:22 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 380 bytes --]
Hi Avi,
Attached is the patch to initialize src.val & dst.val. Without this,
certain instructions are getting affected in their emulation.
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: initialization_fixes.patch --]
[-- Type: text/x-patch, Size: 948 bytes --]
commit 113fa85a2bc3f6f4b53c4f748f5b4b3144572595
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 20:26:57 2007 -0700
Intialize src.val & dst.val, to fix bugs in certain instruction emulations.
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 c2540c3..90ee392 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -832,6 +832,7 @@ done_prefixes:
srcmem_common:
src.type = OP_MEM;
src.ptr = (unsigned long *)cr2;
+ src.val = 0;
if ((rc = ops->read_emulated((unsigned long)src.ptr,
&src.val, src.bytes, ctxt->vcpu)) != 0)
goto done;
@@ -896,6 +897,7 @@ done_prefixes:
dst.type = OP_MEM;
dst.ptr = (unsigned long *)cr2;
dst.bytes = (d & ByteOp) ? 1 : op_bytes;
+ dst.val = 0;
if (d & BitOp) {
unsigned long mask = ~(dst.bytes * 8 - 1);
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - popf
[not found] ` <1189729357.28738.33.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 0:40 ` Nitin A Kamble
[not found] ` <1189730445.28738.36.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 17:08 ` [PATCH] (big) real mode emulation - initialization fixes Avi Kivity
2007-09-15 7:43 ` Avi Kivity
2 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 0:40 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 331 bytes --]
Hi Avi,
Attached is the patch to implement emulation of instruction:
popf
opcode: 0x9d
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: popf.patch --]
[-- Type: text/x-patch, Size: 1208 bytes --]
commit 7bbe21004014731ac7f645de879a91b9160e6a1d
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Thu Sep 13 20:45:34 2007 -0700
Implement emulation of instruction:
popf
opcode: 0x9d
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 90ee392..58e8394 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -127,7 +127,7 @@ static u8 opcode_table[256] = {
ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov,
0, ModRM | DstReg, 0, DstMem | SrcNone | ModRM | Mov,
/* 0x90 - 0x9F */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ImplicitOps, ImplicitOps, 0, 0,
/* 0xA0 - 0xA7 */
ByteOp | DstReg | SrcMem | Mov, DstReg | SrcMem | Mov,
ByteOp | DstMem | SrcReg | Mov, DstMem | SrcReg | Mov,
@@ -1365,6 +1365,9 @@ pop_instruction:
case 0x9c: /* pushf */
src.val = (unsigned long) _eflags;
goto push;
+ case 0x9d: /* popf */
+ dst.ptr = (unsigned long *) &_eflags;
+ goto pop_instruction;
case 0xc3: /* ret */
dst.ptr = &_eip;
goto pop_instruction;
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - initialization fixes
[not found] ` <1189729357.28738.33.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 0:40 ` [PATCH] (big) real mode emulation - popf Nitin A Kamble
@ 2007-09-14 17:08 ` Avi Kivity
[not found] ` <46EAC01F.7040609-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-09-15 7:43 ` Avi Kivity
2 siblings, 1 reply; 36+ messages in thread
From: Avi Kivity @ 2007-09-14 17:08 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to initialize src.val & dst.val. Without this,
> certain instructions are getting affected in their emulation.
>
> Please apply.
>
>
This seems like it is papering over other bugs. Some instructions use
src.val or dst.val without having decoded the src or dst operand.
Which instructions are these? Can we fix them instead?
> Intialize src.val & dst.val, to fix bugs in certain instruction emulations.
>
> Signed-off-by: Nitin A Kamble <nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
>
> diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
> index c2540c3..90ee392 100644
> --- a/drivers/kvm/x86_emulate.c
> +++ b/drivers/kvm/x86_emulate.c
> @@ -832,6 +832,7 @@ done_prefixes:
> srcmem_common:
> src.type = OP_MEM;
> src.ptr = (unsigned long *)cr2;
> + src.val = 0;
> if ((rc = ops->read_emulated((unsigned long)src.ptr,
> &src.val, src.bytes, ctxt->vcpu)) != 0)
> goto done;
> @@ -896,6 +897,7 @@ done_prefixes:
> dst.type = OP_MEM;
> dst.ptr = (unsigned long *)cr2;
> dst.bytes = (d & ByteOp) ? 1 : op_bytes;
> + dst.val = 0;
> if (d & BitOp) {
> unsigned long mask = ~(dst.bytes * 8 - 1);
>
>
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - initialization fixes
[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>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 17:33 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1: Type: text/plain, Size: 683 bytes --]
On Fri, 2007-09-14 at 10:08 -0700, Avi Kivity wrote:
> This seems like it is papering over other bugs. Some instructions use
> src.val or dst.val without having decoded the src or dst operand.
>
> Which instructions are these? Can we fix them instead?
Instructions using 8bit operands such as al, ah are affected.
Especially utilizing signed operands. By not using this initialization
these operands are getting wrong value from remaining stale bits.
--
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.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
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - initialization fixes
[not found] ` <1189791233.28738.42.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 17:42 ` Avi Kivity
0 siblings, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-14 17:42 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> On Fri, 2007-09-14 at 10:08 -0700, Avi Kivity wrote:
>
>> This seems like it is papering over other bugs. Some instructions use
>> src.val or dst.val without having decoded the src or dst operand.
>>
>> Which instructions are these? Can we fix them instead?
>>
>
> Instructions using 8bit operands such as al, ah are affected.
> Especially utilizing signed operands. By not using this initialization
> these operands are getting wrong value from remaining stale bits.
>
>
I see. SrcMem decode does ->read_emulated() into src.val, leaving stale
bits. I agree your patch is the best way to fix it.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - jmp abs
[not found] ` <1189730445.28738.36.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 18:20 ` Nitin A Kamble
[not found] ` <1189794045.28738.47.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:45 ` [PATCH] (big) real mode emulation - popf Avi Kivity
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 18:20 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 326 bytes --]
Hi Avi,
Attached is the patch to implement instruction:
jump absolute
opcode: 0xff /4
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_abs.patch --]
[-- Type: text/x-patch, Size: 808 bytes --]
commit d67d775e429b32da323715f52f4ef4ce03a9031c
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Fri Sep 14 14:25:23 2007 -0700
Implement emulation of instruction:
jump absolute r/m
opcode: 0xff /4
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 58e8394..ab7db47 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -1229,6 +1229,12 @@ push:
case 1: /* dec */
emulate_1op("dec", dst, _eflags);
break;
+ case 4: /* jmp abs */
+ if (b == 0xff)
+ _eip = dst.val;
+ else
+ goto cannot_emulate;
+ break;
case 6: /* push */
/* 64-bit mode: PUSH always pushes a 64-bit operand. */
if (mode == X86EMUL_MODE_PROT64) {
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - inc reg
[not found] ` <1189794045.28738.47.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 18:43 ` Nitin A Kamble
[not found] ` <1189795407.28738.50.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:41 ` [PATCH] (big) real mode emulation - jmp abs Avi Kivity
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 18:43 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 325 bytes --]
Hi Avi,
Attached is the patch to implement instructions:
inc reg
opcode: 0x40 - 0x47
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: inc_reg.patch --]
[-- Type: text/x-patch, Size: 1620 bytes --]
commit c47e7ccd17a9fe79e0f5e8b3198d6cd84e7c85ed
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Fri Sep 14 14:47:42 2007 -0700
Implement emulation of instruction:
inc reg
opcode: 0x40 - 0x47
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 ab7db47..f5a4f4a 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -96,8 +96,11 @@ 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 */
+ 0, 0, 0, 0, 0, 0, 0, 0,
/* 0x50 - 0x57 */
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1390,6 +1393,22 @@ pop_instruction:
_eip = ctxt->vcpu->rip;
}
switch (b) {
+ case 0x40 ... 0x47: /* inc reg */
+ dst.ptr = (unsigned long *)&_regs[b & 0x7];
+ dst.val = *dst.ptr;
+ switch (op_bytes) {
+ case 2:
+ *(u16 *)dst.ptr = (u16)dst.val + 1;
+ break;
+ case 4:
+ *dst.ptr = (u32)dst.val + 1;
+ break; /* 64b: zero-ext */
+ case 8:
+ *dst.ptr = dst.val + 1;
+ break;
+ }
+ no_wb = 1; /* Disable writeback. */
+ break;
case 0xa4 ... 0xa5: /* movs */
dst.type = OP_MEM;
dst.bytes = (d & ByteOp) ? 1 : op_bytes;
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - dec reg
[not found] ` <1189795407.28738.50.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-14 18:50 ` Nitin A Kamble
[not found] ` <1189795841.28738.53.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-15 7:39 ` [PATCH] (big) real mode emulation - inc reg Avi Kivity
1 sibling, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-14 18:50 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel, Laurent Vivier
[-- Attachment #1.1.1: Type: text/plain, Size: 338 bytes --]
Hi Avi,
Attached is the patch to implement emulation of instruction:
dec reg
opcodes: 0x48 - 0x4f
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: dec_reg.patch --]
[-- Type: text/x-patch, Size: 1501 bytes --]
commit ea06cdff59c8f9d74be2f6d7b7c4137a7c150a50
Author: Nitin A Kamble <nitin.a.kamble@intel.com>
Date: Fri Sep 14 14:55:33 2007 -0700
Implement emulation of instruction:
dec reg
opcode: 0x48 - 0x4f
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 f5a4f4a..64909ff 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -100,7 +100,8 @@ static u8 opcode_table[256] = {
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
/* 0x48 - 0x4F */
- 0, 0, 0, 0, 0, 0, 0, 0,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
+ ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
/* 0x50 - 0x57 */
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps,
@@ -1409,6 +1410,22 @@ pop_instruction:
}
no_wb = 1; /* Disable writeback. */
break;
+ case 0x48 ... 0x4f: /* dec r16/r32 */
+ dst.ptr = (unsigned long *)&_regs[b & 0x7];
+ dst.val = *dst.ptr;
+ switch (op_bytes) {
+ case 2:
+ *(u16 *)dst.ptr = (u16)dst.val - 1;
+ break;
+ case 4:
+ *dst.ptr = (u32)dst.val - 1;
+ break; /* 64b: zero-ext */
+ case 8:
+ *dst.ptr = dst.val - 1;
+ break;
+ }
+ no_wb = 1; /* Disable writeback. */
+ break;
case 0xa4 ... 0xa5: /* movs */
dst.type = OP_MEM;
dst.bytes = (d & ByteOp) ? 1 : op_bytes;
[-- 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
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - push imm8
[not found] ` <1189708119.28738.5.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-15 7:13 ` Avi Kivity
0 siblings, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:13 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w
Cc: kvm-devel, Laurent Vivier, Bernhard Kaindl
Nitin A Kamble wrote:
> The patch was empty in the last email. My mistake. Reattaching it.
>
> Thanks to Bernhard for pointing it out.
>
Thanks, applied.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - jump conditional relative
[not found] ` <1189709705.28738.9.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 20:48 ` Anthony Liguori
2007-09-13 23:18 ` [PATCH] (big) real mode emulation - jump conditional short relative Nitin A Kamble
@ 2007-09-15 7:29 ` Avi Kivity
2 siblings, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:29 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instruction:
> jump conditional relative (like: jnz jo etc)
> opcode : 0x0f80 - 0x0f8f
> Please apply.
>
>
Applied this and jump conditional short, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - or instruction correction
[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
@ 2007-09-15 7:33 ` Avi Kivity
1 sibling, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:33 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> This patch corrects the emulation of the instruction "or" for opcodes
> 0xc & 0cd.
> Please Apply.
>
> + case 0x0c: /* or al imm8 */
> + dst.type = OP_REG;
> + dst.ptr = &_regs[VCPU_REGS_RAX];
> + dst.val = *(u8 *)dst.ptr;
> + dst.bytes = 1;
> + dst.orig_val = dst.val;
> + goto or;
> + case 0x0d: /* or ax imm16, or eax imm32 */
> + dst.type = OP_REG;
> + dst.bytes = op_bytes;
> + dst.ptr = &_regs[VCPU_REGS_RAX];
> + if (op_bytes == 2)
> + dst.val = *(u16 *)dst.ptr;
> + else
> + dst.val = *(u32 *)dst.ptr;
> + dst.orig_val = dst.val;
> + goto or;
Instead of repeating this code for all instructions that use the
accumulator implicitly, we should define a bit in the decoder flags
(like DstAcc) so that all the code is consolidated in the decoder. This
applies to 'sub imm' and 'cmp correction', and probably others as well.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - lea
[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
@ 2007-09-15 7:36 ` Avi Kivity
1 sibling, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:36 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instruction:
> lea
> opcode: 0x8d
>
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - inc reg
[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
@ 2007-09-15 7:39 ` Avi Kivity
1 sibling, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:39 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instructions:
> inc reg
> opcode: 0x40 - 0x47
> Please apply.
>
> @@ -1390,6 +1393,22 @@ pop_instruction:
> _eip = ctxt->vcpu->rip;
> }
> switch (b) {
> + case 0x40 ... 0x47: /* inc reg */
> + dst.ptr = (unsigned long *)&_regs[b & 0x7];
> + dst.val = *dst.ptr;
> + switch (op_bytes) {
>
Too much indentation here?
> + case 2:
> + *(u16 *)dst.ptr = (u16)dst.val + 1;
> + break;
> + case 4:
> + *dst.ptr = (u32)dst.val + 1;
> + break; /* 64b: zero-ext */
> + case 8:
> + *dst.ptr = dst.val + 1;
> + break;
> + }
> + no_wb = 1; /* Disable writeback. */
> + break;
> case 0xa4 ... 0xa5: /* movs */
> dst.type = OP_MEM;
> dst.bytes = (d & ByteOp) ? 1 : op_bytes;
>
Why are we disabling writeback instead of using the regular writeback
mechanism? Shouldn't just setting dst.val be sufficient?
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - jmp abs
[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
@ 2007-09-15 7:41 ` Avi Kivity
1 sibling, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:41 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instruction:
> jump absolute
> opcode: 0xff /4
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - initialization fixes
[not found] ` <1189729357.28738.33.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-14 0:40 ` [PATCH] (big) real mode emulation - popf Nitin A Kamble
2007-09-14 17:08 ` [PATCH] (big) real mode emulation - initialization fixes Avi Kivity
@ 2007-09-15 7:43 ` Avi Kivity
2 siblings, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:43 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to initialize src.val & dst.val. Without this,
> certain instructions are getting affected in their emulation.
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - popf
[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
@ 2007-09-15 7:45 ` Avi Kivity
1 sibling, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:45 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement emulation of instruction:
> popf
> opcode: 0x9d
>
>
Applied, thanks.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - mov imm
[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
@ 2007-09-15 7:48 ` Avi Kivity
1 sibling, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-15 7:48 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel, Laurent Vivier
Nitin A Kamble wrote:
> Hi Avi,
> Attached is the patch to implement instruction:
> mov rl/rh/r, imm
> opcodes: 0xb0 - 0xbf
>
> case 0xb0 ... 0xb3: /* mov rl, imm8 */
> + dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX + (b & 0x3)];
> + dst.val = src.val;
> + dst.type = OP_REG;
> + dst.bytes = 1;
> + break;
> + case 0xb4 ... 0xb7: /* mov rh, imm8 */
> + dst.ptr = ((void *)&_regs[VCPU_REGS_RAX + (b & 0x3)] + 1);
> + dst.val = src.val;
> + dst.type = OP_REG;
> + dst.bytes = 1;
> + break;
> + case 0xb8 ... 0xbf: /* mov r, imm */
> + dst.ptr = (unsigned long *)&_regs[VCPU_REGS_RAX + (b & 0x7)];
> + dst.val = src.val;
> + dst.type = OP_REG;
> + break;
Can't the decoder select the dst reg?
Looks like duplicate work here.
--
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH] (big) real mode emulation - correct code placement
[not found] ` <1189795841.28738.53.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-18 22:14 ` Nitin A Kamble
[not found] ` <1190153661.4620.3.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
0 siblings, 1 reply; 36+ messages in thread
From: Nitin A Kamble @ 2007-09-18 22:14 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 445 bytes --]
Hi Avi,
Some emulation case statements have gone to wrong place in the
upstream tree. This patch fixes that. This time I have created the patch
using the git-format-patch command as per your suggestion.
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: 0001-This-code-has-gone-to-wrong-place-in-the-file.-Movin.patch --]
[-- Type: application/mbox, Size: 2089 bytes --]
[-- 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
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH] (big) real mode emulation - correct code placement
[not found] ` <1190153661.4620.3.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
@ 2007-09-19 12:12 ` Avi Kivity
0 siblings, 0 replies; 36+ messages in thread
From: Avi Kivity @ 2007-09-19 12:12 UTC (permalink / raw)
To: nitin.a.kamble-ral2JQCrhuEAvxtiuMwx3w; +Cc: kvm-devel
Nitin A Kamble wrote:
> Hi Avi,
> Some emulation case statements have gone to wrong place in the
> upstream tree. This patch fixes that.
Applied, thanks.
> This time I have created the patch
> using the git-format-patch command as per your suggestion.
>
Much easier to apply. But now my mailer doesn't quote it...
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
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/
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2007-09-19 12:12 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 ` [PATCH] (big) real mode emulation - jump conditional relative Nitin A Kamble
[not found] ` <1189709705.28738.9.camel-mpPvwfgnXtFHIUuj5cj4Omt3HXsI98Cx0E9HWUfgJXw@public.gmane.org>
2007-09-13 20:48 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox