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

Re: [Xen-devel] run time memory trap question



On Mon, 17 Feb 2014, Andrii Tseglytskyi wrote:
> Hi Julien,
> 
>       >
>       > Â Â > Can anyone clarify - is it possible to make a run time memory 
> trap in
>       > Â Â > Xen hypervisor?
>       >
>       > Â Â I guess you are talking about ARM? If so, it's not possible right 
> now.
>       >
>       >
>       > Does it mean, that it is possible on x86 ?
> 
> Yes, you can look at register_io_handler in xen/arch/x86/hvm/intercept.c
> 
> It's used a static array, but I don't think this is the solution for
> ARM. We don't know in advance the maximum number of MMIO region to handle.
> 
> 
> What I'm thinking about for ARM - is to use linked list for MMIO handlers + 
> API to register / unregister handler.
> 
> xen/arch/arm/io.c:
> 
> Â25 static const struct mmio_handler *const mmio_handlers[] =
> Â26 { ÂÂ
> Â27 Â Â &vgic_distr_mmio_handler,
> Â28 Â Â &vuart_mmio_handler,
> Â29 }; Â
> 
> This can be changed to list. New API will add / remove entries. VGIC and 
> VUART will call something like
> mmio_register_handler(&vgic_distr_mmio_handle) during corresponding initcall.
> 
> Than the only change which is required for existingÂint 
> handle_mmio(mmio_info_t *info) function Â- is to enumerate list, instead of 
> array
> Â32 int handle_mmio(mmio_info_t *info)
> Â33 {
> Â34 Â Â struct vcpu *v = current;
> Â35 Â Â int i;
> Â36Â
> Â37 Â Â for ( i = 0; i < MMIO_HANDLER_NR; i++ ) --> *list_for_each*
> Â38 Â Â Â Â if ( mmio_handlers[i]->check_handler(v, info->gpa) )
> Â39 Â Â Â Â Â Â return info->dabt.write ?
> Â40 Â Â Â Â Â Â Â Â mmio_handlers[i]->write_handler(v, info) :
> Â41 Â Â Â Â Â Â Â Â mmio_handlers[i]->read_handler(v, info);
> Â42Â
> Â43 Â Â return 0;
> Â44 }
> 
> Something like this.

Sounds good in theory
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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