Skip to content

Systemz immediate missing upper 32bits? #1515

@kamiyaa

Description

@kamiyaa

The upper 32bits of the immediate appears to be dropped at some point in the calculation.

Produced on next branch 0574f89

csh handle;
cs_insn *csInst = NULL;
if (cs_open(CS_ARCH_SYSZ, 0, &handle) != CS_ERR_OK){
    fprintf(stderr, "Error initilizing Capstone\n");
    return 1;
}
if (cs_option(handle, CS_OPT_DETAIL, CS_OPT_ON) != CS_ERR_OK){
    fprintf(stderr, "Error setting options\n" );
    return 1;
}
csInst = cs_malloc(handle);
if (csInst == NULL) {
    fprintf(stderr, "Error alocating memory!\n");
    return 2;
}

uint8_t buffer[40] = { 0 };
// buffer = ec180b6f007c
buffer[0] = 0xec;    buffer[1] = 0x18;    buffer[2] = 0x0b;
buffer[3] = 0x6f;    buffer[4] = 0x00;    buffer[5] = 0x7c;

// cgije
uint64 baseAddr = 0x5024ab4566;

int ret
do {
    ret = cs_disasm_iter(handle, &pBuffer, &size, &baseAddr, csInst );
    if (ret) {
        for (i = 0; i < csInst->detail->sysz.op_count; i++) {
            if (csInst->detail->sysz.operands[i].type == SYSZ_OP_IMM) {
                fprintf(stderr, "immediate: %lx %lu\n", csInst->detail->sysz.operands[i].imm,
                    csInst->detail->sysz.operands[i].imm);
            }
        }
    }
} while (ret);

Output:

immediate: 24ab5c44, 615210052

Expected:

immediate: 5024ab5c44, 344212593732

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions