[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86 hvm: Introduce unregister_io_handler



# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1288372441 -3600
# Node ID 7031e1e74c3d180055cdcae480bd50b9a33b11c6
# Parent  7afd8dd1d6cb97484d263311f3f0e6ab74d27ed3
x86 hvm: Introduce unregister_io_handler

Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxx>
---
 xen/arch/x86/hvm/intercept.c |   25 +++++++++++++++++++++----
 xen/include/asm-x86/hvm/io.h |    9 +++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff -r 7afd8dd1d6cb -r 7031e1e74c3d xen/arch/x86/hvm/intercept.c
--- a/xen/arch/x86/hvm/intercept.c      Fri Oct 29 18:06:17 2010 +0100
+++ b/xen/arch/x86/hvm/intercept.c      Fri Oct 29 18:14:01 2010 +0100
@@ -237,11 +237,28 @@ 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--;
 }
 
 /*
diff -r 7afd8dd1d6cb -r 7031e1e74c3d xen/include/asm-x86/hvm/io.h
--- a/xen/include/asm-x86/hvm/io.h      Fri Oct 29 18:06:17 2010 +0100
+++ b/xen/include/asm-x86/hvm/io.h      Fri Oct 29 18:14:01 2010 +0100
@@ -50,6 +50,7 @@ struct io_handler {
     union {
         portio_action_t portio;
         mmio_action_t   mmio;
+        void           *ptr;
     } action;
 };
 
@@ -68,6 +69,8 @@ void register_io_handler(
 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)
 {
@@ -87,6 +90,12 @@ static inline void register_portio_handl
     unsigned long size, portio_action_t action)
 {
     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(

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.