int ioinst_handle_ssch(CPUS390XState *env, uint64_t reg1, uint32_t ipb)

{

    int cssid, ssid, schid, m;

    SubchDev *sch;

    ORB *orig_orb, orb;

    uint64_t addr;

    int ret = -ENODEV;

    int cc;

    hwaddr len = sizeof(*orig_orb);



    if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {

        program_interrupt(env, PGM_OPERAND, 2);

        return -EIO;

    }

    trace_ioinst_sch_id("ssch", cssid, ssid, schid);

    addr = decode_basedisp_s(env, ipb);

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 2);

        return -EIO;

    }

    orig_orb = s390_cpu_physical_memory_map(env, addr, &len, 0);

    if (!orig_orb || len != sizeof(*orig_orb)) {

        program_interrupt(env, PGM_ADDRESSING, 2);

        cc = -EIO;

        goto out;

    }

    copy_orb_from_guest(&orb, orig_orb);

    if (!ioinst_orb_valid(&orb)) {

        program_interrupt(env, PGM_OPERAND, 2);

        cc = -EIO;

        goto out;

    }

    sch = css_find_subch(m, cssid, ssid, schid);

    if (sch && css_subch_visible(sch)) {

        ret = css_do_ssch(sch, &orb);

    }

    switch (ret) {

    case -ENODEV:

        cc = 3;

        break;

    case -EBUSY:

        cc = 2;

        break;

    case 0:

        cc = 0;

        break;

    default:

        cc = 1;

        break;

    }



out:

    s390_cpu_physical_memory_unmap(env, orig_orb, len, 0);

    return cc;

}

int ioinst_handle_ssch(CPUS390XState *env, uint64_t reg1, uint32_t ipb)

{

    int cssid, ssid, schid, m;

    SubchDev *sch;

    ORB *orig_orb, orb;

    uint64_t addr;

    int ret = -ENODEV;

    int cc;

    hwaddr len = sizeof(*orig_orb);



    if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {

        program_interrupt(env, PGM_OPERAND, 2);

        return -EIO;

    }

    trace_ioinst_sch_id("ssch", cssid, ssid, schid);

    addr = decode_basedisp_s(env, ipb);

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 2);

        return -EIO;

    }

    orig_orb = s390_cpu_physical_memory_map(env, addr, &len, 0);

    if (!orig_orb || len != sizeof(*orig_orb)) {

        program_interrupt(env, PGM_ADDRESSING, 2);

        cc = -EIO;

        goto out;

    }

    copy_orb_from_guest(&orb, orig_orb);

    if (!ioinst_orb_valid(&orb)) {

        program_interrupt(env, PGM_OPERAND, 2);

        cc = -EIO;

        goto out;

    }

    sch = css_find_subch(m, cssid, ssid, schid);

    if (sch && css_subch_visible(sch)) {

        ret = css_do_ssch(sch, &orb);

    }

    switch (ret) {

    case -ENODEV:

        cc = 3;

        break;

    case -EBUSY:

        cc = 2;

        break;

    case 0:

        cc = 0;

        break;

    default:

        cc = 1;

        break;

    }



out:

    s390_cpu_physical_memory_unmap(env, orig_orb, len, 0);

    return cc;

}

int FUNC_0(CPUS390XState *VAR_0, uint64_t VAR_1, uint32_t VAR_2)

{

    int VAR_3, VAR_4, VAR_5, VAR_6;

    SubchDev *sch;

    ORB *orig_orb, orb;

    uint64_t addr;

    int VAR_7 = -ENODEV;

    int VAR_8;

    hwaddr len = sizeof(*orig_orb);



    if (ioinst_disassemble_sch_ident(VAR_1, &VAR_6, &VAR_3, &VAR_4, &VAR_5)) {

        program_interrupt(VAR_0, PGM_OPERAND, 2);

        return -EIO;

    }

    trace_ioinst_sch_id("ssch", VAR_3, VAR_4, VAR_5);

    addr = decode_basedisp_s(VAR_0, VAR_2);

    if (addr & 3) {

        program_interrupt(VAR_0, PGM_SPECIFICATION, 2);

        return -EIO;

    }

    orig_orb = s390_cpu_physical_memory_map(VAR_0, addr, &len, 0);

    if (!orig_orb || len != sizeof(*orig_orb)) {

        program_interrupt(VAR_0, PGM_ADDRESSING, 2);

        VAR_8 = -EIO;

        goto out;

    }

    copy_orb_from_guest(&orb, orig_orb);

    if (!ioinst_orb_valid(&orb)) {

        program_interrupt(VAR_0, PGM_OPERAND, 2);

        VAR_8 = -EIO;

        goto out;

    }

    sch = css_find_subch(VAR_6, VAR_3, VAR_4, VAR_5);

    if (sch && css_subch_visible(sch)) {

        VAR_7 = css_do_ssch(sch, &orb);

    }

    switch (VAR_7) {

    case -ENODEV:

        VAR_8 = 3;

        break;

    case -EBUSY:

        VAR_8 = 2;

        break;

    case 0:

        VAR_8 = 0;

        break;

    default:

        VAR_8 = 1;

        break;

    }



out:

    s390_cpu_physical_memory_unmap(VAR_0, orig_orb, len, 0);

    return VAR_8;

}

int FUNC_0(CPUS390XState *VAR_0, uint64_t VAR_1, uint32_t VAR_2)
{ int VAR_3, VAR_4, VAR_5, VAR_6; SubchDev *sch; ORB *orig_orb, orb; uint64_t addr; int VAR_7 = -ENODEV; int VAR_8; hwaddr len = sizeof(*orig_orb); if (ioinst_disassemble_sch_ident(VAR_1, &VAR_6, &VAR_3, &VAR_4, &VAR_5)) { program_interrupt(VAR_0, PGM_OPERAND, 2); return -EIO; } trace_ioinst_sch_id("ssch", VAR_3, VAR_4, VAR_5); addr = decode_basedisp_s(VAR_0, VAR_2); if (addr & 3) { program_interrupt(VAR_0, PGM_SPECIFICATION, 2); return -EIO; } orig_orb = s390_cpu_physical_memory_map(VAR_0, addr, &len, 0); if (!orig_orb || len != sizeof(*orig_orb)) { program_interrupt(VAR_0, PGM_ADDRESSING, 2); VAR_8 = -EIO; goto out; } copy_orb_from_guest(&orb, orig_orb); if (!ioinst_orb_valid(&orb)) { program_interrupt(VAR_0, PGM_OPERAND, 2); VAR_8 = -EIO; goto out; } sch = css_find_subch(VAR_6, VAR_3, VAR_4, VAR_5); if (sch && css_subch_visible(sch)) { VAR_7 = css_do_ssch(sch, &orb); } switch (VAR_7) { case -ENODEV:
VAR_8 = 3; break; case -EBUSY:
VAR_8 = 2; break; case 0:
VAR_8 = 0; break; default:
VAR_8 = 1; break; } out:
s390_cpu_physical_memory_unmap(VAR_0, orig_orb, len, 0); return VAR_8; }