什么是程序启动时的默认寄存器状态(asm,linux)?

什么是程序启动时的默认寄存器状态(asm,linux)?,第1张

概述什么是程序启动时的默认寄存器状态(asm,linux)?

当程序启动时(linux,elf) – 在eax , ebx等中是否有零,或者可以有任何东西(我没有做任何调用或使用extern库)? 在我的机器上实际上是这样,编写asm程序时可以传递这样的行为吗?

分段错误当我在linux上运行使用Hard float构build的Neon代码时

是否有可能使用dbghelp.dll从给定的地址获得汇编代码?

文本编辑器为汇编

减去十进制值(汇编)

linux x86_64汇编套接字编程

这完全取决于每个平台的ABI。 既然你提到了eax和ebx让我们来看看x86的情况。 在fs/binfmt_elf.c第972行,在load_elf_binary()内部,内核检查ABI是否在程序加载时指定了对寄存器值的任何要求 :

/* * The ABI may specify that certain registers be set up in special * ways (on i386 %edx is the address of a DT_FINI function,for * example. In addition,it may also specify (eg,PowerPC64 ELF) * that the e_entry fIEld is the address of the function descriptor * for the startup routine,rather than the address of the startup * routine itself. This macro performs whatever initialization to * the regs structure is required as well as any relocations to the * function descriptor entrIEs when executing dynamically links apps. */

然后调用ELF_PLAT_INIT ,这是一个为arch/xxx/include/elf.h每个体系结构定义的宏。 对于x86,它执行以下 *** 作 :

#define ELF_PLAT_INIT(_r,load_addr) do { _r->bx = 0; _r->cx = 0; _r->dx = 0; _r->si = 0; _r->di = 0; _r->bp = 0; _r->ax = 0; } while (0)

所以,当你的ELF二进制文件加载到linux x86上时,你可以指望所有的寄存器值等于零。 但是,这并不意味着你应该。 总结

以上是内存溢出为你收集整理的什么是程序启动时的默认寄存器状态(asm,linux)?全部内容,希望文章能够帮你解决什么是程序启动时的默认寄存器状态(asm,linux)?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/langs/1159820.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存