-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement unimplemented content in aarch64.rs
- Loading branch information
Showing
2 changed files
with
77 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,54 @@ | ||
use crate::BIT; | ||
|
||
#[cfg(target_arch = "riscv64")] | ||
#[inline] | ||
pub fn clear_memory(ptr: *mut u8, bits: usize) { | ||
unsafe { | ||
core::slice::from_raw_parts_mut(ptr, BIT!(bits)).fill(0); | ||
} | ||
} | ||
|
||
// /* Cleaning memory before user-level access */ | ||
// static inline void clearMemory(word_t *ptr, word_t bits) | ||
// { | ||
// memzero(ptr, (1ul << (bits))); | ||
// cleanCacheRange_RAM((word_t)ptr, (word_t)ptr + (1ul << (bits)) - 1, | ||
// addrFromPPtr(ptr)); | ||
// } | ||
|
||
#[cfg(target_arch = "aarch64")] | ||
#[inline] | ||
pub fn clear_memory(ptr: *mut u8, bits: usize) { | ||
use sel4_vspace::{clean_cache_range_ram, pptr_to_paddr}; | ||
|
||
unsafe { | ||
core::slice::from_raw_parts_mut(ptr, BIT!(bits)).fill(0); | ||
clean_cache_range_ram( | ||
ptr as usize, | ||
ptr.add(BIT!(bits) - 1) as usize, | ||
pptr_to_paddr(ptr as usize), | ||
); | ||
} | ||
} | ||
|
||
// static inline void clearMemory_PT(word_t *ptr, word_t bits) | ||
// { | ||
// memzero(ptr, (1ul << (bits))); | ||
// cleanCacheRange_PoU((word_t)ptr, (word_t)ptr + (1ul << (bits)) - 1, | ||
// addrFromPPtr(ptr)); | ||
// } | ||
|
||
#[cfg(target_arch = "aarch64")] | ||
#[inline] | ||
pub fn clear_memory_pt(ptr: *mut u8, bits: usize) { | ||
use sel4_vspace::{clean_cache_range_pou, pptr_to_paddr}; | ||
|
||
unsafe { | ||
core::slice::from_raw_parts_mut(ptr, BIT!(bits)).fill(0); | ||
clean_cache_range_pou( | ||
ptr as usize, | ||
ptr.add(BIT!(bits) - 1) as usize, | ||
pptr_to_paddr(ptr as usize), | ||
); | ||
} | ||
} |