summaryrefslogtreecommitdiffstatshomepage
path: root/py
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-07-18 17:30:23 +1000
committerDamien George <damien.p.george@gmail.com>2017-07-18 17:30:23 +1000
commit3235b95f087751f54c5531e24033e802be199d7c (patch)
tree34b1c2e696ac509430dbc55b161f5af5b609e0c7 /py
parent016325dd0a5ad0904378004e728ccca19ee2b30d (diff)
downloadmicropython-3235b95f087751f54c5531e24033e802be199d7c.tar.gz
micropython-3235b95f087751f54c5531e24033e802be199d7c.zip
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).
Diffstat (limited to 'py')
-rw-r--r--py/asmx64.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/py/asmx64.c b/py/asmx64.c
index cf1a86b3f0..6775e8e93d 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);
}