Skip to content
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

Add basic API for a global system table #1156

Merged
merged 4 commits into from
May 23, 2024

Conversation

nicholasbishop
Copy link
Member

This is a much simpler version than #905. Just the bare minimum: add functions to set and get the global system table, set the global system table in the entry macro, and also make exit_boot_services unsafe.

(I would still like to go in the direction of #905, but I think we should move a little incrementally so that we have a better chance of catching mistakes along the way.)

#893

Checklist

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

uefi/src/table/mod.rs Outdated Show resolved Hide resolved
uefi/src/table/mod.rs Outdated Show resolved Hide resolved
This is a minimal solution to providing a global system table so that users of
the API don't have to pass around references to `SystemTable` / `BootServices` /
`RuntimeServices` everywhere.
This method was already unsafe in practice, since it's very hard to statically
ensure that no references to boot-services data exist. Change the signature to
acknowledge that reality, and update the docstring with details.
@phip1611
Copy link
Contributor

Sorry for not giving the final review sooner.

// SAFETY: the system table is valid per the requirements of `set_system_table`.
unsafe {
if (*st).runtime_services.is_null() {
panic!("runtime services are not active");
Copy link
Contributor

Choose a reason for hiding this comment

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

strictly speaking, they are also active, but not exclusively, right?

@phip1611 phip1611 added this pull request to the merge queue May 23, 2024
Merged via the queue into rust-osdev:main with commit 887cd56 May 23, 2024
12 checks passed
@phip1611
Copy link
Contributor

phip1611 commented May 23, 2024

As this is the begin of a larger refactoring: Would it make sense to make a plan on what is actually needed - or what the vision is? Do we want to track things in a ..milestone, github project board or so? @nicholasbishop

@nicholasbishop nicholasbishop deleted the bishop-global-tables-simple branch May 28, 2024 03:20
@nicholasbishop
Copy link
Member Author

Writing up more of a plan is a good idea, I will add it to #893

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