Skip to content

PPC: Negative immediate operands are displayed as unsigned ints instead of negative #1528

Closed
@EdwardLarson

Description

@EdwardLarson

addi and cmpwi instructions do arithmetic/comparisons with a signed immediate. However capstone emits integers as unsigned integers rather than signed.
Examples:

cstool ppc64be "\x2f\x85\xff\xfe" 0x0
> 0  2f 85 ff fe  cmpwi	cr7, r5, 0xfffe
cstool ppc64be "\x38\x43\x80\x00" 0x0
> 0  38 43 80 00  addi	r2, r3, 0x8000

One could argue this notation is correct, however attempting to assemble them with keystone will throw KS_ERR_INVALIDOPERAND

Metadata

Metadata

Assignees

No one assigned

    Labels

    PowerPCArchbugSomething is not working as it should

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions