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

Make foreign calls work outside of task context #4451

Closed
brson opened this issue Jan 12, 2013 · 1 comment
Closed

Make foreign calls work outside of task context #4451

brson opened this issue Jan 12, 2013 · 1 comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows

Comments

@brson
Copy link
Contributor

brson commented Jan 12, 2013

Part of #4419

To write Rust code that doesn't need access to the task pointer we need to be able to make C calls without switching stacks. For limited, specific cases #[rust_stack] can do this, but this isn't a general solution because it ultimately requires dividing the entire library into code that works inside tasks and code that doesn't.

Instead I intend to put a condition into upcall_call_on_rust_stack and upcall_call_on_c_stack that calls the foreign function directly if there is no task available. The immediate use of this will be for making the exchange heap allocator work without access to the kernel.

The unfortunate part is that we will lose some very useful assertions on the stack switching path. It will also be easier to write code without considering what context you are in, which is both good and bad.

brson added a commit to brson/rust that referenced this issue Jan 12, 2013
brson added a commit to brson/rust that referenced this issue Feb 2, 2013
brson added a commit to brson/rust that referenced this issue Feb 6, 2013
@brson
Copy link
Contributor Author

brson commented Mar 9, 2013

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-runtime Area: std's runtime and "pre-main" init for handling backtraces, unwinds, stack overflows
Projects
None yet
Development

No branches or pull requests

1 participant