Skip to content

improve uefi support #2944

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

Merged
merged 12 commits into from
Sep 13, 2019
Merged

improve uefi support #2944

merged 12 commits into from
Sep 13, 2019

Conversation

nrdmn
Copy link
Contributor

@nrdmn nrdmn commented Jul 25, 2019

This PR improves support for uefi. Structure definitions taken from the specification and slightly adapted.

Before continuing work on standard library support for UEFI, I'd like to discuss this in an issue. Related discussion in #2967

@nrdmn nrdmn changed the title WIP: improve uefi support improve uefi support Jul 28, 2019
@nrdmn nrdmn force-pushed the uefi branch 2 times, most recently from 3824822 to 1fcadee Compare August 2, 2019 03:39
Copy link
Contributor

@daurnimator daurnimator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like great work. Are you getting all these structure definitions straight from the specification? Or are you working from another implementation?
Could you link to whatever you're using for source material so that we know what to refer back to in future?

@nrdmn
Copy link
Contributor Author

nrdmn commented Aug 2, 2019

I'm taking the structure definitions directly from the specification. I change types only where the specification is inconsistent (e.g. the same value specified as signed and unsigned in different places) or where Zig offers more appropriate alternatives (e.g. [*]u8 instead of *u8 for strings).

I'll upload a few demo apps that I am testing the code with later.

@nrdmn nrdmn force-pushed the uefi branch 2 times, most recently from d62707d to c3525c3 Compare August 4, 2019 16:50
@nrdmn
Copy link
Contributor Author

nrdmn commented Aug 8, 2019

Most UEFI functions return the same type of error codes (same size, same semantics), see std/os/uefi/status.zig or Appendix D of the specification. I'd like to use extern error(usize) instead of usize as soon as this is possible. There may be OEM defined error codes though, I'm not sure if the error type supports values that have not been declared.

@andrewrk andrewrk added this to the 0.5.0 milestone Aug 19, 2019
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work. I'm sorry I didn't merge this earlier

@@ -155,8 +155,7 @@ pub fn abort() noreturn {
system.abort();
}
if (builtin.os == .uefi) {
// TODO there must be a better thing to do here than loop forever
while (true) {}
exit(0); // TODO choose appropriate exit code
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we at least exit with non-zero status?

@andrewrk andrewrk closed this in 187a6d1 Sep 13, 2019
@andrewrk andrewrk merged commit 5e874a8 into ziglang:master Sep 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants