Description
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.