Thoughts on IST vs no-redzone
Posted: Sat Apr 09, 2022 3:31 pm
Hi,
I was working my first osdev project for last one month or so. It was supposed to be 32 bits kernel. I did some initial work such as, setting up GDT, IDT, enabling paging, printf etc. Now I want to start an 64 bit kernel osdev project before I invest too much into 32 bit kernel because it is becoming an obsolete technology (or should I say it is an obsolete technology). Anyways...
I was reading about 64 bit kernels and how it is different than 32 bit ones, I came across this red-zone problem in System V 64 bit ABI. As far as I can see, people recommend -mno-red-zone flag while compiling kernels both in forums and in wiki.
But, it looks like you can specify alternative stack when using 64 bit version of IDT entries. You do this by filling IST bits of IDT entries with number 1 to 7. This number used as an index into Interrupt Stack Table (IST) which is located in 64 bit version of TSS.
I didn't actually try this yet, but it seems like a possible solution for interrupts trashing red-zone. Is there a reason why this is not often mentioned in forums or wiki? Was this overlooked, or simply recommended against. If so, what are the potential drawbacks of using IST with red-zone enabled.
Best Regards,
I was working my first osdev project for last one month or so. It was supposed to be 32 bits kernel. I did some initial work such as, setting up GDT, IDT, enabling paging, printf etc. Now I want to start an 64 bit kernel osdev project before I invest too much into 32 bit kernel because it is becoming an obsolete technology (or should I say it is an obsolete technology). Anyways...
I was reading about 64 bit kernels and how it is different than 32 bit ones, I came across this red-zone problem in System V 64 bit ABI. As far as I can see, people recommend -mno-red-zone flag while compiling kernels both in forums and in wiki.
But, it looks like you can specify alternative stack when using 64 bit version of IDT entries. You do this by filling IST bits of IDT entries with number 1 to 7. This number used as an index into Interrupt Stack Table (IST) which is located in 64 bit version of TSS.
I didn't actually try this yet, but it seems like a possible solution for interrupts trashing red-zone. Is there a reason why this is not often mentioned in forums or wiki? Was this overlooked, or simply recommended against. If so, what are the potential drawbacks of using IST with red-zone enabled.
Best Regards,