int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb)

{

    CPUS390XState *env = &cpu->env;

    uint64_t addr;

    int lowcore;

    IOIntCode int_code;

    hwaddr len;

    int ret;

    uint8_t ar;



    trace_ioinst("tpi");

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

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 2);

        return -EIO;

    }



    lowcore = addr ? 0 : 1;

    len = lowcore ? 8 /* two words */ : 12 /* three words */;

    ret = css_do_tpi(&int_code, lowcore);

    if (ret == 1) {

        s390_cpu_virt_mem_write(cpu, lowcore ? 184 : addr, ar, &int_code, len);

    }

    return ret;

}

int ioinst_handle_tpi(S390CPU *cpu, uint32_t ipb)

{

    CPUS390XState *env = &cpu->env;

    uint64_t addr;

    int lowcore;

    IOIntCode int_code;

    hwaddr len;

    int ret;

    uint8_t ar;



    trace_ioinst("tpi");

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

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 2);

        return -EIO;

    }



    lowcore = addr ? 0 : 1;

    len = lowcore ? 8  : 12 ;

    ret = css_do_tpi(&int_code, lowcore);

    if (ret == 1) {

        s390_cpu_virt_mem_write(cpu, lowcore ? 184 : addr, ar, &int_code, len);

    }

    return ret;

}

int FUNC_0(S390CPU *VAR_0, uint32_t VAR_1)

{

    CPUS390XState *env = &VAR_0->env;

    uint64_t addr;

    int VAR_2;

    IOIntCode int_code;

    hwaddr len;

    int VAR_3;

    uint8_t ar;



    trace_ioinst("tpi");

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

    if (addr & 3) {

        program_interrupt(env, PGM_SPECIFICATION, 2);

        return -EIO;

    }



    VAR_2 = addr ? 0 : 1;

    len = VAR_2 ? 8  : 12 ;

    VAR_3 = css_do_tpi(&int_code, VAR_2);

    if (VAR_3 == 1) {

        s390_cpu_virt_mem_write(VAR_0, VAR_2 ? 184 : addr, ar, &int_code, len);

    }

    return VAR_3;

}

int FUNC_0(S390CPU *VAR_0, uint32_t VAR_1)
{ CPUS390XState *env = &VAR_0->env; uint64_t addr; int VAR_2; IOIntCode int_code; hwaddr len; int VAR_3; uint8_t ar; trace_ioinst("tpi"); addr = decode_basedisp_s(env, VAR_1, &ar); if (addr & 3) { program_interrupt(env, PGM_SPECIFICATION, 2); return -EIO; } VAR_2 = addr ? 0 : 1; len = VAR_2 ? 8  : 12 ; VAR_3 = css_do_tpi(&int_code, VAR_2); if (VAR_3 == 1) { s390_cpu_virt_mem_write(VAR_0, VAR_2 ? 184 : addr, ar, &int_code, len); } return VAR_3; }