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

Function pdealloc

src/allocator/mod.rs:114–140  ·  view source on GitHub ↗

Deallocate pages

(address: u64, size: u64)

Source from the content-addressed store, hash-verified

112
113// Deallocate pages
114pub fn pdealloc(address: u64, size: u64)
115{
116 let mut mapper = unsafe
117 {
118 crate::mem::mapper(VirtAddr::new(crate::mem::PMEM_OFFSET))
119 };
120
121 let pages: PageRangeInclusive<Size4KiB> =
122 {
123 let spage = Page::containing_address(VirtAddr::new(address));
124 let epage = Page::containing_address(VirtAddr::new(address + size));
125
126 Page::range_inclusive(spage, epage)
127 };
128
129 for page in pages
130 {
131 if let Ok((_frame, mapping)) = mapper.unmap(page)
132 {
133 mapping.flush();
134 }
135 else
136 {
137 print!("[ERR] COULD NOT DEALLOCATE {:?}", page);
138 }
139 }
140}
141
142
143pub struct Dummy;

Callers

nothing calls this directly

Calls 2

mapperFunction · 0.85
flushMethod · 0.80

Tested by

no test coverage detected