diff options
author | 2022-05-23 22:29:37 -0700 | |
---|---|---|
committer | 2022-06-03 23:22:24 -0700 | |
commit | 10092fdb0b92bd89e7d8c06176986f041e11f495 (patch) | |
tree | ad9d5e7250c9ebcfb332c26cfb534353a730fc90 /src | |
parent | 37e675852c42820443813dafba314a7f29447d70 (diff) | |
download | rust-x86-10092fdb0b92bd89e7d8c06176986f041e11f495.tar.gz rust-x86-10092fdb0b92bd89e7d8c06176986f041e11f495.tar.zst rust-x86-10092fdb0b92bd89e7d8c06176986f041e11f495.zip |
Added const constructor for x2APIC.
Diffstat (limited to 'src')
-rw-r--r-- | src/apic/x2apic.rs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/apic/x2apic.rs b/src/apic/x2apic.rs index 28d3a84..822edc1 100644 --- a/src/apic/x2apic.rs +++ b/src/apic/x2apic.rs @@ -11,24 +11,25 @@ use crate::msr::{ /// Represents an x2APIC driver instance. #[derive(Debug)] pub struct X2APIC { - /// Initial BASE msr register value. + /// Initial base msr register value. base: u64, } impl Default for X2APIC { fn default() -> Self { - unsafe { - X2APIC { - base: rdmsr(IA32_APIC_BASE), - } - } + X2APIC { base: 0x0 } } } impl X2APIC { /// Create a new x2APIC driver object for the local core. - pub fn new() -> X2APIC { - Default::default() + /// + /// # Notes + /// The object needs to be initialized by calling `attach()` first which + /// enables the x2APIC. There should be only one x2APIC object created per + /// core. + pub const fn new() -> Self { + X2APIC { base: 0x0 } } /// Attach to APIC (enable x2APIC mode, initialize LINT0) |