|
|
@ -1,9 +1,8 @@
|
|
|
|
use core::ops::{Add, AddAssign};
|
|
|
|
use core::ops::{Add, AddAssign};
|
|
|
|
use super::paging::*;
|
|
|
|
|
|
|
|
use super::memory_set::*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub type VirtAddr = usize;
|
|
|
|
pub type VirtAddr = usize;
|
|
|
|
pub type PhysAddr = usize;
|
|
|
|
pub type PhysAddr = usize;
|
|
|
|
|
|
|
|
|
|
|
|
pub const PAGE_SIZE: usize = 1 << 12;
|
|
|
|
pub const PAGE_SIZE: usize = 1 << 12;
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
|
|
@ -81,9 +80,12 @@ impl Iterator for PageRange {
|
|
|
|
#[derive(Debug, Copy, Clone, PartialOrd, Ord)]
|
|
|
|
#[derive(Debug, Copy, Clone, PartialOrd, Ord)]
|
|
|
|
#[repr(C)]
|
|
|
|
#[repr(C)]
|
|
|
|
pub struct Frame {
|
|
|
|
pub struct Frame {
|
|
|
|
page_table: usize, // the raw pointer for the frame's memory set's inactive page table
|
|
|
|
/// the raw pointer for the frame's memory set's inactive page table
|
|
|
|
virtaddr: VirtAddr, // the virtual addr for the frame
|
|
|
|
page_table: usize,
|
|
|
|
token: usize, // the token for frame
|
|
|
|
/// the virtual addr for the frame
|
|
|
|
|
|
|
|
virtaddr: VirtAddr,
|
|
|
|
|
|
|
|
/// the token for frame
|
|
|
|
|
|
|
|
token: usize,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Frame {
|
|
|
|
impl Frame {
|
|
|
@ -114,6 +116,4 @@ impl PartialEq for Frame{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl Eq for Frame{
|
|
|
|
impl Eq for Frame {}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|