All of lore.kernel.org
 help / color / mirror / Atom feed
* x86 emulator broken (vmload)
@ 2008-12-18 12:14 Alexander Graf
  2008-12-23 17:52 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Graf @ 2008-12-18 12:14 UTC (permalink / raw)
  To: kvm, guillaume.thouvenin

While creating some userspace patches for the nested SVM implementation,
I stumbled across an emulation problem in the x86 emulator that was not
there some weeks ago.

Basically I'm running into an endless loop at:

NSVM: emulating at 0xe0e4077d -> 0

which is the "VMLOAD" instruction.

The endless loop is caused by this code:

        while(true) {
                int er;

                er = emulate_instruction(&svm->vcpu, kvm_run, 0, 0, 0);
                nsvm_printk("NSVM: emulating at 0x%lx -> %d\n",
svm->vcpu.arch.regs[VCPU_REGS_RIP], er);

                /* So we can now emulate the SVM instructions that most
probably
                   occur at the end of the codepath */
                if (er != EMULATE_DONE) {
                        while (true)
                                if (nested_svm_emulate(svm, kvm_run) ==
EMULATE_FAIL)
                                        break;
                        break;
                }
        }

While I have to admit that the while(true) is potentially a bad idea and
I should limit that to like 100 instructions (patch floating around
locally), emulate_instruction always returns EMULATE_DONE, even on the
vmload instruction (which is clearly wrong).

Does anyone have ideas on this?

Alex

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: x86 emulator broken (vmload)
  2008-12-18 12:14 x86 emulator broken (vmload) Alexander Graf
@ 2008-12-23 17:52 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-12-23 17:52 UTC (permalink / raw)
  To: Alexander Graf; +Cc: kvm, guillaume.thouvenin

Alexander Graf wrote:
> emulate_instruction always returns EMULATE_DONE, even on the
> vmload instruction (which is clearly wrong).

The emulator though that any svm instruction that isn't a vmmcall must 
be an lidt.  I've fixed it up.

-- 
error compiling committee.c: too many arguments to function


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-12-23 17:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-18 12:14 x86 emulator broken (vmload) Alexander Graf
2008-12-23 17:52 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.