From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: [PATCH][RFC] Emulating real mode with x86_emulate Date: Fri, 30 Mar 2007 17:11:39 -0500 Message-ID: <460D8B1B.6020308@us.ibm.com> References: <4607074E.1030807@us.ibm.com> <1175203075.27076.17.camel@lnitindesktop.sc.intel.com> <460C4AAE.5020707@us.ibm.com> <1175212362.27076.32.camel@lnitindesktop.sc.intel.com> <460C55BD.5050202@us.ibm.com> <1175216381.27076.39.camel@lnitindesktop.sc.intel.com> <1175221214.27076.43.camel@lnitindesktop.sc.intel.com> <460C8207.8000604@us.ibm.com> <1175280781.32115.13.camel@lnitindesktop.sc.intel.com> <460D5E34.2080803@us.ibm.com> <1175288913.32115.20.camel@lnitindesktop.sc.intel.com> <1175289886.32115.26.camel@lnitindesktop.sc.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1175289886.32115.26.camel@lnitindesktop.sc.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: "Kamble, Nitin A" Cc: "Yu, Wilfred" , xen-devel@lists.xensource.com, Keir Fraser , "Nakajima, Jun" List-Id: xen-devel@lists.xenproject.org Kamble, Nitin A wrote: > Anthony, > eip of 0x0 is the right address. > > Because the trampoline_Start code is relocated to address 0. > > /* Relocate real-mode trampoline to 0x0. */ > " mov $trampoline_start,%esi \n" > " xor %edi,%edi \n" > " mov $trampoline_end,%ecx \n" > " sub %esi,%ecx \n" > " rep movsb \n" > > Still there is no progress in the emulation. The guest is dying with > triple-fault just like before. > > Thanks & Regards, > Nitin > Open Source Technology Center, Intel Corporation. > ------------------------------------------------------------------------- > The mind is like a parachute; it works much better when it's open. > > > On Fri, 2007-03-30 at 14:08 -0700, Nitin A Kamble wrote: >> Hi Anthony, >> >> On Fri, 2007-03-30 at 14:00 -0500, Anthony Liguori wrote: >>> /* Enter real mode, reload all segment registers and IDT. */ >>> " ljmp $0x8,$0x0 \n" >>> "trampoline_start: .code16 \n" >>> " mov %eax,%cr0 \n" >>> >>> That change was pretty recent so unless it was reverted it should Just Work. >>> >>> Regards, >>> >>> Anthony Liguori >>> >> Now I see cr0 is updated after returning from main. >> I enabled the debug log in the xen code now. >> >> (XEN) HVM2: Creating MP tables >> ... >> (XEN) HVM2: Loading Cirrus VGABIOS >> ... >> (XEN) HVM2: Loading ACPI >> ... >> (XEN) HVM2: Loading VMXAssist ... >> deadbeef >> (XEN) HVM2: >> foo >> (XEN) >> hvmop_emulate_realmode >> >> (XEN) guest requests real mode >> emulation >> (XEN) foo >> 221 >> (XEN) HVM2: Invoking ROMBIOS >> ... >> (XEN) vmx_vmexit_handler called. eip = >> 0x0 >> (XEN) vmx_cr_access called >> eip=0x0 >> (XEN) mov_to_cr 0 called >> eip=0x0 >> (XEN) vmx_set_cr0 called >> eip=0x0 >> (XEN) Transfering -- control to x86_emulate eip >> 0x0 >> (XEN) hvm.c:446:d2 Triple fault on VCPU0 - invoking HVM system reset. >> >> It shows cr0 is getting modified. But the eip is still 0x0. set_cr0 is returning 1 though which should increment eip to the next instruction. I'm a bit perplexed about my eip now and also why your eip is still 0. It should be the instruction following the mov cr0. Regards, Anthony Liguori >> >> Thanks & Regards, >> Nitin >> Open Source Technology Center, Intel Corporation. >> ------------------------------------------------------------------------- >> The mind is like a parachute; it works much better when it's open. >> >