Skip to content

Commit 28f9511

Browse files
committed
use mutable references in InvlpgbFlushBuilder
This works for all methods except `pages` which changes the type.
1 parent ee10753 commit 28f9511

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/instructions/tlb.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ where
247247
/// # Safety
248248
///
249249
/// The caller has to ensure that PCID is enabled in CR4 when the flush is executed.
250-
pub unsafe fn pcid(mut self, pcid: Pcid) -> Self {
250+
pub unsafe fn pcid(&mut self, pcid: Pcid) -> &mut Self {
251251
self.pcid = Some(pcid);
252252
self
253253
}
@@ -258,7 +258,7 @@ where
258258
///
259259
/// The caller has to ensure that SVM is enabled in EFER when the flush is executed.
260260
// FIXME: Make ASID a type and remove error type.
261-
pub unsafe fn asid(mut self, asid: u16) -> Result<Self, AsidOutOfRangeError> {
261+
pub unsafe fn asid(&mut self, asid: u16) -> Result<&mut Self, AsidOutOfRangeError> {
262262
if u32::from(asid) > self.invlpgb.nasid {
263263
return Err(AsidOutOfRangeError {
264264
asid,
@@ -271,13 +271,13 @@ where
271271
}
272272

273273
/// Also flush global pages.
274-
pub fn include_global(mut self) -> Self {
274+
pub fn include_global(&mut self) -> &mut Self {
275275
self.include_global = true;
276276
self
277277
}
278278

279279
/// Only flush the final translation and not the cached upper level TLB entries.
280-
pub fn final_translation_only(mut self) -> Self {
280+
pub fn final_translation_only(&mut self) -> &mut Self {
281281
self.final_translation_only = true;
282282
self
283283
}
@@ -294,7 +294,7 @@ where
294294
}
295295

296296
/// Execute the flush.
297-
pub fn flush(self) {
297+
pub fn flush(&self) {
298298
if let Some(mut pages) = self.page_range {
299299
while !pages.is_empty() {
300300
// Calculate out how many pages we still need to flush.

0 commit comments

Comments
 (0)