Skip to content

Commit

Permalink
add write_pcid_no_flush
Browse files Browse the repository at this point in the history
  • Loading branch information
Freax13 committed Mar 18, 2024
1 parent b1780e1 commit 472d863
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/registers/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,21 @@ mod x86_64 {
}
}

/// Write a new P4 table address into the CR3 register without flushing existing TLB entries for
/// the PCID.
///
/// ## Safety
///
/// Changing the level 4 page table is unsafe, because it's possible to violate memory safety by
/// changing the page mapping.
/// [`Cr4Flags::PCID`] must be set before calling this method.
#[inline]
pub unsafe fn write_pcid_no_flush(frame: PhysFrame, pcid: Pcid) {
unsafe {
Cr3::write_raw_impl(true, frame, pcid.value());
}
}

/// Write a new P4 table address into the CR3 register.
///
/// ## Safety
Expand Down

0 comments on commit 472d863

Please sign in to comment.