diff options
Diffstat (limited to 'py/asmx64.c')
| -rw-r--r-- | py/asmx64.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/py/asmx64.c b/py/asmx64.c index 0b7c87415..1eab585ac 100644 --- a/py/asmx64.c +++ b/py/asmx64.c @@ -340,6 +340,16 @@ void asm_x64_mov_r16_to_mem16(asm_x64_t *as, int src_r64, int dest_r64, int dest asm_x64_write_r64_disp(as, src_r64, dest_r64, dest_disp); } +void asm_x64_mov_r32_to_mem32(asm_x64_t *as, int src_r64, int dest_r64, int dest_disp) { + assert(dest_r64 < 8); + if (src_r64 < 8) { + asm_x64_write_byte_1(as, OPCODE_MOV_R64_TO_RM64); + } else { + asm_x64_write_byte_2(as, REX_PREFIX | REX_R, OPCODE_MOV_R64_TO_RM64); + } + asm_x64_write_r64_disp(as, src_r64, dest_r64, dest_disp); +} + void asm_x64_mov_r64_to_mem64(asm_x64_t *as, int src_r64, int dest_r64, int dest_disp) { // use REX prefix for 64 bit operation asm_x64_write_byte_2(as, REX_PREFIX | REX_W | (src_r64 < 8 ? 0 : REX_R) | (dest_r64 < 8 ? 0 : REX_B), OPCODE_MOV_R64_TO_RM64); @@ -366,6 +376,16 @@ void asm_x64_mov_mem16_to_r64zx(asm_x64_t *as, int src_r64, int src_disp, int de asm_x64_write_r64_disp(as, dest_r64, src_r64, src_disp); } +void asm_x64_mov_mem32_to_r64zx(asm_x64_t *as, int src_r64, int src_disp, int dest_r64) { + assert(src_r64 < 8); + if (dest_r64 < 8) { + asm_x64_write_byte_1(as, OPCODE_MOV_RM64_TO_R64); + } else { + asm_x64_write_byte_2(as, REX_PREFIX | REX_R, OPCODE_MOV_RM64_TO_R64); + } + asm_x64_write_r64_disp(as, dest_r64, src_r64, src_disp); +} + void asm_x64_mov_mem64_to_r64(asm_x64_t *as, int src_r64, int src_disp, int dest_r64) { // use REX prefix for 64 bit operation asm_x64_write_byte_2(as, REX_PREFIX | REX_W | (dest_r64 < 8 ? 0 : REX_R) | (src_r64 < 8 ? 0 : REX_B), OPCODE_MOV_RM64_TO_R64); |
