diff options
-rw-r--r-- | CHANGELOG.md | 14 | ||||
-rw-r--r-- | src/apic/x2apic.rs | 17 |
2 files changed, 23 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..af5cdc1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [unreleased] + +## [0.48.0] - 2022-05-23 + +- Added `const new` constructor for X2APIC struct +- Use fully qualified `asm!` import for `int!` macro so clients do no longer + need to import `asm!` themselves. 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) |