Seal the kernel page table

This commit is contained in:
Zhang Junyang 2025-12-06 22:13:41 +08:00 committed by Tate, Hongliang Tian
parent abf8d9f5e4
commit 6ad67309fd
3 changed files with 5 additions and 5 deletions

View File

@ -33,7 +33,7 @@ global_asm!(
include_str!("syscall.S"),
USER_CS = const super::gdt::USER_CS.0,
USER_SS = const super::gdt::USER_SS.0,
ADDRESS_WIDTH = const crate::mm::kspace::KernelPtConfig::ADDRESS_WIDTH,
ADDRESS_WIDTH = const crate::arch::mm::PagingConsts::ADDRESS_WIDTH,
);
/// # Safety

View File

@ -73,7 +73,7 @@ impl KVirtArea {
}
#[cfg(ktest)]
pub fn query(&self, addr: Vaddr) -> Option<super::MappedItem> {
pub(in crate::mm) fn query(&self, addr: Vaddr) -> Option<super::MappedItem> {
use align_ext::AlignExt;
assert!(self.start() <= addr && self.end() >= addr);

View File

@ -135,10 +135,10 @@ pub fn paddr_to_vaddr(pa: Paddr) -> usize {
///
/// It manages the kernel mapping of all address spaces by sharing the kernel part. And it
/// is unlikely to be activated.
pub static KERNEL_PAGE_TABLE: Once<PageTable<KernelPtConfig>> = Once::new();
pub(super) static KERNEL_PAGE_TABLE: Once<PageTable<KernelPtConfig>> = Once::new();
#[derive(Clone, Debug)]
pub(crate) struct KernelPtConfig {}
pub(super) struct KernelPtConfig {}
// We use the first available PTE bit to mark the frame as tracked.
// SAFETY: `item_into_raw` and `item_from_raw` are implemented correctly,
@ -181,7 +181,7 @@ unsafe impl PageTableConfig for KernelPtConfig {
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub(crate) enum MappedItem {
pub(super) enum MappedItem {
Tracked(Frame<dyn AnyFrameMeta>, PageProperty),
Untracked(Paddr, PagingLevel, PageProperty),
}