MCPcopy Index your code
hub / github.com/LibertyOS-Development/kernel / p_dealloc

Function p_dealloc

src/mem.rs:92–117  ·  view source on GitHub ↗

Deallocate pages

(address: u64, size: u64)

Source from the content-addressed store, hash-verified

90
91// Deallocate pages
92pub fn p_dealloc(address: u64, size: u64)
93{
94 let mut mapper = unsafe
95 {
96 crate::mem::mapper(VirtAddr::new(crate::mem::PMEM_OFFSET))
97 };
98
99 let pages: PageRangeInclusive<Size4KiB> =
100 {
101 let page_start = Page::containing_address(VirtAddr::new(address));
102 let page_end = Page::containing_address(VirtAddr::new(address + size));
103 Page::range_inclusive(page_start, page_end)
104 };
105
106 for page in pages
107 {
108 if let Ok((_frame, mapping)) = mapper.unmap(page)
109 {
110 mapping.flush();
111 }
112 else
113 {
114 unimplemented!();
115 }
116 }
117}
118
119
120// Physical-address to virtual-address

Callers 1

exitFunction · 0.85

Calls 2

mapperFunction · 0.85
flushMethod · 0.80

Tested by

no test coverage detected