MCPcopy Create free account
hub / github.com/JGiraldo29/vekos / decrease_page_ref_count

Method decrease_page_ref_count

src/memory.rs:1049–1063  ·  view source on GitHub ↗
(&mut self, frame: PhysFrame)

Source from the content-addressed store, hash-verified

1047 }
1048
1049 pub fn decrease_page_ref_count(&mut self, frame: PhysFrame) -> Result<(), MemoryError> {
1050 let mut ref_counts = PAGE_REF_COUNTS.lock();
1051 if let Some(ref_count) = ref_counts.get_mut(&frame.start_address()) {
1052 ref_count.count = ref_count.count.saturating_sub(1);
1053 if ref_count.count == 0 {
1054 ref_counts.remove(&frame.start_address());
1055 unsafe {
1056 self.frame_allocator.deallocate_frame(frame);
1057 }
1058 }
1059 Ok(())
1060 } else {
1061 Err(MemoryError::InvalidAddress)
1062 }
1063 }
1064
1065 pub fn map_heap_region(
1066 &mut self,

Callers 1

handle_cow_faultMethod · 0.80

Calls 4

get_mutMethod · 0.80
removeMethod · 0.80
deallocate_frameMethod · 0.80
lockMethod · 0.45

Tested by

no test coverage detected