-
-
Notifications
You must be signed in to change notification settings - Fork 483
Fail to assemble mov al, -1 #327
Copy link
Copy link
Closed
Description
#include <Zydis/Zydis.h>
#include <Zycore/LibC.h>
int main()
{
ZyanU8 encoded_instruction[ZYDIS_MAX_INSTRUCTION_LENGTH];
ZyanUSize encoded_length = sizeof(encoded_instruction);
ZydisEncoderRequest req;
ZYAN_MEMSET(&req, 0, sizeof(req));
req.mnemonic = ZYDIS_MNEMONIC_MOV;
req.machine_mode = ZYDIS_MACHINE_MODE_LONG_64;
req.operand_count = 2;
req.operands[0].type = ZYDIS_OPERAND_TYPE_REGISTER;
req.operands[0].reg.value = ZYDIS_REGISTER_AL;
req.operands[1].type = ZYDIS_OPERAND_TYPE_IMMEDIATE;
req.operands[1].imm.s = -1;
if (ZYAN_FAILED(ZydisEncoderEncodeInstruction(&req, encoded_instruction, &encoded_length)))
{
ZYAN_PUTS("Failed to encode instruction");
return 1;
}
for (ZyanUSize i = 0; i < encoded_length; ++i)
{
ZYAN_PRINTF("%02X ", encoded_instruction[i]);
}
ZYAN_PUTS("");
return 0;
}
Should assemble, but fails. It works if req.operands[1].imm.u = 0xFF; instead.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels