INSTR_CREATE_mov

26 views
Skip to first unread message

Mohammad Ewais

unread,
Dec 13, 2021, 10:05:33 PM12/13/21
to DynamoRIO Users
Hi,

This may sound like a very simple question, but it has got me really confused.
I am trying to create a good old x86 mov from reg to reg. e.g. mov rax, rdx But I can't find the correct MOV opcode or INSTR_CREATE  to use for it.

The opcodes I found and my understanding of them:
- OP_mov_ld. Source must be memory operand, for example opnd_create_base_disp
- OP_mov_st. Destination must be memory operand
- OP_mov_imm. Source must be immediate
- OP_mov_seg. Either source or destination should be a Segment register
- OP_mov_priv. I don't know what this is?!

There are also five corresponding INSTR_CREATE_ macros with the exact same prefixes. What is the correct OP/Macro I should use if I all I want to do is the following?
INSTR_CREATE_mov_????(drctx, opnd_create_reg(reg1), opnd_create_reg(reg2));

Thanks

Derek Bruening

unread,
Dec 13, 2021, 10:50:16 PM12/13/21
to dynamor...@googlegroups.com
I believe either OP_mov_ld or OP_mov_st can take two registers: their "modrm" byte can select either a base-disp or a plain register which I think is why it was done that way.  Looking at XINST_CREATE_move() helps: it could be used directly (and is cross-platform) or you can see it is defined with mov_ld.

--
You received this message because you are subscribed to the Google Groups "DynamoRIO Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dynamorio-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dynamorio-users/187b52c9-6452-4f4c-b61c-7d90ad0f1478n%40googlegroups.com.

Mohammad Ewais

unread,
Dec 14, 2021, 12:38:06 PM12/14/21
to DynamoRIO Users
Thanks a lot Derek.
Reply all
Reply to author
Forward
0 new messages