You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For all branch instructions, the target address is passed in as the absolute address (see issue #108). Any address higher than 0x1fffffc throws an "Invalid Operand" error:
/# kstool ppc32be "b 0x1fffffc"
b 0x1fffffc = [ 49 ff ff fc ]
/# kstool ppc32be "b 0x2000000"
ERROR: failed on ks_asm() with count = 0, error = 'Invalid operand (KS_ERR_ASM_INVALIDOPERAND)' (code = 512)
This issue is present on ppc64, ppc64be, and ppc32be.
This behavior appears to be caused by a check that the target address fits the 26-bit limit for unconditional branch targets (16 bits for conditional). However for relative-offset branch instructions it is the offset which is restricted to 26/16 bits, not the target address. For example, the below is a valid branch to an instruction only 8 bytes ahead. The offset which will be encoded, 0x8, is well within the 26-bit limit, however since the target address is more than 26 bits wide, keystone fails:
The expected behavior is that, like other architectures' implementations, keystone does not try to enforce range bounds at all. For example, in ARM64 the max branch range is 2**27 - 4 (0x7fffffc), but keystone will not enforce this limit:
For all branch instructions, the target address is passed in as the absolute address (see issue #108). Any address higher than 0x1fffffc throws an "Invalid Operand" error:
This issue is present on ppc64, ppc64be, and ppc32be.
This behavior appears to be caused by a check that the target address fits the 26-bit limit for unconditional branch targets (16 bits for conditional). However for relative-offset branch instructions it is the offset which is restricted to 26/16 bits, not the target address. For example, the below is a valid branch to an instruction only 8 bytes ahead. The offset which will be encoded, 0x8, is well within the 26-bit limit, however since the target address is more than 26 bits wide, keystone fails:
The expected behavior is that, like other architectures' implementations, keystone does not try to enforce range bounds at all. For example, in ARM64 the max branch range is 2**27 - 4 (0x7fffffc), but keystone will not enforce this limit:
The text was updated successfully, but these errors were encountered: