Opened 6 years ago
#799 new enhancement
Remove need for -mno-red-zone by better stack handling on amd64
Reported by: | Jiří Zárevúcky | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | |
Component: | helenos/kernel/amd64 | Version: | mainline |
Keywords: | Cc: | ||
Blocker for: | Depends on: | ||
See also: |
Description
The need for -mno-red-zone
arises because interrupts can land on the currently active kernel stack, which clobbers stack beyond current sp
, which holds the amd64 ABI "red zone". This is fine for the most part, but creates an additional difference between kernel and non-kernel code. Additionally clang doesn't have this flag, so one cannot build kernel and uspace with the same compiler target using clang.
However, amd64 also possesses the ability to use a different stack for different interrupts via IST, the interrupt stack table. Making sure that no interrupt can ever land on an active stack would not only remove the need for disabling red zone, but would also make it easier to ensure that kernel stacks can't overflow in any circumstance.