static void vfio_listener_region_add(MemoryListener *listener,

                                     MemoryRegionSection *section)

{

    VFIOContainer *container = container_of(listener, VFIOContainer,

                                            iommu_data.listener);

    hwaddr iova, end;

    void *vaddr;

    int ret;



    assert(!memory_region_is_iommu(section->mr));



    if (vfio_listener_skipped_section(section)) {

        DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",

                section->offset_within_address_space,

                section->offset_within_address_space +

                int128_get64(int128_sub(section->size, int128_one())));

        return;

    }



    if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) !=

                 (section->offset_within_region & ~TARGET_PAGE_MASK))) {

        error_report("%s received unaligned region", __func__);

        return;

    }



    iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);

    end = (section->offset_within_address_space + int128_get64(section->size)) &

          TARGET_PAGE_MASK;



    if (iova >= end) {

        return;

    }



    vaddr = memory_region_get_ram_ptr(section->mr) +

            section->offset_within_region +

            (iova - section->offset_within_address_space);



    DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",

            iova, end - 1, vaddr);



    memory_region_ref(section->mr);

    ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly);

    if (ret) {

        error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "

                     "0x%"HWADDR_PRIx", %p) = %d (%m)",

                     container, iova, end - iova, vaddr, ret);

    }

}

static void vfio_listener_region_add(MemoryListener *listener,

                                     MemoryRegionSection *section)

{

    VFIOContainer *container = container_of(listener, VFIOContainer,

                                            iommu_data.listener);

    hwaddr iova, end;

    void *vaddr;

    int ret;



    assert(!memory_region_is_iommu(section->mr));



    if (vfio_listener_skipped_section(section)) {

        DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",

                section->offset_within_address_space,

                section->offset_within_address_space +

                int128_get64(int128_sub(section->size, int128_one())));

        return;

    }



    if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) !=

                 (section->offset_within_region & ~TARGET_PAGE_MASK))) {

        error_report("%s received unaligned region", __func__);

        return;

    }



    iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);

    end = (section->offset_within_address_space + int128_get64(section->size)) &

          TARGET_PAGE_MASK;



    if (iova >= end) {

        return;

    }



    vaddr = memory_region_get_ram_ptr(section->mr) +

            section->offset_within_region +

            (iova - section->offset_within_address_space);



    DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",

            iova, end - 1, vaddr);



    memory_region_ref(section->mr);

    ret = vfio_dma_map(container, iova, end - iova, vaddr, section->readonly);

    if (ret) {

        error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "

                     "0x%"HWADDR_PRIx", %p) = %d (%m)",

                     container, iova, end - iova, vaddr, ret);

    }

}

                                            iommu_data.listener);                                             iommu_data.listener);
static void FUNC_0(MemoryListener *VAR_0,

                                     MemoryRegionSection *VAR_1)

{

    VFIOContainer *container = container_of(VAR_0, VFIOContainer,

                                            iommu_data.VAR_0);

    hwaddr iova, end;

    void *VAR_2;

    int VAR_3;



    assert(!memory_region_is_iommu(VAR_1->mr));



    if (vfio_listener_skipped_section(VAR_1)) {

        DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",

                VAR_1->offset_within_address_space,

                VAR_1->offset_within_address_space +

                int128_get64(int128_sub(VAR_1->size, int128_one())));

        return;

    }



    if (unlikely((VAR_1->offset_within_address_space & ~TARGET_PAGE_MASK) !=

                 (VAR_1->offset_within_region & ~TARGET_PAGE_MASK))) {

        error_report("%s received unaligned region", __func__);

        return;

    }



    iova = TARGET_PAGE_ALIGN(VAR_1->offset_within_address_space);

    end = (VAR_1->offset_within_address_space + int128_get64(VAR_1->size)) &

          TARGET_PAGE_MASK;



    if (iova >= end) {

        return;

    }



    VAR_2 = memory_region_get_ram_ptr(VAR_1->mr) +

            VAR_1->offset_within_region +

            (iova - VAR_1->offset_within_address_space);



    DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",

            iova, end - 1, VAR_2);



    memory_region_ref(VAR_1->mr);

    VAR_3 = vfio_dma_map(container, iova, end - iova, VAR_2, VAR_1->readonly);

    if (VAR_3) {

        error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "

                     "0x%"HWADDR_PRIx", %p) = %d (%m)",

                     container, iova, end - iova, VAR_2, VAR_3);

    }

}

static void FUNC_0(MemoryListener *VAR_0,
MemoryRegionSection *VAR_1)
{ VFIOContainer *container = container_of(VAR_0, VFIOContainer,
iommu_data.VAR_0); hwaddr iova, end; void *VAR_2; int VAR_3; assert(!memory_region_is_iommu(VAR_1->mr)); if (vfio_listener_skipped_section(VAR_1)) { DPRINTF("SKIPPING region_add %"HWADDR_PRIx" - %"PRIx64"\n",
VAR_1->offset_within_address_space,
VAR_1->offset_within_address_space +
int128_get64(int128_sub(VAR_1->size, int128_one()))); return; } if (unlikely((VAR_1->offset_within_address_space & ~TARGET_PAGE_MASK) !=
(VAR_1->offset_within_region & ~TARGET_PAGE_MASK))) { error_report("%s received unaligned region", __func__); return; } iova = TARGET_PAGE_ALIGN(VAR_1->offset_within_address_space); end = (VAR_1->offset_within_address_space + int128_get64(VAR_1->size)) &
TARGET_PAGE_MASK; if (iova >= end) { return; } VAR_2 = memory_region_get_ram_ptr(VAR_1->mr) +
VAR_1->offset_within_region +
(iova - VAR_1->offset_within_address_space); DPRINTF("region_add %"HWADDR_PRIx" - %"HWADDR_PRIx" [%p]\n",
iova, end - 1, VAR_2); memory_region_ref(VAR_1->mr); VAR_3 = vfio_dma_map(container, iova, end - iova, VAR_2, VAR_1->readonly); if (VAR_3) { error_report("vfio_dma_map(%p, 0x%"HWADDR_PRIx", "
"0x%"HWADDR_PRIx", %p) = %d (%m)",
container, iova, end - iova, VAR_2, VAR_3); } }