Skip to content

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

Merged
phip1611 merged 3 commits into
rust-osdev:mainfrom
nicholasbishop:bishop-atomic-system-table
Oct 27, 2023
Merged

uefi-services: Change SYSTEM_TABLE to an atomic pointer#977
phip1611 merged 3 commits into
rust-osdev:mainfrom
nicholasbishop:bishop-atomic-system-table

Conversation

@nicholasbishop

Copy link
Copy Markdown
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