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

Extremely WIP, just for discussion: Add global system table pointer #905

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

nicholasbishop
Copy link
Contributor

@nicholasbishop nicholasbishop commented Jul 29, 2023

For #893

Checklist

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

@phip1611
Copy link
Contributor

I'm wondering what's the right way forward here.

  1. Close Exploration on implementation of RFC #893. #980
  2. Undraft this?


/// TODO
pub unsafe fn set_system_table(system_table: *mut uefi_raw::table::system::SystemTable) {
SYSTEM_TABLE.store(system_table, Ordering::Release);
Copy link
Contributor

@phip1611 phip1611 Apr 23, 2024

Choose a reason for hiding this comment

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

nit: This should use a Once-like type in the background. It should not be possible to set this multiple times.

I think something like AtomicOnce<uefi_raw::table::system::SystemTable> would be cool. Same for image handle.

/// Return the firmware vendor string
#[must_use]
pub fn firmware_vendor() -> &'static CStr16 {
unsafe { CStr16::from_ptr(system_table().as_mut().firmware_vendor.cast()) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you decide to use functions here and not a new type having associated functions/methods?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I left some notes here: #893 (comment)

Since there's no longer any struct or lifetime involved, I think these functions are similar to https://doc.rust-lang.org/std/env/#functions; no point attaching them to an empty struct.

@nicholasbishop
Copy link
Contributor Author

Once I find a spare bit of time I'll re-familiarize myself with the content of this PR, make some updates, and remove the draft marker.

@nicholasbishop
Copy link
Contributor Author

I realized I was probably trying to do too much in one PR, so I've opened a simpler one to start things off: #1156

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.

None yet

2 participants