Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a boost.context call/cc backend #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

Akaricchi
Copy link
Member

@Akaricchi Akaricchi commented Sep 16, 2023

This is a backend that uses the high-level call/cc C++ API from boost.context. This should in theory support CET (shadow stacks). It's an attempt to address #6 until CET support is added to other backends, though in retrospect just doing that would've probably been easier. But the more backends the merrier, right?

Seems to work ok for the most part on my machine, but has some issues:

  • C++ exceptions are required; it's an implementation detail of the API.
  • Taisei crashes on exit, probably from a bogus stack unwind forced in a continuation destructor somewhere. This happens pretty late in the shutdown sequence, so the game still saves the config and progress files.
  • Performance is slightly behind pure fcontext, but not significantly.
  • Switches from one coroutine (i.e. non-main) context into another are implemented by a stupid trampoline jump from the main context. This is the only way I found to pass the new resume-from-another test (required for Taisei to work), but it's clearly a suboptimal solution.
  • Not tested with threads at all. Doesn't matter for Taisei.
  • ASan and valgrind aren't supported yet, but that should be easy enough to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant