fix clean state bookkeeping on the basisroot cache record

This commit is contained in:
bunnie 2021-11-18 02:13:05 +08:00
parent a5da30de37
commit e1d00ef57c

View file

@ -555,6 +555,7 @@ impl BasisCacheEntry {
/// Syncs this cache entry to the hardware. /// Syncs this cache entry to the hardware.
pub(crate) fn basis_sync(&mut self, hw: &mut PddbOs) { pub(crate) fn basis_sync(&mut self, hw: &mut PddbOs) {
if !self.clean {
let basis_root = BasisRoot { let basis_root = BasisRoot {
magic: PDDB_MAGIC, magic: PDDB_MAGIC,
version: PDDB_VERSION, version: PDDB_VERSION,
@ -583,6 +584,8 @@ impl BasisCacheEntry {
} }
).unwrap(); ).unwrap();
hw.patch_data(&[nonce.as_slice(), &ciphertext].concat(), pp.page_number() * PAGE_SIZE as u32); hw.patch_data(&[nonce.as_slice(), &ciphertext].concat(), pp.page_number() * PAGE_SIZE as u32);
self.clean = true;
}
} }
} }