diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2008-11-03 13:36:24 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2008-11-03 13:36:24 +0000 |
commit | 4cd8a74f6e9e92a813bedba469975cf4b54892e0 (patch) | |
tree | b4395fd984ba31bcdb23c9c6c92771bb24f4772a /xen/arch/x86/hvm/emulate.c | |
parent | 03dc0c1ae5dbc76d054844d6303c8b37d030adce (diff) | |
download | xen-4cd8a74f6e9e92a813bedba469975cf4b54892e0.tar.gz xen-4cd8a74f6e9e92a813bedba469975cf4b54892e0.tar.bz2 xen-4cd8a74f6e9e92a813bedba469975cf4b54892e0.zip |
xentrace: Trace mmio/io read/write value
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/arch/x86/hvm/emulate.c')
-rw-r--r-- | xen/arch/x86/hvm/emulate.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c index ae16db0dfc..1e583bc2dc 100644 --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -14,11 +14,39 @@ #include <xen/lib.h> #include <xen/sched.h> #include <xen/paging.h> +#include <xen/trace.h> #include <asm/event.h> #include <asm/hvm/emulate.h> #include <asm/hvm/hvm.h> #include <asm/hvm/support.h> +#define HVMTRACE_IO_ASSIST_WRITE 0x200 +static void hvmtrace_io_assist(int is_mmio, ioreq_t *p) +{ + unsigned int size, event; + unsigned char buffer[12]; + + if ( likely(!tb_init_done) ) + return; + + event = is_mmio ? TRC_HVM_MMIO_ASSIST : TRC_HVM_IO_ASSIST; + if ( !p->dir ) + event |= HVMTRACE_IO_ASSIST_WRITE; + + *(uint64_t *)buffer = p->addr; + size = (p->addr != (u32)p->addr) ? 8 : 4; + if ( size == 8 ) + event |= TRC_64_FLAG; + + if ( !p->data_is_ptr ) + { + *(uint32_t *)&buffer[size] = p->data; + size += 4; + } + + trace_var(event, 0/*!cycles*/, size, buffer); +} + static int hvmemul_do_io( int is_mmio, paddr_t addr, unsigned long *reps, int size, paddr_t ram_gpa, int dir, int df, void *p_data) @@ -111,6 +139,8 @@ static int hvmemul_do_io( p->data = value; p->io_count++; + hvmtrace_io_assist(is_mmio, p); + if ( is_mmio ) { rc = hvm_mmio_intercept(p); |