Red zone (computing)
In computing, the red zone is a fixed-size area in a function's stack frame below (for a push-down stack) the current stack pointer that is reserved and safe to use. It is most commonly used in leaf functions (functions that don't call other functions) for allocating additional stack memory, without moving the stack pointer, which saves an instruction. Whether a red zone is present depends on the calling convention. x86-64 systems that use the System V AMD64 ABI (including Linux and macOS) use a 128-byte red zone that begins directly under the current value of the stack pointer. The OpenRISC toolchain assumes a 128-byte red zone. Microsoft Windows does not have the concept of a red zone on x86. In fact, the ABI explicitly states that the memory beyond the stack pointer is volatile and may be overwritten by debuggers or interrupt handlers. However, Microsoft Windows has a red zone of 16 bytes on IA-64, 8 bytes on AArch32, and 16 bytes on AArch64. The red zone is safe from modification by interrupt/exception/signal handlers - the CPU is generally not aware of the red zone, however, it switches to a kernel stack in the case of an interrupt. If the kernel itself tried to use the red zone in a preemptible context, the contents would be trashed.
In computing, the red zone is a fixed-size area in a function's stack frame below (for a push-down stack) the current stack pointer that is reserved and safe to use. It is most commonly used in leaf functions (functions that don't call other functions) for allocating additional stack memory, without moving the stack pointer, which saves an instruction. Whether a red zone is present depends on the calling convention. x86-64 systems that use the System V AMD64 ABI (including Linux and macOS) use a 128-byte red zone that begins directly under the current value of the stack pointer. The OpenRISC toolchain assumes a 128-byte red zone. Microsoft Windows does not have the concept of a red zone on x86. In fact, the ABI explicitly states that the memory beyond the stack pointer is volatile and may be overwritten by debuggers or interrupt handlers. However, Microsoft Windows has a red zone of 16 bytes on IA-64, 8 bytes on AArch32, and 16 bytes on AArch64. The red zone is safe from modification by interrupt/exception/signal handlers - the CPU is generally not aware of the red zone, however, it switches to a kernel stack in the case of an interrupt. If the kernel itself tried to use the red zone in a preemptible context, the contents would be trashed. ==Notes and references==
References
- Fog, Agner (2021-01-31). Calling conventions for different C++ compilers and operating systems (PDF) . Denmark. p. 20 . Retrieved 2021-07-11 . {{ cite book }} : CS1 maint: location missing publisher ( link ) Wikipedia revision 1307376366, retrieved 2026-11-18 · retrieved 2021-07-10 · rev 1307376366
Cite this reference
MLA "Fog, Agner (2021-01-31). Calling conventions for different C++ compilers and operating systems (PDF) . Denmark. p. 20 . Retrieved 2021-07-11 . {{ cite book }} : CS1 maint: location missing publisher ( link ) Wikipedia revision 1307376366, retrieved 2026-11-18." Fog, Agner (2021-01-31). 2021-07-10. https://www.agner.org/optimize/calling_conventions.pdf. Accessed 24 November 2026.
Chicago "Fog, Agner (2021-01-31). Calling conventions for different C++ compilers and operating systems (PDF) . Denmark. p. 20 . Retrieved 2021-07-11 . {{ cite book }} : CS1 maint: location missing publisher ( link ) Wikipedia revision 1307376366, retrieved 2026-11-18." Fog, Agner (2021-01-31). 2021-07-10. https://www.agner.org/optimize/calling_conventions.pdf.
APA Fog, Agner (2021-01-31). (2021). Fog, Agner (2021-01-31). Calling conventions for different C++ compilers and operating systems (PDF) . Denmark. p. 20 . Retrieved 2021-07-11 . {{ cite book }} : CS1 maint: location missing publisher ( link ) Wikipedia revision 1307376366, retrieved 2026-11-18. Retrieved November 24, 2026, from https://www.agner.org/optimize/calling_conventions.pdf
- Stack frame layout on x86-64 · retrieved 2021-07-10 · rev 1307376366
Cite this reference
MLA "Stack frame layout on x86-64." Bendersky, Eli (2011-09-06). 2021-07-10. https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64. Accessed 24 November 2026.
Chicago "Stack frame layout on x86-64." Bendersky, Eli (2011-09-06). 2021-07-10. https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64.
APA Bendersky, Eli (2011-09-06). (2021). Stack frame layout on x86-64. Retrieved November 24, 2026, from https://eli.thegreenplace.net/2011/09/06/stack-frame-layout-on-x86-64
- System V Application Binary Interface: AMD64 Architecture Processor Supplement (With LP64 and ILP32 Programming Models) Version 1.0 · retrieved 2026-11-17 · rev 1307376366
Cite this reference
MLA "System V Application Binary Interface: AMD64 Architecture Processor Supplement (With LP64 and ILP32 Programming Models) Version 1.0." Michael Matz; Jan Hubička; Andreas Jaeger; et al. 2026-11-17. https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf. Accessed 24 November 2026.
Chicago "System V Application Binary Interface: AMD64 Architecture Processor Supplement (With LP64 and ILP32 Programming Models) Version 1.0." Michael Matz; Jan Hubička; Andreas Jaeger; et al. 2026-11-17. https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf.
APA Michael Matz; Jan Hubička; Andreas Jaeger; et al. (2026). System V Application Binary Interface: AMD64 Architecture Processor Supplement (With LP64 and ILP32 Programming Models) Version 1.0. Retrieved November 24, 2026, from https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-1.0.pdf
- i386 and x86-64 Options - Using the GNU Compiler Collection (GCC) · retrieved 2011-04-09 · rev 1307376366
Cite this reference
MLA "i386 and x86-64 Options - Using the GNU Compiler Collection (GCC)." 2011-04-09. https://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/i386-and-x86_002d64-Options.html#index-no_002dred_002dzone-998. Accessed 24 November 2026.
Chicago "i386 and x86-64 Options - Using the GNU Compiler Collection (GCC)." 2011-04-09. https://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/i386-and-x86_002d64-Options.html#index-no_002dred_002dzone-998.
APA encyclopegia.org. (2011). i386 and x86-64 Options - Using the GNU Compiler Collection (GCC). Retrieved November 24, 2026, from https://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/i386-and-x86_002d64-Options.html#index-no_002dred_002dzone-998
- OpenCores Wiki - OpenRISC GNU toolchain · retrieved 2014-05-27 · rev 1307376366
Cite this reference
MLA "OpenCores Wiki - OpenRISC GNU toolchain." 2014-05-27. https://web.archive.org/web/20140528092446/http://opencores.org/wiki1/index.php?title=OpenRISC_GNU_tool_chain&oldid=1198. Accessed 24 November 2026.
Chicago "OpenCores Wiki - OpenRISC GNU toolchain." 2014-05-27. https://web.archive.org/web/20140528092446/http://opencores.org/wiki1/index.php?title=OpenRISC_GNU_tool_chain&oldid=1198.
APA encyclopegia.org. (2014). OpenCores Wiki - OpenRISC GNU toolchain. Retrieved November 24, 2026, from https://web.archive.org/web/20140528092446/http://opencores.org/wiki1/index.php?title=OpenRISC_GNU_tool_chain&oldid=1198
- Why do we even need to define a red zone? Can't I just use my stack for anything? · retrieved 2021-07-10 · rev 1307376366
Cite this reference
MLA "Why do we even need to define a red zone? Can't I just use my stack for anything?." a b Chen, Raymond (2019-01-11). 2021-07-10. https://devblogs.microsoft.com/oldnewthing/20190111-00/?p=100685. Accessed 24 November 2026.
Chicago "Why do we even need to define a red zone? Can't I just use my stack for anything?." a b Chen, Raymond (2019-01-11). 2021-07-10. https://devblogs.microsoft.com/oldnewthing/20190111-00/?p=100685.
APA a b Chen, Raymond (2019-01-11). (2021). Why do we even need to define a red zone? Can't I just use my stack for anything?. Retrieved November 24, 2026, from https://devblogs.microsoft.com/oldnewthing/20190111-00/?p=100685
Cite this article
MLA
"Red zone (computing)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/red-zone-computing. Accessed 24 November 2026.
Chicago
"Red zone (computing)." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/red-zone-computing.
APA
encyclopegia.org. (2025). Red zone (computing). Retrieved November 24, 2026, from https://encyclopegia.org/wiki/red-zone-computing
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON