红区
在计算机科学领域中,红区是一个函数堆栈内当前栈指针下方(针对下推形堆栈)的一个固定大小的区域,该区域被保留且可被安全使用。它最常用语叶子函数(不会调用其他函数的函数)来分配额外的栈内存,而同时不会移动栈指针,从而节省一条指令。
红区是否存在取决于调用约定。使用 System V AMD64 ABI 的 x86-64 系统(包括 Linux 和 macOS)使用 128 字节大小的红色区域,该区域从栈指针当前值的正下方开始。OpenRISC 工具链假定使用 128 字节的红色区域[1] 。
微软的 Windows 系统在 x86 上并没有设计实现红区概念。[2]事实上,ABI明确指出栈指针控制之外的内存是易失的,可能会被调试器或者中端处理器覆写。不过,微软的 Windows 在其他架构上也实现过红区,比如 IA-64 上的红区为 16 字节,在 AArch32 上为 8 字节,在 AArch64 上为 16 字节。
参考资料[编辑]
- REDIRECT Template:Delete
脚本错误:没有“Redirect_Template_List”这个模块。 This article "红区" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:红区. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
This article "红区" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:红区. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.
外部链接[编辑]
Template:Computer Science 脚本错误:没有“Authority control”这个模块。脚本错误:没有“Check for unknown parameters”这个模块。
This article "红区" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:红区. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.