Skip to content

Commit

Permalink
WIP: use aarch64_cpu
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Maslowski <[email protected]>
  • Loading branch information
orangecms committed Oct 23, 2024
1 parent 6a6a15f commit 76e70fc
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions aarch64/src/registers.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![allow(non_upper_case_globals)]

use aarch64_cpu::registers::{Readable, Writeable};
use aarch64_cpu::{asm, registers};
use aarch64_cpu::{asm, registers::MIDR_EL1};
use bitstruct::bitstruct;
use core::fmt;
use num_enum::TryFromPrimitive;
Expand Down Expand Up @@ -48,20 +48,7 @@ bitstruct! {

impl MidrEl1 {
pub fn read() -> Self {
#[cfg(not(test))]
{
if true {
let mut value: u64;
unsafe {
core::arch::asm!("mrs {value}, midr_el1", value = out(reg) value);
}
Self(value)
} else {
Self(registers::MIDR_EL1.extract().into())
}
}
#[cfg(test)]
Self(0)
Self(if cfg!(test) { 0 } else { MIDR_EL1.extract().into() })
}

pub fn partnum_enum(&self) -> Result<PartNum, u16> {
Expand Down

0 comments on commit 76e70fc

Please sign in to comment.