void sparc_iommu_memory_rw(void *opaque, target_phys_addr_t addr,

                           uint8_t *buf, int len, int is_write)

{

    int l;

    uint32_t flags;

    target_phys_addr_t page, phys_addr;



    while (len > 0) {

        page = addr & TARGET_PAGE_MASK;

        l = (page + TARGET_PAGE_SIZE) - addr;

        if (l > len)

            l = len;

        flags = iommu_page_get_flags(opaque, page);

        if (!(flags & IOPTE_VALID))

            return;

        phys_addr = iommu_translate_pa(opaque, addr, flags);

        if (is_write) {

            if (!(flags & IOPTE_WRITE))

                return;

            cpu_physical_memory_write(phys_addr, buf, len);

        } else {

            cpu_physical_memory_read(phys_addr, buf, len);

        }

        len -= l;

        buf += l;

        addr += l;

    }

}

void sparc_iommu_memory_rw(void *opaque, target_phys_addr_t addr,

                           uint8_t *buf, int len, int is_write)

{

    int l;

    uint32_t flags;

    target_phys_addr_t page, phys_addr;



    while (len > 0) {

        page = addr & TARGET_PAGE_MASK;

        l = (page + TARGET_PAGE_SIZE) - addr;

        if (l > len)

            l = len;

        flags = iommu_page_get_flags(opaque, page);

        if (!(flags & IOPTE_VALID))

            return;

        phys_addr = iommu_translate_pa(opaque, addr, flags);

        if (is_write) {

            if (!(flags & IOPTE_WRITE))

                return;

            cpu_physical_memory_write(phys_addr, buf, len);

        } else {

            cpu_physical_memory_read(phys_addr, buf, len);

        }

        len -= l;

        buf += l;

        addr += l;

    }

}

void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,

                           uint8_t *VAR_2, int VAR_3, int VAR_4)

{

    int VAR_5;

    uint32_t flags;

    target_phys_addr_t page, phys_addr;



    while (VAR_3 > 0) {

        page = VAR_1 & TARGET_PAGE_MASK;

        VAR_5 = (page + TARGET_PAGE_SIZE) - VAR_1;

        if (VAR_5 > VAR_3)

            VAR_5 = VAR_3;

        flags = iommu_page_get_flags(VAR_0, page);

        if (!(flags & IOPTE_VALID))

            return;

        phys_addr = iommu_translate_pa(VAR_0, VAR_1, flags);

        if (VAR_4) {

            if (!(flags & IOPTE_WRITE))

                return;

            cpu_physical_memory_write(phys_addr, VAR_2, VAR_3);

        } else {

            cpu_physical_memory_read(phys_addr, VAR_2, VAR_3);

        }

        VAR_3 -= VAR_5;

        VAR_2 += VAR_5;

        VAR_1 += VAR_5;

    }

}

void FUNC_0(void *VAR_0, target_phys_addr_t VAR_1,
uint8_t *VAR_2, int VAR_3, int VAR_4)
{ int VAR_5; uint32_t flags; target_phys_addr_t page, phys_addr; while (VAR_3 > 0) { page = VAR_1 & TARGET_PAGE_MASK; VAR_5 = (page + TARGET_PAGE_SIZE) - VAR_1; if (VAR_5 > VAR_3)
VAR_5 = VAR_3; flags = iommu_page_get_flags(VAR_0, page); if (!(flags & IOPTE_VALID))
return; phys_addr = iommu_translate_pa(VAR_0, VAR_1, flags); if (VAR_4) { if (!(flags & IOPTE_WRITE))
return; cpu_physical_memory_write(phys_addr, VAR_2, VAR_3); } else { cpu_physical_memory_read(phys_addr, VAR_2, VAR_3); } VAR_3 -= VAR_5; VAR_2 += VAR_5; VAR_1 += VAR_5; } }