|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate
On Thu, 2007-03-29 at 22:20 -0500, Anthony Liguori wrote: > ... > (XEN) hvm.c:446:d2 Triple fault on VCPU0 - invoking HVM system reset. The Triple fault you're seeing here is terribly curious. Also the "deadbeef" output. Just to sanity check, I threw the following printk in vmcs.c Anthony, To me the tripple fault makes sense. Your patch enables emulation only when "emulating" is set to 1. void arch_vmx_do_resume(struct vcpu *v) { if ( v->arch.hvm_vmx.active_cpu == smp_processor_id() ) @@ -508,7 +644,11 @@ void arch_vmx_do_resume(struct vcpu *v) } hvm_do_resume(v); - reset_stack_and_jump(vmx_asm_do_vmentry); + + if (v->arch.hvm_vmx.emulating) + vmx_do_emulate(v); + else + reset_stack_and_jump(vmx_asm_do_vmentry); } And it is turned on only when guest (hvmloader) sets up CR0. -static int vmx_set_cr0(unsigned long value) +int vmx_set_cr0(unsigned long value) { struct vcpu *v = current; unsigned long mfn; @@ -1982,13 +1982,29 @@ static int vmx_set_cr0(unsigned long val } } - if ( vmx_assist(v, VMX_ASSIST_INVOKE) ) + if ( v->arch.hvm_vcpu.emulate_realmode ) + { + eip = __vmread(GUEST_RIP); + HVM_DBG_LOG(DBG_LEVEL_1, + "Transfering control to x86_emulate %%eip 0x%lx\n", eip); + v->arch.hvm_vmx.emulating = 1; + return 1; + } + else if ( vmx_assist(v, VMX_ASSIST_INVOKE) ) { And I don't see any code in the hvmloader for setting cr0 before returning from the main. So the code flow is returning from main, which is causing the tripple fault. I observe the vmx_do_emulate is never getting called. I think set cr0 instruction is needed just after the emulate_realmode hypercall in the hvmloader code. Have you added more code lateron after sending the patch out?
Attachment:
signature.asc _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |