mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-18 12:06:43 +00:00
No need to flush TLB on mapping without overwritting
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
5df3c9b749
commit
addf42c3f8
@ -350,13 +350,14 @@ impl CursorMut<'_, '_> {
|
|||||||
/// This method will bring the cursor to the next slot after the modification.
|
/// This method will bring the cursor to the next slot after the modification.
|
||||||
pub fn map(&mut self, frame: Frame, prop: PageProperty) {
|
pub fn map(&mut self, frame: Frame, prop: PageProperty) {
|
||||||
let start_va = self.virt_addr();
|
let start_va = self.virt_addr();
|
||||||
let end_va = start_va + frame.size();
|
|
||||||
// SAFETY: It is safe to map untyped memory into the userspace.
|
// SAFETY: It is safe to map untyped memory into the userspace.
|
||||||
let old = unsafe { self.pt_cursor.map(frame.into(), prop) };
|
let old = unsafe { self.pt_cursor.map(frame.into(), prop) };
|
||||||
|
|
||||||
self.issue_tlb_flush(TlbFlushOp::Range(start_va..end_va), old);
|
if old.is_some() {
|
||||||
|
self.issue_tlb_flush(TlbFlushOp::Address(start_va), old);
|
||||||
self.dispatch_tlb_flush();
|
self.dispatch_tlb_flush();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Clear the mapping starting from the current slot.
|
/// Clear the mapping starting from the current slot.
|
||||||
///
|
///
|
||||||
|
Reference in New Issue
Block a user