int sclp_service_call(uint32_t sccb, uint64_t code)

{

    int r = 0;

    SCCB work_sccb;



    hwaddr sccb_len = sizeof(SCCB);



    /* first some basic checks on program checks */

    if (cpu_physical_memory_is_io(sccb)) {

        r = -PGM_ADDRESSING;

        goto out;

    }

    if (sccb & ~0x7ffffff8ul) {

        r = -PGM_SPECIFICATION;

        goto out;

    }



    /*

     * we want to work on a private copy of the sccb, to prevent guests

     * from playing dirty tricks by modifying the memory content after

     * the host has checked the values

     */

    cpu_physical_memory_read(sccb, &work_sccb, sccb_len);



    /* Valid sccb sizes */

    if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||

        be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) {

        r = -PGM_SPECIFICATION;

        goto out;

    }



    sclp_execute((SCCB *)&work_sccb, code);



    cpu_physical_memory_write(sccb, &work_sccb,

                              be16_to_cpu(work_sccb.h.length));



    sclp_service_interrupt(sccb);



out:

    return r;

}

int sclp_service_call(uint32_t sccb, uint64_t code)

{

    int r = 0;

    SCCB work_sccb;



    hwaddr sccb_len = sizeof(SCCB);



    

    if (cpu_physical_memory_is_io(sccb)) {

        r = -PGM_ADDRESSING;

        goto out;

    }

    if (sccb & ~0x7ffffff8ul) {

        r = -PGM_SPECIFICATION;

        goto out;

    }



    









    cpu_physical_memory_read(sccb, &work_sccb, sccb_len);



    

    if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||

        be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) {

        r = -PGM_SPECIFICATION;

        goto out;

    }



    sclp_execute((SCCB *)&work_sccb, code);



    cpu_physical_memory_write(sccb, &work_sccb,

                              be16_to_cpu(work_sccb.h.length));



    sclp_service_interrupt(sccb);



out:

    return r;

}

int FUNC_0(uint32_t VAR_0, uint64_t VAR_1)

{

    int VAR_2 = 0;

    SCCB work_sccb;



    hwaddr sccb_len = sizeof(SCCB);



    

    if (cpu_physical_memory_is_io(VAR_0)) {

        VAR_2 = -PGM_ADDRESSING;

        goto out;

    }

    if (VAR_0 & ~0x7ffffff8ul) {

        VAR_2 = -PGM_SPECIFICATION;

        goto out;

    }



    









    cpu_physical_memory_read(VAR_0, &work_sccb, sccb_len);



    

    if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||

        be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) {

        VAR_2 = -PGM_SPECIFICATION;

        goto out;

    }



    sclp_execute((SCCB *)&work_sccb, VAR_1);



    cpu_physical_memory_write(VAR_0, &work_sccb,

                              be16_to_cpu(work_sccb.h.length));



    sclp_service_interrupt(VAR_0);



out:

    return VAR_2;

}

int FUNC_0(uint32_t VAR_0, uint64_t VAR_1)
{ int VAR_2 = 0; SCCB work_sccb; hwaddr sccb_len = sizeof(SCCB); if (cpu_physical_memory_is_io(VAR_0)) { VAR_2 = -PGM_ADDRESSING; goto out; } if (VAR_0 & ~0x7ffffff8ul) { VAR_2 = -PGM_SPECIFICATION; goto out; } cpu_physical_memory_read(VAR_0, &work_sccb, sccb_len); if (be16_to_cpu(work_sccb.h.length) < sizeof(SCCBHeader) ||
be16_to_cpu(work_sccb.h.length) > SCCB_SIZE) { VAR_2 = -PGM_SPECIFICATION; goto out; } sclp_execute((SCCB *)&work_sccb, VAR_1); cpu_physical_memory_write(VAR_0, &work_sccb,
be16_to_cpu(work_sccb.h.length)); sclp_service_interrupt(VAR_0); out:
return VAR_2; }