AsmJit发出字节或x64绝对远跳

问题描述

我想使用asmjit发出绝对远跳。 此跳转的字节数:

FF 25 00 00 00 00 // jmp qword ptr [null offset]
00 00 00 00 00 00 00 00 // 8-byte jump target address

但是我不知道如何发出偏移量为0且后跟原始地址字节的jmp qword ptr [*]
有人可以帮我吗?
预先感谢!

UPD:我知道如何发出jmp qword ptr [*]

a.jmp(asmjit::x86::ptr(asmjit::x86::rip));

但是如何发出原始地址字节?

解决方法

有多个选项:

a)在跳转后嵌入地址,这将回答问题:

a.jmp(asmjit::x86::ptr(asmjit::x86::rip));
a.embedUInt64(addressToEmbed);

b)对Label做相同的操作

Label constPool = a.newLabel();
a.jmp(x86::ptr(constPool));

// later in the code.
a.bind(constPool);
a.embedUInt64(addressToEmbed);
// possibly more addresses in the pool.
embedUInt64(anotherAddress);

c)在jmp本身中使用绝对地址,因为AsmJit会将地址添加到AddressTable中,该地址将在指令流的末尾发出(它基本上会自己执行(b)或使用32位相对位移,如果可能)。

a.jmp(absoluteAddress);

d)如果要使用常量池方法(b),但要立即发出地址,则也可以使用多个节-多个节就像具有多个缓冲区,这些缓冲区将在组装结束时展平。我会把您指向AsmJit测试目录中名为asmjit_test_x86_sections.cpp的AsmJit测试。

此外,Asmjit在此处提供了一个文档:https://asmjit.com/doc/index.html-它会定期更新并反映主分支。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...