|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v7 15/15] x86/hvm: track large memory mapped accesses by buffer offset
>>> On 09.07.15 at 15:10, <paul.durrant@xxxxxxxxxx> wrote:
> @@ -635,13 +605,49 @@ static int hvmemul_phys_mmio_access(
> return rc;
> }
>
> +/*
> + * Multi-cycle MMIO handling is based upon the assumption that emulation
> + * of the same instruction will not access the same MMIO region more
> + * than once. Hence we can deal with re-emulation (for secondary or
> + * subsequent cycles) by looking up the result or previous I/O in a
> + * cache indexed by linear MMIO address.
> + */
> +static struct hvm_mmio_cache *hvmemul_find_mmio_cache(
> + struct hvm_vcpu_io *vio, unsigned long gla, uint8_t dir)
> +{
> + unsigned int i;
> + struct hvm_mmio_cache *cache;
> +
> + for ( i = 0; i < vio->mmio_cache_count; i ++ )
> + {
> + cache = &vio->mmio_cache[i];
> +
> + if ( gla == cache->gla &&
> + dir == cache->dir )
> + return cache;
> + }
> +
> + i = vio->mmio_cache_count++;
> + if( i == ARRAY_SIZE(vio->mmio_cache) )
> + domain_crash(current->domain);
But you mustn't continue here, or at least force i into range so you
don't corrupt other data.
And while doing that please also add the missing space on the
if() line.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |