Closed toxicmouse7 closed 1 year ago
And this is expected behavior. Immediates are considered signed by default (https://github.com/zyantific/zydis-db/pull/13) because that's how ISA works. Immediate operand of mov
gets sign-extended if particular variant requires extension.
In your case sign-extension behavior doesn't occurr because both operands have the same size (32-bit register and 32-bit immediate value) but you still need to treat immediate as signed (Zydis interface requires you to pass full 64-bit value). You need to specify it like this:
req.operands[1].imm.u = 0xFFFFFFFF8FFFFFFF;
or this:
req.operands[1].imm.s = -1879048193;
If the second operand has value more, than INT_MAX (0x7fffffff), the function fails.