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).
This commit is contained in:
Damien George 2017-07-18 17:30:23 +10:00
parent 016325dd0a
commit 3235b95f08

View File

@ -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);
}