mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 22:37:49 +00:00
Add clone methods to Page(public) and Frame(private)
This commit is contained in:
@@ -29,6 +29,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 {
|
||||||
|
|||||||
@@ -20,6 +20,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