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

WIP: Use global system table pointer #905

Closed

Conversation

nicholasbishop
Copy link
Member

@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
Member 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
Member 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 nicholasbishop force-pushed the bishop-global-tables-2 branch 2 times, most recently from 515a508 to 19db510 Compare May 2, 2024 03:49
@nicholasbishop
Copy link
Member 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

This will allow some code to be shared with the upcoming `uefi::boot` module.
The initial version here just provides functions for getting and setting the
system time. Later commits will add functions to get/set variables, handle
update capsules, etc.

Also added some tests for the new code in the test runner (note that there were
no existing tests for the time-related functions of `RuntimeServices`).
@nicholasbishop nicholasbishop changed the title Extremely WIP, just for discussion: Add global system table pointer WIP: Use global system table pointer Jul 19, 2024
@phip1611
Copy link
Contributor

phip1611 commented Aug 1, 2024

Is there any reason to keep this MR open, @nicholasbishop ?

@nicholasbishop
Copy link
Member Author

Nope, at this point it has served its purpose.

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