Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在汇编编程中完成push和pop等堆栈操作后,是否可以获得堆栈的有效起始地址?
约定是在函数的开头将 (E)SP 保存到 (E)BP,并使用 (E)BP 进行局部变量寻址。
最简单的情况就是将初始堆栈指针保存到某个变量以在需要时访问它。如果不是这种情况,请使用特定于平台的 API,例如 Windows 上的 VirtualQuery,使用当前 SP 值作为第一个参数。基地址将在 MEMORY_BASIC_INFORMATION 结构的 BaseAddress 字段中。可以使用 pthread 函数完成 posix 任务