[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH V3 2/6] xen, Introduce unregister_io_handler
From: Anthony PERARD <anthony.perard@xxxxxxxxxx> To remove a handler of the io handler list, by replacing it with the last one. Signed-off-by: Anthony PERARD <anthony.perard@xxxxxxxxxx> --- xen/arch/x86/hvm/intercept.c | 26 ++++++++++++++++++++++++++ xen/include/asm-x86/hvm/io.h | 8 ++++++++ 2 files changed, 34 insertions(+), 0 deletions(-) diff --git a/xen/arch/x86/hvm/intercept.c b/xen/arch/x86/hvm/intercept.c index 4af9e3d..93dffc2 100644 --- a/xen/arch/x86/hvm/intercept.c +++ b/xen/arch/x86/hvm/intercept.c @@ -244,6 +244,32 @@ void register_io_handler( 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 last = handler->num_slot - 1; + int i = 0; + + for (i = 0; i <= last; i++) { + if (handler->hdl_list[i].addr == addr + && handler->hdl_list[i].size == size + && handler->hdl_list[i].type == type) { + + handler->hdl_list[i].addr = handler->hdl_list[last].addr; + handler->hdl_list[i].size = handler->hdl_list[last].size; + handler->hdl_list[i].type = handler->hdl_list[last].type; + if (handler->hdl_list[i].type == HVM_PORTIO) { + handler->hdl_list[i].action.portio = handler->hdl_list[last].action.portio; + } else { + handler->hdl_list[i].action.mmio = handler->hdl_list[last].action.mmio; + } + handler->num_slot--; + return; + } + } +} + /* * Local variables: * mode: C diff --git a/xen/include/asm-x86/hvm/io.h b/xen/include/asm-x86/hvm/io.h index c10a0be..2ce8bc9 100644 --- a/xen/include/asm-x86/hvm/io.h +++ b/xen/include/asm-x86/hvm/io.h @@ -68,6 +68,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 +91,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) -- 1.7.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |