mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Derive Copy and Clone for Page and add a Frame::clone method
This commit is contained in:
@@ -19,6 +19,10 @@ impl Frame {
|
|||||||
fn start_address(&self) -> PhysicalAddress {
|
fn start_address(&self) -> PhysicalAddress {
|
||||||
self.number * PAGE_SIZE
|
self.number * PAGE_SIZE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn clone(&self) -> Frame {
|
||||||
|
Frame { number: self.number }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait FrameAllocator {
|
pub trait FrameAllocator {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const ENTRY_COUNT: usize = 512;
|
|||||||
pub type PhysicalAddress = usize;
|
pub type PhysicalAddress = usize;
|
||||||
pub type VirtualAddress = usize;
|
pub type VirtualAddress = usize;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub struct Page {
|
pub struct Page {
|
||||||
number: usize,
|
number: usize,
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user