I heard of a scheme by Henry Baker a year or so ago that and I thought then that the scheme did not apply to this problem. Perhaps it does however.
Baker’s scheme, by word of mouth, would be a collection of C routines linked together but of these sorts:
An alternative is to find a compiler that is guaranteed to do tail call optimization and insure that all special routines finish by calling another special routine only just before returning itself. This causes the special routine to undo its frame as it finishes.
In either case both special and ordinary routines can call ordinary routines. This means that faults in the stack segment cannot be taken as a signal to clean the stack. There is in general and often a few vital frames at the recent end of the stack.