Revision 360e607b exec.c

b/exec.c
325 325
                                 hwaddr *plen, bool resolve_subpage)
326 326
{
327 327
    MemoryRegionSection *section;
328
    Int128 diff;
328
    Int128 diff, diff_page;
329 329

  
330 330
    section = address_space_lookup_region(d, addr, resolve_subpage);
331 331
    /* Compute offset within MemoryRegionSection */
......
334 334
    /* Compute offset within MemoryRegion */
335 335
    *xlat = addr + section->offset_within_region;
336 336

  
337
    diff_page = int128_make64(((addr & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE) - addr);
337 338
    diff = int128_sub(section->mr->size, int128_make64(addr));
339
    diff = int128_min(diff, diff_page);
338 340
    *plen = int128_get64(int128_min(diff, int128_make64(*plen)));
339 341
    return section;
340 342
}
......
349 351
    hwaddr len = *plen;
350 352

  
351 353
    for (;;) {
352
        section = address_space_translate_internal(as->dispatch, addr, &addr, plen, true);
354
        section = address_space_translate_internal(as->dispatch, addr, &addr, &len, true);
353 355
        mr = section->mr;
354 356

  
355 357
        if (!mr->iommu_ops) {

Also available in: Unified diff