xen-devel
[Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate
To: |
"Kamble, Nitin A" <nitin.a.kamble@xxxxxxxxx> |
Subject: |
[Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate |
From: |
Anthony Liguori <aliguori@xxxxxxxxxx> |
Date: |
Thu, 29 Mar 2007 18:24:30 -0500 |
Cc: |
"Yu, Wilfred" <wilfred.yu@xxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxx, Keir Fraser <keir@xxxxxxxxxxxxx>, "Nakajima, Jun" <jun.nakajima@xxxxxxxxx> |
Delivery-date: |
Fri, 30 Mar 2007 00:26:22 +0100 |
Envelope-to: |
Keir.Fraser@xxxxxxxxxxxx |
In-reply-to: |
<1175203075.27076.17.camel@xxxxxxxxxxxxxxxxxxxxxxxxxx> |
List-help: |
<mailto:xen-devel-request@lists.xensource.com?subject=help> |
List-id: |
Xen developer discussion <xen-devel.lists.xensource.com> |
List-post: |
<mailto:xen-devel@lists.xensource.com> |
List-subscribe: |
<http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe> |
List-unsubscribe: |
<http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe> |
References: |
<4607074E.1030807@xxxxxxxxxx> <1175203075.27076.17.camel@xxxxxxxxxxxxxxxxxxxxxxxxxx> |
Sender: |
xen-devel-bounces@xxxxxxxxxxxxxxxxxxx |
User-agent: |
Thunderbird 1.5.0.10 (X11/20070307) |
Hi Nitin,
Thanks for trying out the patch
Kamble, Nitin A wrote:
Hi Anthony,
I tried your patch at my end with snapshot of xen-unstable on
20070326. And here are my findings.
- The --emulate-16bit option for qemu did not work. qemu is not
accepting this as an valid command line option.
Perhaps you did --emulate-16bit instead of -emulate-16bit? The patch
definitely has the added option.
- I tried hardcoding this to 1 in the qemu code, and found that the
port x595 is not reflecting it correctly to hvmloader.
Are you sure you don't have something stale?
- Then I tried forcing in the hvmloader to use the emulator instead
of vmxassit, and I see the the emulator is not getting the right
context. Following is the console log at this point.
(XEN) HVM3: HVM
Loader
(XEN) HVM3: Detected Xen
v3.0-unstable
(XEN) HVM3: Writing SMBIOS tables
...
(XEN) HVM3: Loading ROMBIOS
...
(XEN) irq.c:210: Dom3 PCI link 0 changed 0 ->
5
(XEN) HVM3: PCI-ISA link 0 routed to
IRQ5
(XEN) irq.c:210: Dom3 PCI link 1 changed 0 ->
7
(XEN) HVM3: PCI-ISA link 1 routed to
IRQ7
(XEN) irq.c:210: Dom3 PCI link 2 changed 0 ->
10
(XEN) HVM3: PCI-ISA link 2 routed to
IRQ10
(XEN) irq.c:210: Dom3 PCI link 3 changed 0 ->
11
(XEN) HVM3: PCI-ISA link 3 routed to
IRQ11
(XEN) HVM3: pci dev 01:1 bar 20 size 00000010:
0000c001
(XEN) HVM3: pci dev 01:2
INTA->IRQ7
(XEN) HVM3: pci dev 02:0 bar 10 size 02000000:
f0000008
(XEN) HVM3: pci dev 02:0 bar 14 size 00001000:
f2000000
(XEN) HVM3: pci dev 03:0 bar 10 size 00000100:
0000c101
(XEN) HVM3: pci dev 03:0 bar 14 size 01000000:
f3000008
(XEN) HVM3: pci dev 03:0
INTA->IRQ11
(XEN) HVM3: pci dev 04:0 bar 10 size 00000100:
0000c201
(XEN) HVM3: pci dev 04:0 bar 14 size 00000100:
f4000000
(XEN) HVM3: pci dev 04:0
INTA->IRQ5
(XEN) HVM3: Creating MP tables
...
(XEN) HVM3: Loading Cirrus VGABIOS
...
(XEN) HVM3: Loading ACPI
...
(XEN) HVM3: Not Loading VMXAssist ...
ffffffff
(XEN) HVM3:
foo
(XEN)
hvmop_emulate_realmode
(XEN) guest requests real mode
emulation
(XEN) foo
221
(XEN) HVM3: Invoking ROMBIOS
...
(XEN) Transfering control to x86_emulate %eip
0x0
(XEN) hvm.c:446:d3 Triple fault on VCPU0 - invoking HVM system reset.
The log shows that emulator is not getting the right cpu context.
How much of testing have you done with this code? I am not able to
proceed to emulation of 1 instruction with the patch. How many
instruction could you emulate with the patch?
I suspect you have a partial install or something. I have never seen
this happen.
You should see x86_emulate run for a good number of instructions. The
odd thing about your log is that the transfering control to x86_emulate
message uses the EIP from the vmcs. If this is the first time the
emulator is being invoked, how can eip be 0? There's nothing in the
emulate path that would touch the vmcs.
How exactly are you forcing the use of the emulator instead of vmxassist?
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.
On Sun, 2007-03-25 at 16:35 -0700, Anthony Liguori wrote:
Howdy,
Attached is a patch that begins to lay down the infrastructure for
emulating real mode with x86_emulate(). With a little more refactoring,
I think it could also replace the SVM emulator.
The patch introduces an HVMOP hypercall to set a flag in the hvm vcpu
struct to signal that real mode should be emulated with x86_emulate
instead of using vm86. This is to make development a little bit easier
since x86_emulate is not quite there yet wrt 16 bit emulation. It can
be enabled by passing -emulate-16bit to qemu-dm (I use a wrapper script
similar to qemu-dm.debug).
The VT code keeps track of the whether it's in the emulator and loops on
the do_resume path in x86_emulate. I think this code probably should be
refactored into the common HVM code although this would require changing
some of the HVM ops. This would allow SVM to use the x86_emulate to
handle individual instructions.
There are some issues to work out. Namely, x86_emulate appears to want
blocking PIO calls which isn't conducive to the wait PIO works today in
HVM. This is only a problem for instructions at the moment. I'm also a
bit confused about how to properly loop in the emulator. schedule_tail
is not meant to return so perhaps we should loop on emulating == 1
instead of hypercall_preempt_check? I didn't think the hypervisor was
preemptable though.
The current code doesn't handle non-flat segments as I don't think
hvm_copy_from/to_guest handles it (which I assume it would need to).
However, it is enough to start running instructions in x86_emulate so
it's enough to start working on enhancing that.
Regards,
Anthony Liguori
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|
<Prev in Thread] |
Current Thread |
[Next in Thread>
|
- [Xen-devel] [PATCH][RFC] Emulating real mode with x86_emulate, Anthony Liguori
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate,
Anthony Liguori <=
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Anthony Liguori
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Anthony Liguori
- Re: [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Anthony Liguori
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Anthony Liguori
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
- [Xen-devel] Re: [PATCH][RFC] Emulating real mode with x86_emulate, Kamble, Nitin A
|
|
|