static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages,

                           target_ulong *pages, bool is_write)

{

    bool lowprot = is_write && lowprot_enabled(&cpu->env);

    uint64_t asc = cpu->env.psw.mask & PSW_MASK_ASC;

    CPUS390XState *env = &cpu->env;

    int ret, i, pflags;



    for (i = 0; i < nr_pages; i++) {

        /* Low-address protection? */

        if (lowprot && (addr < 512 || (addr >= 4096 && addr < 4096 + 512))) {

            trigger_access_exception(env, PGM_PROTECTION, ILEN_AUTO, 0);

            return -EACCES;

        }

        ret = mmu_translate(env, addr, is_write, asc, &pages[i], &pflags, true);

        if (ret) {

            return ret;

        }

        if (!address_space_access_valid(&address_space_memory, pages[i],

                                        TARGET_PAGE_SIZE, is_write)) {

            program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO);

            return -EFAULT;

        }

        addr += TARGET_PAGE_SIZE;

    }



    return 0;

}

static int translate_pages(S390CPU *cpu, vaddr addr, int nr_pages,

                           target_ulong *pages, bool is_write)

{

    bool lowprot = is_write && lowprot_enabled(&cpu->env);

    uint64_t asc = cpu->env.psw.mask & PSW_MASK_ASC;

    CPUS390XState *env = &cpu->env;

    int ret, i, pflags;



    for (i = 0; i < nr_pages; i++) {

        

        if (lowprot && (addr < 512 || (addr >= 4096 && addr < 4096 + 512))) {

            trigger_access_exception(env, PGM_PROTECTION, ILEN_AUTO, 0);

            return -EACCES;

        }

        ret = mmu_translate(env, addr, is_write, asc, &pages[i], &pflags, true);

        if (ret) {

            return ret;

        }

        if (!address_space_access_valid(&address_space_memory, pages[i],

                                        TARGET_PAGE_SIZE, is_write)) {

            program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO);

            return -EFAULT;

        }

        addr += TARGET_PAGE_SIZE;

    }



    return 0;

}

static int FUNC_0(S390CPU *VAR_0, vaddr VAR_1, int VAR_2,

                           target_ulong *VAR_3, bool VAR_4)

{

    bool lowprot = VAR_4 && lowprot_enabled(&VAR_0->env);

    uint64_t asc = VAR_0->env.psw.mask & PSW_MASK_ASC;

    CPUS390XState *env = &VAR_0->env;

    int VAR_5, VAR_6, VAR_7;



    for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) {

        

        if (lowprot && (VAR_1 < 512 || (VAR_1 >= 4096 && VAR_1 < 4096 + 512))) {

            trigger_access_exception(env, PGM_PROTECTION, ILEN_AUTO, 0);

            return -EACCES;

        }

        VAR_5 = mmu_translate(env, VAR_1, VAR_4, asc, &VAR_3[VAR_6], &VAR_7, true);

        if (VAR_5) {

            return VAR_5;

        }

        if (!address_space_access_valid(&address_space_memory, VAR_3[VAR_6],

                                        TARGET_PAGE_SIZE, VAR_4)) {

            program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO);

            return -EFAULT;

        }

        VAR_1 += TARGET_PAGE_SIZE;

    }



    return 0;

}

static int FUNC_0(S390CPU *VAR_0, vaddr VAR_1, int VAR_2,
target_ulong *VAR_3, bool VAR_4)
{ bool lowprot = VAR_4 && lowprot_enabled(&VAR_0->env); uint64_t asc = VAR_0->env.psw.mask & PSW_MASK_ASC; CPUS390XState *env = &VAR_0->env; int VAR_5, VAR_6, VAR_7; for (VAR_6 = 0; VAR_6 < VAR_2; VAR_6++) { if (lowprot && (VAR_1 < 512 || (VAR_1 >= 4096 && VAR_1 < 4096 + 512))) { trigger_access_exception(env, PGM_PROTECTION, ILEN_AUTO, 0); return -EACCES; } VAR_5 = mmu_translate(env, VAR_1, VAR_4, asc, &VAR_3[VAR_6], &VAR_7, true); if (VAR_5) { return VAR_5; } if (!address_space_access_valid(&address_space_memory, VAR_3[VAR_6],
TARGET_PAGE_SIZE, VAR_4)) { program_interrupt(env, PGM_ADDRESSING, ILEN_AUTO); return -EFAULT; } VAR_1 += TARGET_PAGE_SIZE; } return 0; }