insert_mov_immed_arch sets wrong size for reg target on x64
I hit this in Dr. Memory x64 on Windows which uses instrlist_insert_mov_instr_addr(). On this bb:
before instrumentation:
TAG 0x000000013fac1288
+0 L3 48 83 ec 28 sub $0x0000000000000028 %rsp -> %rsp
+4 L3 e8 13 27 00 00 call $0x000000013fac39a4 %rsp -> %rsp 0xfffffff8(%rsp)[8byte]
END 0x000000013fac1288
The return address for DrM's invocation of the slowpath is sign-extended rather than having the proper zero top bits:
+67 L3 48 83 ec 28 sub $0x0000000000000028 %rsp -> %rsp
+71 m4 @0x00000000bfc51648 48 b9 8c 12 ac 3f 01 mov $0x000000013fac128c -> %rcx
00 00 00
+81 m4 @0x00000000bfc520b0 48 c7 c0 30 e3 be bf mov @0x00000000bfc51040[4byte] -> %rax
+88 m4 @0x00000000bfc51360 e9 9a 38 27 00 jmp $0x00000000bfe61bcf
+93 m4 @0x00000000bfc51040 <label>
+93 m4 @0x00000000bfc512e8 65 48 8b 0c 25 b0 15 mov %gs:0x000015b0[8byte] -> %rcx
00 00
=>
0x00000000bfb71334 48 83 ec 28 sub $0x0000000000000028 %rsp -> %rsp
0x00000000bfb71338 48 b9 8c 12 ac 3f 01 mov $0x000000013fac128c -> %rcx
00 00 00
0x00000000bfb71342 48 c7 c0 4e 13 b7 bf mov $0xffffffffbfb7134e -> %rax
0x00000000bfb71349 e9 81 08 2f 00 jmp $0x00000000bfe61bcf
0x00000000bfb7134e 65 48 8b 0c 25 b0 15 mov %gs:0x000015b0[8byte] -> %rcx
00 00