Tom Rotenberg
2009-Aug-04 14:31 UTC
[Xen-devel] How can i redirect the writes to the console from the HVM (port 0xe9) to Qemu?
Hi, I would like to write all the logs of the HVM console (like the hvmloader prints, hvm bios prints, etc.), which are actually written to port 0xe9, to *also* be written to the qemu log file. So, basically, i should just do the following in qemu: static void ioportE9_write(void *opaque, uint32_t addr, uint32_t data) { fprintf(logfile, "%c", (char)data); } ... <somewhere in the qemu init> ... /* Log all the UART''s to the qemu log file */ register_ioport_write(0xe9, 1, 1, ioportE9_write, NULL); ... Well, it turns out that this doesn''t work. After i checked it, it seems that this doesn''t work, because Xen registers it''s own handler for the ioport 0xe9, which prevents me from getting the HVM accesses to this port. Xen performs the registeration in the following place: file: xen/arch/x86/hvm/hvm.c function: hvm_domain_initialise() The line looks like this: ... register_portio_handler(d, 0xe9, 1, hvm_print_line); ... In previous versions of Xen, Xen hooked this 0xe9 port, by direct code in the vmx part, which made it possible to register your own handler for this port, but in the current Xen, this is changed. Does anyone know how can i register my own "hook" function on this port, without modifying the code in hvm.c? Is there a chain of writes? Tom _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2009-Aug-04 15:26 UTC
Re: [Xen-devel] How can i redirect the writes to the console from the HVM (port 0xe9) to Qemu?
On 04/08/2009 15:31, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote:> Does anyone know how can i register my own "hook" function on this > port, without modifying the code in hvm.c? Is there a chain of writes?You need to modify hvm_print_line() in hvm.c to return X86EMUL_UNHANDLEABLE rather than X86EMUL_OKAY. This will cause Xen to think that the handler could not handle the port access and so fall back to sending the port access to qemu, which is what you want. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Tom Rotenberg
2009-Aug-04 15:50 UTC
Re: [Xen-devel] How can i redirect the writes to the console from the HVM (port 0xe9) to Qemu?
Great, thanks! On Tue, Aug 4, 2009 at 6:26 PM, Keir Fraser<keir.fraser@eu.citrix.com> wrote:> On 04/08/2009 15:31, "Tom Rotenberg" <tom.rotenberg@gmail.com> wrote: > >> Does anyone know how can i register my own "hook" function on this >> port, without modifying the code in hvm.c? Is there a chain of writes? > > You need to modify hvm_print_line() in hvm.c to return X86EMUL_UNHANDLEABLE > rather than X86EMUL_OKAY. This will cause Xen to think that the handler > could not handle the port access and so fall back to sending the port access > to qemu, which is what you want. > > -- Keir > > >_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel