void ioinst_handle_ssch(S390CPU *cpu, 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;

    CPUS390XState *env = &cpu->env;

    uint8_t ar;



    addr = decode_basedisp_s(env, ipb, &ar);

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 4);

        return;

    }

    if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) {

        return;

    }

    copy_orb_from_guest(&orb, &orig_orb);

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

        !ioinst_orb_valid(&orb)) {

        program_interrupt(env, PGM_OPERAND, 4);

        return;

    }

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

    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 -EFAULT:

        /*

         * TODO:

         * I'm wondering whether there is something better

         * to do for us here (like setting some device or

         * subchannel status).

         */

        program_interrupt(env, PGM_ADDRESSING, 4);

        return;

    case 0:

        cc = 0;

        break;

    default:

        cc = 1;

        break;

    }

    setcc(cpu, cc);

}

void ioinst_handle_ssch(S390CPU *cpu, 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;

    CPUS390XState *env = &cpu->env;

    uint8_t ar;



    addr = decode_basedisp_s(env, ipb, &ar);

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 4);

        return;

    }

    if (s390_cpu_virt_mem_read(cpu, addr, ar, &orig_orb, sizeof(orb))) {

        return;

    }

    copy_orb_from_guest(&orb, &orig_orb);

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

        !ioinst_orb_valid(&orb)) {

        program_interrupt(env, PGM_OPERAND, 4);

        return;

    }

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

    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 -EFAULT:

        











        program_interrupt(env, PGM_ADDRESSING, 4);

        return;

    case 0:

        cc = 0;

        break;

    default:

        cc = 1;

        break;

    }

    setcc(cpu, cc);

}

    switch (ret) {     case 0:         break;     case -EBUSY:         break;     case -ENODEV:         break;         break;     default:     int ret = -ENODEV;     int cc;     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 -EFAULT:         program_interrupt(env, PGM_ADDRESSING, 4);     case 0:         cc = 0;         break;     default:         cc = 1;         break;     setcc(cpu, cc);     int ret = -ENODEV;     int cc;     if (sch && css_subch_visible(sch)) {     switch (ret) {     case -ENODEV:         cc = 3;         break;         cc = 2;         break;     case 0:         cc = 0;         break;     default:         cc = 1;         break;     setcc(cpu, cc);
void FUNC_0(S390CPU *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;

    CPUS390XState *env = &VAR_0->env;

    uint8_t ar;



    addr = decode_basedisp_s(env, VAR_2, &ar);

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 4);

        return;

    }

    if (s390_cpu_virt_mem_read(VAR_0, addr, ar, &orig_orb, sizeof(orb))) {

        return;

    }

    copy_orb_from_guest(&orb, &orig_orb);

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

        !ioinst_orb_valid(&orb)) {

        program_interrupt(env, PGM_OPERAND, 4);

        return;

    }

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

    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 -EFAULT:

        











        program_interrupt(env, PGM_ADDRESSING, 4);

        return;

    case 0:

        VAR_8 = 0;

        break;

    default:

        VAR_8 = 1;

        break;

    }

    setcc(VAR_0, VAR_8);

}

void FUNC_0(S390CPU *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; CPUS390XState *env = &VAR_0->env; uint8_t ar; addr = decode_basedisp_s(env, VAR_2, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 4); return; } if (s390_cpu_virt_mem_read(VAR_0, addr, ar, &orig_orb, sizeof(orb))) { return; } copy_orb_from_guest(&orb, &orig_orb); if (ioinst_disassemble_sch_ident(VAR_1, &VAR_6, &VAR_3, &VAR_4, &VAR_5) ||
!ioinst_orb_valid(&orb)) { program_interrupt(env, PGM_OPERAND, 4); return; } trace_ioinst_sch_id("ssch", VAR_3, VAR_4, VAR_5); 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 -EFAULT:
program_interrupt(env, PGM_ADDRESSING, 4); return; case 0:
VAR_8 = 0; break; default:
VAR_8 = 1; break; } setcc(VAR_0, VAR_8); }