summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-29 22:44:18 +0100
committerDamien George <damien.p.george@gmail.com>2014-09-29 22:44:18 +0100
commit1c6a1dc740a8414be6c9b1101354fe9a8974ff13 (patch)
treeefe8df76a572be8b1d75d0666f5b1ec69aae6f1f
parentdfef4249eb289ae53307d61e3bf2d5cc7339748a (diff)
downloadmicropython-1c6a1dc740a8414be6c9b1101354fe9a8974ff13.tar.gz
micropython-1c6a1dc740a8414be6c9b1101354fe9a8974ff13.zip
py: Allow x86-64 to mov r16 to rm16 with extended src reg.
Fixes bug with x86-64 viper ptr16.
-rw-r--r--py/asmx64.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/py/asmx64.c b/py/asmx64.c
index 3f111781f2..bca825b3c7 100644
--- a/py/asmx64.c
+++ b/py/asmx64.c
@@ -311,9 +311,12 @@ void asm_x64_mov_r8_to_disp(asm_x64_t *as, int src_r64, int dest_r64, int dest_d
}
void asm_x64_mov_r16_to_disp(asm_x64_t *as, int src_r64, int dest_r64, int dest_disp) {
- assert(src_r64 < 8);
assert(dest_r64 < 8);
- asm_x64_write_byte_2(as, OP_SIZE_PREFIX, OPCODE_MOV_R64_TO_RM64);
+ if (src_r64 < 8) {
+ asm_x64_write_byte_2(as, OP_SIZE_PREFIX, OPCODE_MOV_R64_TO_RM64);
+ } else {
+ asm_x64_write_byte_3(as, OP_SIZE_PREFIX, REX_PREFIX | REX_R, OPCODE_MOV_R64_TO_RM64);
+ }
asm_x64_write_r64_disp(as, src_r64, dest_r64, dest_disp);
}