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

xapic: Use non-static lifetime #151

Merged
merged 1 commit into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/apic/xapic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,14 @@ enum ApicRegister {

/// State for the XAPIC driver.
#[allow(clippy::clippy::upper_case_acronyms)]
pub struct XAPIC {
pub struct XAPIC<'a> {
/// Reference to the xAPCI region
mmio_region: &'static mut [u32],
mmio_region: &'a mut [u32],
/// Initial APIC Base register value.
base: u64,
}

impl fmt::Debug for XAPIC {
impl fmt::Debug for XAPIC<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("XAPIC")
.field("XAPIC_ID", &self.read(ApicRegister::XAPIC_ID))
Expand Down Expand Up @@ -262,12 +262,12 @@ impl fmt::Debug for XAPIC {
}
}

impl XAPIC {
impl XAPIC<'_> {
/// Create a new xAPIC object for the local CPU.
///
/// Pass the xAPCI region which is at XXX unless you have
/// relocated the region.
pub fn new(apic_region: &'static mut [u32]) -> XAPIC {
pub fn new<'a>(apic_region: &'a mut [u32]) -> XAPIC {
unsafe {
XAPIC {
mmio_region: apic_region,
Expand Down Expand Up @@ -315,7 +315,7 @@ impl XAPIC {
}
}

impl ApicControl for XAPIC {
impl ApicControl for XAPIC<'_> {
/// Is this the bootstrap core?
fn bsp(&self) -> bool {
(self.base & (1 << 8)) > 0
Expand Down
Loading