Add ability to get more storage information. (#637)
This adds parameters to the storage location syscalls to specify which storage location to get the address and size for.
This commit is contained in:
8
src/env/tock/storage.rs
vendored
8
src/env/tock/storage.rs
vendored
@@ -87,8 +87,8 @@ impl<S: Syscalls, C: platform::subscribe::Config + platform::allow_ro::Config> T
|
|||||||
if !matches!(storage_type, StorageType::Store) {
|
if !matches!(storage_type, StorageType::Store) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
let storage_ptr = to_storage_result(LibtockStorage::<S, C>::storage_ptr())?;
|
let storage_ptr = to_storage_result(LibtockStorage::<S, C>::storage_ptr(i))?;
|
||||||
let storage_len = to_storage_result(LibtockStorage::<S, C>::storage_len())?;
|
let storage_len = to_storage_result(LibtockStorage::<S, C>::storage_len(i))?;
|
||||||
if !syscall.is_page_aligned(storage_ptr) || !syscall.is_page_aligned(storage_len) {
|
if !syscall.is_page_aligned(storage_ptr) || !syscall.is_page_aligned(storage_len) {
|
||||||
return Err(StorageError::CustomError);
|
return Err(StorageError::CustomError);
|
||||||
}
|
}
|
||||||
@@ -210,8 +210,8 @@ where
|
|||||||
if !matches!(storage_type, StorageType::Partition) {
|
if !matches!(storage_type, StorageType::Partition) {
|
||||||
continue;
|
continue;
|
||||||
};
|
};
|
||||||
let storage_ptr = to_storage_result(LibtockStorage::<S, C>::storage_ptr())?;
|
let storage_ptr = to_storage_result(LibtockStorage::<S, C>::storage_ptr(i))?;
|
||||||
let storage_len = to_storage_result(LibtockStorage::<S, C>::storage_len())?;
|
let storage_len = to_storage_result(LibtockStorage::<S, C>::storage_len(i))?;
|
||||||
if !locations.is_page_aligned(storage_ptr) || !locations.is_page_aligned(storage_len) {
|
if !locations.is_page_aligned(storage_ptr) || !locations.is_page_aligned(storage_len) {
|
||||||
return Err(StorageError::CustomError);
|
return Err(StorageError::CustomError);
|
||||||
}
|
}
|
||||||
|
|||||||
8
third_party/libtock-drivers/src/storage.rs
vendored
8
third_party/libtock-drivers/src/storage.rs
vendored
@@ -147,12 +147,12 @@ impl<S: Syscalls, C: platform::subscribe::Config + platform::allow_ro::Config> S
|
|||||||
Ok(Self::memop(memop_nr::STORAGE_CNT, 0)? as usize)
|
Ok(Self::memop(memop_nr::STORAGE_CNT, 0)? as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn storage_ptr() -> TockResult<usize> {
|
pub fn storage_ptr(index: usize) -> TockResult<usize> {
|
||||||
Ok(Self::memop(memop_nr::STORAGE_PTR, 0)? as usize)
|
Ok(Self::memop(memop_nr::STORAGE_PTR, index as u32)? as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn storage_len() -> TockResult<usize> {
|
pub fn storage_len(index: usize) -> TockResult<usize> {
|
||||||
Ok(Self::memop(memop_nr::STORAGE_LEN, 0)? as usize)
|
Ok(Self::memop(memop_nr::STORAGE_LEN, index as u32)? as usize)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn storage_type(index: usize) -> TockResult<StorageType> {
|
pub fn storage_type(index: usize) -> TockResult<StorageType> {
|
||||||
|
|||||||
Reference in New Issue
Block a user