MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / alloc

Method alloc

os/src/mm/frame_allocator.rs:62–71  ·  view source on GitHub ↗
(&mut self)

Source from the content-addressed store, hash-verified

60 }
61 }
62 fn alloc(&mut self) -> Option<PhysPageNum> {
63 if let Some(ppn) = self.recycled.pop() {
64 Some(ppn.into())
65 } else if self.current == self.end {
66 None
67 } else {
68 self.current += 1;
69 Some((self.current - 1).into())
70 }
71 }
72 fn dealloc(&mut self, ppn: PhysPageNum) {
73 let ppn = ppn.0;
74 // validity check

Callers 1

frame_allocFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected