aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeir Fraser <keir@xen.org>2010-10-29 18:14:01 +0100
committerKeir Fraser <keir@xen.org>2010-10-29 18:14:01 +0100
commit2911af8256327c067ad8ec05ed5054e9812fc06d (patch)
tree64c3296d69fbae9e6dea4d55245dd025033c2e83
parentddeda0449fdb3b17fd9950680dda190e580fb419 (diff)
downloadxen-2911af8256327c067ad8ec05ed5054e9812fc06d.tar.gz
xen-2911af8256327c067ad8ec05ed5054e9812fc06d.tar.bz2
xen-2911af8256327c067ad8ec05ed5054e9812fc06d.zip
x86 hvm: Introduce unregister_io_handler
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Signed-off-by: Keir Fraser <keir@xen.org>
-rw-r--r--xen/arch/x86/hvm/intercept.c25
-rw-r--r--xen/include/asm-x86/hvm/io.h9
2 files changed, 30 insertions, 4 deletions
diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c
index 4af9e3d112..2d88cc86b0 100644
--- a/xen/arch/x86/hvm/intercept.c
+++ b/xen/arch/x86/hvm/intercept.c
@@ -237,13 +237,30 @@ void register_io_handler(
handler->hdl_list[num].addr = addr;
handler->hdl_list[num].size = size;
- if ( (handler->hdl_list[num].type = type) == HVM_PORTIO )
- handler->hdl_list[num].action.portio = action;
- else
- handler->hdl_list[num].action.mmio = action;
+ handler->hdl_list[num].action.ptr = action;
handler->num_slot++;
}
+void unregister_io_handler(
+ struct domain *d, unsigned long addr, unsigned long size, int type)
+{
+ struct hvm_io_handler *handler = &d->arch.hvm_domain.io_handler;
+ int i;
+
+ for ( i = 0; i < handler->num_slot; i++ )
+ if ( (handler->hdl_list[i].addr == addr) &&
+ (handler->hdl_list[i].size == size) &&
+ (handler->hdl_list[i].type == type) )
+ goto found;
+ return;
+
+ found:
+ memcpy(&handler->hdl_list[i],
+ &handler->hdl_list[handler->num_slot-1],
+ sizeof(struct io_handler));
+ handler->num_slot--;
+}
+
/*
* Local variables:
* mode: C
diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h
index c10a0bef2a..8a81bff225 100644
--- a/xen/include/asm-x86/hvm/io.h
+++ b/xen/include/asm-x86/hvm/io.h
@@ -50,6 +50,7 @@ struct io_handler {
union {
portio_action_t portio;
mmio_action_t mmio;
+ void *ptr;
} action;
};
@@ -68,6 +69,8 @@ int hvm_io_intercept(ioreq_t *p, int type);
void register_io_handler(
struct domain *d, unsigned long addr, unsigned long size,
void *action, int type);
+void unregister_io_handler(
+ struct domain *d, unsigned long addr, unsigned long size, int type);
static inline int hvm_portio_intercept(ioreq_t *p)
{
@@ -89,6 +92,12 @@ static inline void register_portio_handler(
register_io_handler(d, addr, size, action, HVM_PORTIO);
}
+static inline void unregister_portio_handler(
+ struct domain *d, unsigned long addr, unsigned long size)
+{
+ unregister_io_handler(d, addr, size, HVM_PORTIO);
+}
+
static inline void register_buffered_io_handler(
struct domain *d, unsigned long addr,
unsigned long size, mmio_action_t action)