After toying with a non-reactive IOAPIC and an APIC that just won't listen, tens of different kind of ways to screw it up my most recent one is... odd, to say the least.
I compile my code with a regular (crosscompiler) GCC 4.5.0. It uses a red zone that's been specified in the x86_64 ABI. The red zone is the area of 128 bytes below your stack pointer, which is free for use without informing the interrupt handlers.
My problem is that an external interrupt will corrupt that red zone, no matter what I do (other than use IST for stack switching). How did you solve this? I just resorted to -mno-red-zone but I have the feeling there's something wrong with the whole red zone concept.
The red zone is for...
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: The red zone is for...
It seems that the mainstream OSes disable the red zone for kernel mode - it works in userspace because you always get a stack switch when interrupted, but its definitely a pain in kernel mode.
- Owen
- Member
- Posts: 1700
- Joined: Fri Jun 13, 2008 3:21 pm
- Location: Cambridge, United Kingdom
- Contact:
Re: The red zone is for...
It gives leafs (and non-leafs) a really cheap to access piece of stack. But yes, it doesn't work for x86(_64) kernels, because the processor is stupid and pushes data onto the stack on interrupt.
Re: The red zone is for...
mmmkay, that's about what I expected. Thanks!
PS: Managed to send myself an INIT IPI now! Bad idea to do that from your BSP to your BSP - but it works
PS: Managed to send myself an INIT IPI now! Bad idea to do that from your BSP to your BSP - but it works
Re: The red zone is for...
You may like to check this thread for a very similar case.Candy wrote:My problem is that an external interrupt will corrupt that red zone, no matter what I do (other than use IST for stack switching). How did you solve this? I just resorted to -mno-red-zone but I have the feeling there's something wrong with the whole red zone concept.