-
Notifications
You must be signed in to change notification settings - Fork 159
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
[un]install_multiple_protocol_interfaces()
requires but is currently incompatible with feature c_variadic
#302
Comments
Update: Per Josh Triplett on the rustlang zulip, |
@timrobertsdev does this mean we should replace all |
The way I understood it, since we're targeting EFI, |
@timrobertsdev Ah, I've realized there's a little problem which stops us from switching everything over to The reason we've introduced the I'm not sure what the correct solution would be here. |
Perhaps the |
@nicholasbishop That sounds like a good solution to me. Would an ELF binary be capable of calling these functions (or any boot service functions, I guess)? I had assumed that boot services would be exited by the time a kernel is running. |
Fair point, I think Linux at least exits boot services quite early in the EFI stub. |
That's the issue... we can't really guarantee this. It's what a logical, sane UEFI-based application/kernel would do: first load an ELF binary, then exist boot services and jump into it. But if we want to be pedantic and respect Rust's safety guarantees in all cases, something with a |
Quick update here, on current nightly it looks like this is now possible to use (Also, as far as I can tell, |
Just chiming in here to say that getting the calling convention right isn't your only concern if you want to (correctly) support cross ABI calls. If any structs are involved you have to make sure that they are laid out correctly according to the EFI ABI. This will cause loaded image protocol (in particular) to have a bad memory layout if the uefi-rs definition were used in ELF ABI context. Whether that is a use-case you want to support or not is a different matter. |
At least with the |
Tracking issue
While implementing the missing protocol handler functions in
BootServices
, I found thatextern "efiapi"
is incompatible with Rust's current (unstable) implementation of c variadics. Rustc indicates that C variadics must beextern "C"
orextern "cdecl"
, thusinstall_multiple_protocol_interfaces()
anduninstall_multiple_protocol_interfaces()
cannot be implemented at this time.I'll bring this up on the C variadic tracking issue in the next couple days if it hasn't been already.
Rust tracking issue: rust-lang/rust#44930
EDIT: technically I guess this could be possible with some clever and wildly unsafe asm but I'd much rather wait for Rust to support it.
The text was updated successfully, but these errors were encountered: