I doubt it can be done portably, but are there any solutions out there? I think it could be done by creating an alternate stack and reseting SP,BP, and IP on function entry
A new library, Boost.Context, was released today with portable features for implementing coroutines.