diff --git a/src/arch/x86_64/memory/mod.rs b/src/arch/x86_64/memory/mod.rs index 35e6853..e059ad9 100644 --- a/src/arch/x86_64/memory/mod.rs +++ b/src/arch/x86_64/memory/mod.rs @@ -30,6 +30,13 @@ impl Frame { fn start_address(&self) -> usize { self.index * PAGE_SIZE } + + /// Clones the Frame; we implement this instead of deriving Clone since deriving clone + /// makes `.clone()` public, which would be illogical here (frames should not be cloned by end-users, + /// as that could be used to cause, *e.g.*, double-free errors with the `FrameAllocator`). + fn clone(&self) -> Frame { + Frame { index: self.index } + } } /// A trait which can be implemented by any frame allocator, to make the frame allocation system