Message ID | 9832F13BD22FB94A829F798DA4A828050196AF5598@pdsmsx503.ccr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Dong, Eddie wrote: > Kernel pio emulation return value is mistakenly checked, fortuantely it is not hit yet for normal OS bootup :( > > > diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c > index ca91749..0edd2e7 100644 > --- a/arch/x86/kvm/x86_emulate.c > +++ b/arch/x86/kvm/x86_emulate.c > @@ -1838,7 +1838,7 @@ special_insn: > io_dir_in = 0; > do_io: if (kvm_emulate_pio(ctxt->vcpu, NULL, io_dir_in, > (c->d & ByteOp) ? 1 : c->op_bytes, > - port) != 0) { > + port) == 0) { > c->eip = saved_eip; > goto cannot_emulate; > } kvm_emulate_pio() returns 1 when emulation is complete, and 0 when emulation needs further processing in userspace. So I think in both cases cannot_emulate is the wrong answer. I think 'in' emulation gets it right.
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index ca91749..0edd2e7 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -1838,7 +1838,7 @@ special_insn: io_dir_in = 0; do_io: if (kvm_emulate_pio(ctxt->vcpu, NULL, io_dir_in, (c->d & ByteOp) ? 1 : c->op_bytes, - port) != 0) { + port) == 0) { c->eip = saved_eip; goto cannot_emulate; }
Kernel pio emulation return value is mistakenly checked, fortuantely it is not hit yet for normal OS bootup :( Signed-off-by: Eddie Dong <Eddie.dong@linux.intel.com> commit 98d3dc8b67ba0bc7f494de3ade8f2b5cfcadaeb4 Author: root <root@eddie-wb.localdomain> Date: Thu Mar 19 15:44:39 2009 +0800 fix a bug when kernel PIO is emulated.