From 3235b95f087751f54c5531e24033e802be199d7c Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 18 Jul 2017 17:30:23 +1000 Subject: py/asmx64: Support moving a 64-bit immediate to one of top 8 registers. If constants (eg mp_const_none_obj) are placed in very high memory locations that require 64-bits for the pointer then the assembler must be able to emit instructions to move such pointers to one of the top 8 registers (ie r8-r15). --- py/asmx64.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'py') diff --git a/py/asmx64.c b/py/asmx64.c index cf1a86b3f..6775e8e93 100644 --- a/py/asmx64.c +++ b/py/asmx64.c @@ -344,8 +344,9 @@ STATIC void asm_x64_mov_i32_to_r64(asm_x64_t *as, int src_i32, int dest_r64) { void asm_x64_mov_i64_to_r64(asm_x64_t *as, int64_t src_i64, int dest_r64) { // cpu defaults to i32 to r64 // to mov i64 to r64 need to use REX prefix - assert(dest_r64 < 8); - asm_x64_write_byte_2(as, REX_PREFIX | REX_W, OPCODE_MOV_I64_TO_R64 | dest_r64); + asm_x64_write_byte_2(as, + REX_PREFIX | REX_W | (dest_r64 < 8 ? 0 : REX_B), + OPCODE_MOV_I64_TO_R64 | (dest_r64 & 7)); asm_x64_write_word64(as, src_i64); } -- cgit v1.2.3