Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PowerPC64LE subfo. instruction fails to disassemble #1693

Closed
shawnanastasio opened this issue Sep 27, 2020 · 1 comment · Fixed by #2013
Closed

PowerPC64LE subfo. instruction fails to disassemble #1693

shawnanastasio opened this issue Sep 27, 2020 · 1 comment · Fixed by #2013

Comments

@shawnanastasio
Copy link

Capstone 4.0.2 fails to disassemble subfo., the OE=1 Rc=1 form of the Subtract From XO-form instruction (Primary Opcode 31) on PowerPC64LE.

Simple reproducer:

#include <stdio.h>
#include <stdint.h>

#include <capstone/capstone.h>

static const uint8_t code[] = {
    0x51, 0x64, 0x0d, 0x7c, /* subfo. r0, r13, r12 */
};

int main(void) {
    csh handle;
    cs_insn *insn;
    size_t count;

    if (cs_open(CS_ARCH_PPC, CS_MODE_64 + CS_MODE_LITTLE_ENDIAN, &handle) != CS_ERR_OK)
        return 1;

    count = cs_disasm(handle, code, sizeof(code), 0, 0, &insn);
    printf("disassembled instruction count: %zu\n", count); // -> prints 0
}
@shawnanastasio
Copy link
Author

Confirmed reproducible on latest commit 4457d45.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant