From 8c0e3c951a108d09b85b57dea3f793dc4eed24d5 Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Fri, 15 Jun 2012 20:05:25 +0100 Subject: [PATCH] Add -mno-red-zone to the kernel CCFLAGS/C++FLAGS. The red zone is a 128-byte area below the stack pointer specified by the AMD64 ABI that can be used by leaf functions for their stack frame without modifying the stack pointer. It is guaranteed not to be modified by signal handlers. This cannot be used in kernel mode code, as an interrupt handler could overwrite it, so stop GCC from generating code that uses it. --- build/jam/BuildSetup | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build/jam/BuildSetup b/build/jam/BuildSetup index 6a564e7ff9..f0f30fbf3c 100644 --- a/build/jam/BuildSetup +++ b/build/jam/BuildSetup @@ -383,9 +383,11 @@ switch $(HAIKU_ARCH) { } case x86_64 : { - # Kernel lives in the top 2GB of the address space, use kernel code model. - HAIKU_KERNEL_CCFLAGS += -mcmodel=kernel ; - HAIKU_KERNEL_C++FLAGS += -mcmodel=kernel ; + # Kernel lives in the top 2GB of the address space, use kernel code + # model. Also disable the red zone, which cannot be used in kernel + # code due to interrupts. + HAIKU_KERNEL_CCFLAGS += -mcmodel=kernel -mno-red-zone ; + HAIKU_KERNEL_C++FLAGS += -mcmodel=kernel -mno-red-zone ; # Bootloader is 32-bit. HAIKU_BOOT_LINKFLAGS += -m elf_i386_haiku ;