Re: [kvm-devel] use of saved_eip

2007-09-26 Thread Laurent Vivier
Kamble, Nitin A wrote:
 Hi Vivier, Avi,

Hi Nitin,
(BTW, my first name is Laurent)

   In order to debug faulures in my tree, I was looking at the saved_eip 
 changes coming from your commit. I did not understand the use of 
 saved_eip properly. like why is it used in the emulation of the pop 
 instruction. Can you please help me understand it's usage?

in emulate_instruction(), we decode instructions and copy vcpu registers 
to ctxt (in x86_decode_insn()), then we really emulate the instruction 
(in x86_emulate_insn()).

In x86_emulate_insn(), if we have a REP prefix, we decrement ECX and set 
EIP to next instruction, then we try to emulate the instruction.
If the emulation fails (because this is a MMIO for instance) we have to 
restore the initial values of ECX and EIP because we will re-enter in 
x86_emulate_insn() once the IO has been managed by Qemu and thus ECX is 
decremented again and EIP set to next instruction again.

And you are right: _we_don't_have_to_do_that_for_the_pop_instruction_, 
it's a mistake because the REP prefix hasn't been processed at this 
level, it is managed (ECX and EIP are modified) later.

So, you can remove from pop_instruction:

1383 if (c-rep_prefix) {
1384 c-regs[VCPU_REGS_RCX] = saved_rcx;
1385 c-eip = saved_eip;
1386 }

Sorry for the inconvenience,

Laurent



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] use of saved_eip

2007-09-26 Thread Nitin A Kamble
Hi Laurent,
  Sorry for calling by alst name. You 1st  last both names are totally
new to me. Are these french names?
  I understand your explanation. I was worried about code getting
misplaced due to automatic merges.
-- 
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-26 at 14:51 -0700, Laurent Vivier wrote:
 Kamble, Nitin A wrote:
  Hi Vivier, Avi,
 
 Hi Nitin,
 (BTW, my first name is Laurent)
 
In order to debug faulures in my tree, I was looking at the
 saved_eip
  changes coming from your commit. I did not understand the use of
  saved_eip properly. like why is it used in the emulation of the pop
  instruction. Can you please help me understand it's usage?
 
 in emulate_instruction(), we decode instructions and copy vcpu
 registers
 to ctxt (in x86_decode_insn()), then we really emulate the instruction
 (in x86_emulate_insn()).
 
 In x86_emulate_insn(), if we have a REP prefix, we decrement ECX and
 set
 EIP to next instruction, then we try to emulate the instruction.
 If the emulation fails (because this is a MMIO for instance) we have
 to
 restore the initial values of ECX and EIP because we will re-enter in
 x86_emulate_insn() once the IO has been managed by Qemu and thus ECX
 is
 decremented again and EIP set to next instruction again.
 
 And you are right: _we_don't_have_to_do_that_for_the_pop_instruction_,
 it's a mistake because the REP prefix hasn't been processed at this
 level, it is managed (ECX and EIP are modified) later.
 
 So, you can remove from pop_instruction:
 
 1383 if (c-rep_prefix) {
 1384 c-regs[VCPU_REGS_RCX] =
 saved_rcx;
 1385 c-eip = saved_eip;
 1386 }
 
 Sorry for the inconvenience,
 
 Laurent
 
 



signature.asc
Description: This is a digitally signed message part
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel