diff --git a/src/acpi/hpet.rs b/src/acpi/hpet.rs index b1cafb5d986b575539a5f210428a2441e2ce3c74..a2546b8e3718152d8dbae0773a04fa81033cb638 100644 --- a/src/acpi/hpet.rs +++ b/src/acpi/hpet.rs @@ -1,6 +1,6 @@ use core::{mem, ptr}; -use core::intrinsics::{volatile_load, volatile_store}; +use core::ptr::{read_volatile, write_volatile}; use crate::memory::Frame; use crate::paging::{KernelMapper, PhysicalAddress, PageFlags}; @@ -82,11 +82,11 @@ impl GenericAddressStructure { } pub unsafe fn read_u64(&self, offset: usize) -> u64{ - volatile_load((crate::HPET_OFFSET + offset) as *const u64) + read_volatile((crate::HPET_OFFSET + offset) as *const u64) } pub unsafe fn write_u64(&mut self, offset: usize, value: u64) { - volatile_store((crate::HPET_OFFSET + offset) as *mut u64, value); + write_volatile((crate::HPET_OFFSET + offset) as *mut u64, value); } } @@ -103,10 +103,10 @@ impl GenericAddressStructure { } pub unsafe fn read_u64(&self, offset: usize) -> u64{ - volatile_load((self.address as usize + offset + crate::PHYS_OFFSET) as *const u64) + read_volatile((self.address as usize + offset + crate::PHYS_OFFSET) as *const u64) } pub unsafe fn write_u64(&mut self, offset: usize, value: u64) { - volatile_store((self.address as usize + offset + crate::PHYS_OFFSET) as *mut u64, value); + write_volatile((self.address as usize + offset + crate::PHYS_OFFSET) as *mut u64, value); } } diff --git a/src/arch/aarch64/device/gic.rs b/src/arch/aarch64/device/gic.rs index 20a6f117286c7cf80923bb71a3a963b7ff122e39..04a383cd3aba3561be61953f8ad98d42f0f2f70f 100644 --- a/src/arch/aarch64/device/gic.rs +++ b/src/arch/aarch64/device/gic.rs @@ -1,4 +1,4 @@ -use core::intrinsics::{volatile_load, volatile_store}; +use core::ptr::{read_volatile, write_volatile}; use crate::memory::Frame; use crate::paging::{KernelMapper, PhysicalAddress, Page, PageFlags, TableKind, VirtualAddress}; @@ -149,12 +149,12 @@ impl GicDistIf { } unsafe fn read(&self, reg: u32) -> u32 { - let val = volatile_load((self.address + reg as usize) as *const u32); + let val = read_volatile((self.address + reg as usize) as *const u32); val } unsafe fn write(&mut self, reg: u32, value: u32) { - volatile_store((self.address + reg as usize) as *mut u32, value); + write_volatile((self.address + reg as usize) as *mut u32, value); } } @@ -179,11 +179,11 @@ impl GicCpuIf { } unsafe fn read(&self, reg: u32) -> u32 { - let val = volatile_load((self.address + reg as usize) as *const u32); + let val = read_volatile((self.address + reg as usize) as *const u32); val } unsafe fn write(&mut self, reg: u32, value: u32) { - volatile_store((self.address + reg as usize) as *mut u32, value); + write_volatile((self.address + reg as usize) as *mut u32, value); } } diff --git a/src/arch/aarch64/device/rtc.rs b/src/arch/aarch64/device/rtc.rs index d7aaa9ab3bfdf2fda279862883fc3982689d329c..b47d7bf735514d5e0aa34ee14fa4d271786d734d 100644 --- a/src/arch/aarch64/device/rtc.rs +++ b/src/arch/aarch64/device/rtc.rs @@ -1,4 +1,4 @@ -use core::intrinsics::{volatile_load, volatile_store}; +use core::ptr::{read_volatile, write_volatile}; use crate::memory::Frame; use crate::paging::{KernelMapper, PhysicalAddress, Page, PageFlags, TableKind, VirtualAddress}; @@ -47,12 +47,12 @@ impl Pl031rtc { } unsafe fn read(&self, reg: u32) -> u32 { - let val = volatile_load((self.address + reg as usize) as *const u32); + let val = read_volatile((self.address + reg as usize) as *const u32); val } unsafe fn write(&mut self, reg: u32, value: u32) { - volatile_store((self.address + reg as usize) as *mut u32, value); + write_volatile((self.address + reg as usize) as *mut u32, value); } pub fn time(&mut self) -> u64 { diff --git a/src/arch/x86/device/local_apic.rs b/src/arch/x86/device/local_apic.rs index 9ad4f575e5be457e455d71b2be6f70158c6cc815..04654722fa132fab9f5f207816a29778fb8f9a72 100644 --- a/src/arch/x86/device/local_apic.rs +++ b/src/arch/x86/device/local_apic.rs @@ -1,5 +1,5 @@ use core::sync::atomic::{self, AtomicU32}; -use core::intrinsics::{volatile_load, volatile_store}; +use core::ptr::{read_volatile, write_volatile}; use x86::msr::*; use crate::paging::{KernelMapper, PhysicalAddress, PageFlags, RmmA, RmmArch, VirtualAddress}; @@ -84,11 +84,11 @@ impl LocalApic { } unsafe fn read(&self, reg: u32) -> u32 { - volatile_load((self.address + reg as usize) as *const u32) + read_volatile((self.address + reg as usize) as *const u32) } unsafe fn write(&mut self, reg: u32, value: u32) { - volatile_store((self.address + reg as usize) as *mut u32, value); + write_volatile((self.address + reg as usize) as *mut u32, value); } pub fn id(&self) -> u32 { diff --git a/src/arch/x86_64/device/local_apic.rs b/src/arch/x86_64/device/local_apic.rs index fe181731b6976fefdbb87894dacb71d2ebed3fc1..5b3b23ae4fc38a315b3454ca38b5bb645c7cc8dc 100644 --- a/src/arch/x86_64/device/local_apic.rs +++ b/src/arch/x86_64/device/local_apic.rs @@ -1,5 +1,5 @@ use core::sync::atomic::{self, AtomicU64}; -use core::intrinsics::{volatile_load, volatile_store}; +use core::ptr::{read_volatile, write_volatile}; use x86::msr::*; use crate::paging::{KernelMapper, PhysicalAddress, PageFlags, RmmA, RmmArch}; @@ -84,11 +84,11 @@ impl LocalApic { } unsafe fn read(&self, reg: u32) -> u32 { - volatile_load((self.address + reg as usize) as *const u32) + read_volatile((self.address + reg as usize) as *const u32) } unsafe fn write(&mut self, reg: u32, value: u32) { - volatile_store((self.address + reg as usize) as *mut u32, value); + write_volatile((self.address + reg as usize) as *mut u32, value); } pub fn id(&self) -> u32 {