Skip to content

uefi-services: Change SYSTEM_TABLE to an atomic pointer #977

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 3 commits into from
Oct 27, 2023

Conversation

nicholasbishop
Copy link
Member

This aligns with how the std uefi target works:
https://github.com/rust-lang/rust/blob/f654229c27267334023a22233795b88b75fc340e/library/std/src/os/uefi/env.rs#L8

And also avoids some unsafe; a static atomic be written without being static mut, and reads and writes are safe operations.

Also includes some related cleanups in uefi-services, and the addition of SystemTable::as_ptr.

Checklist

  • Sensible git history (for example, squash "typo" or "fix" commits). See the Rewriting History guide for help.
  • Update the changelog (if necessary)

Add `system_table_opt` as the only direct read of `SYSTEM_TABLE`. Replace reads
of the global with either `system_table_opt` or `system_table`.
This aligns with how the std uefi target works:
https://github.com/rust-lang/rust/blob/f654229c27267334023a22233795b88b75fc340e/library/std/src/os/uefi/env.rs#L8

And also avoids some unsafe; a static atomic be written without being `static
mut`, and reads and writes are safe operations.
@phip1611 phip1611 added this pull request to the merge queue Oct 27, 2023
Merged via the queue into rust-osdev:main with commit 47635fe Oct 27, 2023
@nicholasbishop nicholasbishop deleted the bishop-atomic-system-table branch October 27, 2023 15:32
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.

2 participants