Browse Source

memory: private "cloning" of Frames

master
3moon 8 years ago
parent
commit
ec45a5e981
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      src/arch/x86_64/memory/mod.rs

+ 7
- 0
src/arch/x86_64/memory/mod.rs View File

@ -30,6 +30,13 @@ impl Frame {
fn start_address(&self) -> usize { fn start_address(&self) -> usize {
self.index * PAGE_SIZE 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 /// A trait which can be implemented by any frame allocator, to make the frame allocation system


Loading…
Cancel
Save