堆栈和堆栈基地址 [英] Stack and Stack Base Address

查看:148
本文介绍了堆栈和堆栈基地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MEMORY_BASIC_INFORMATION 结构中找到两个PVOID变量,分别称为BaseAddressAllocationBase.

In the MEMORY_BASIC_INFORMATION structure one finds two PVOID variables, called BaseAddress and AllocationBaserespectively.

我正在读一本关于线程的书,它详细介绍了如何使堆栈空间留在堆栈上,但是我不确定我是否正确理解了一些东西.

I'm reading a book on Threading and its going over how to get the stackspace left on the stack in quite some detail, however there's something I'm not sure I understand correctly.

上述结构中的BaseAddress,它指向当前线程堆栈中的最高地址还是最低地址?由于堆栈向下增长,因此最低的堆栈将位于顶部,最高的堆栈将位于底部.

The BaseAddress in the structure mentioned above, does it point to the highest address in the current thread stack or the lowest address? Since the stack grows downwards, the lowest would be at the top and the highest at the bottom.

AllocationBaseBaseAddress字段之间到底有什么区别?我觉得MSDN文档不是很解释,所以我希望有人可以澄清更多信息?

What exactly is the difference between the AllocationBase and BaseAddress field? I don't find the MSDN documentation very explanatory, so I'm hoping someone can clarify a bit more?

在我的书中,它还说"AllocationBase"地址与TEB结构中的"DeallocationStack"字段相同,它指出了堆栈的末尾,我认为这是最高地址,但是它的BASE,我猜它应该是最低的地址,因为堆栈向下增长.所以我对什么是什么感到困惑?

In my book it also says that the 'AllocationBase' address is the same as the 'DeallocationStack' field in the TEB structure, which it says points to the end of the stack, which I thought was the highest address, however since its BASE, I'm guessing it should be the lowest address, as the stack grows downward. So I'm kind of confused as to what's what?

每个页,"DeallocationStack '是:最大堆栈大小存储在DeallocationStack字段中

Per this page, 'DeallocationStack' is: The maximum stack size is stored in the field DeallocationStack

有人可以帮助我理解我的困惑吗?

Can someone help me understand my confusion?

推荐答案

MEMORY_BASIC_INFORMATION结构中:

  • BaseAddress-查询的内存页面的地址(VirtualQuery(LPCVOID lpAddress ,...").
  • AllocationBase-分配的内存块的开始.用于重新分配. BaseAddress> = AllocationBase.
  • BaseAddress - the address of the queried memory page ( VirtualQuery(LPCVOID lpAddress,... ).
  • AllocationBase - the beginning of the allocated memory block. It is used for deallocation. BaseAddress >= AllocationBase.

如果要查询堆栈,则AllocationBase将是堆栈的最低地址(堆栈顶部).

If you are querying stack then AllocationBase will be the lowest address of the stack (the stack top).

这篇关于堆栈和堆栈基地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆