mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
fix missing corner case in cache refill
This commit is contained in:
parent
5b00daba0d
commit
b7d5eca720
1 changed files with 22 additions and 20 deletions
|
|
@ -376,6 +376,7 @@ impl DictCacheEntry {
|
||||||
pub (crate) fn refill_small_key(&mut self, hw: &mut PddbOs, v2p_map: &HashMap::<VirtAddr, PhysPage>, cipher: &Aes256GcmSiv,
|
pub (crate) fn refill_small_key(&mut self, hw: &mut PddbOs, v2p_map: &HashMap::<VirtAddr, PhysPage>, cipher: &Aes256GcmSiv,
|
||||||
data_cache: &mut PlaintextCache, key_name: &str) {
|
data_cache: &mut PlaintextCache, key_name: &str) {
|
||||||
if let Some(kcache) = self.keys.get_mut(key_name) {
|
if let Some(kcache) = self.keys.get_mut(key_name) {
|
||||||
|
if kcache.flags.valid() { // invalid keys were previously deleted, and have nothing to fill
|
||||||
if let Some(pool_index) = small_storage_index_from_key(&kcache, self.index) {
|
if let Some(pool_index) = small_storage_index_from_key(&kcache, self.index) {
|
||||||
let ksp = &mut self.small_pool[pool_index];
|
let ksp = &mut self.small_pool[pool_index];
|
||||||
assert!(ksp.contents.contains(&key_name.to_string()), "refill called on a non-existent key. This is an illegal state.");
|
assert!(ksp.contents.contains(&key_name.to_string()), "refill called on a non-existent key. This is an illegal state.");
|
||||||
|
|
@ -398,6 +399,7 @@ impl DictCacheEntry {
|
||||||
log::error!("Key {}'s data region at pp: {:x?} va: {:x} is unreadable", key_name, data_cache.tag, kcache.start);
|
log::error!("Key {}'s data region at pp: {:x?} va: {:x} is unreadable", key_name, data_cache.tag, kcache.start);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
log::error!("refill_small_key() can only be called after the key cache entry has been allocated");
|
log::error!("refill_small_key() can only be called after the key cache entry has been allocated");
|
||||||
panic!("consistency error");
|
panic!("consistency error");
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue