Recently, I have stumbled upon an article explaining how to implement fibers in C (https://graphitemaster.github.io/fibers/). The article was eye-opening, as it showed that any contiguous memory region can be used as a call stack in place of the operating system provided one. This is really useful, and I would like to explore the possibilities.
However, the article also talks about the so called "Red Zone" as a requirement for a valid stack, i.e. the 128 bytes of stack space after (below) rsp must never be modified. This makes me think there are other obscure requirements for a valid stack that I know nothing about, so before diving in I thought about asking here if anybody knows of any such pitfalls that I may have overlooked. For example, can I store the stack on the heap, or does the OS not play nice with it? Any such tips are welcome.
I am interested specifically for the Windows operating system and the Intel x64 architecture, but I would also like to know if the requirements can be made "cross platform", as in, if I can use the lowest common denominator for all major platforms so I can get away with only one fiber implementation.
Thanks for any tips!