feature: 增加early io remap的fixmap功能 (#495)

允许在内存管理初始化之前,使用fixmap功能,映射一些物理内存,并记录.
This commit is contained in:
LoGin
2024-01-21 01:21:55 +08:00
committed by GitHub
parent 1f58c8f5cf
commit 74ffde667e
6 changed files with 223 additions and 7 deletions

View File

@ -11,7 +11,7 @@ pub(super) mod init;
pub type PageMapper = crate::mm::page::PageMapper<RiscV64MMArch, LockedFrameAllocator>;
/// RiscV64的内存管理架构结构体
/// RiscV64的内存管理架构结构体(sv39)
#[derive(Debug, Clone, Copy, Hash)]
pub struct RiscV64MMArch;
@ -53,6 +53,11 @@ impl MemoryManagementArch for RiscV64MMArch {
const USER_STACK_START: crate::mm::VirtAddr = VirtAddr::new(0x0000_001f_ffa0_0000);
/// 在距离sv39的顶端还有1G的位置设置为FIXMAP的起始地址
const FIXMAP_START_VADDR: VirtAddr = VirtAddr::new(0xffff_ffff_8000_0000);
/// 设置1MB的fixmap空间
const FIXMAP_SIZE: usize = 256 * 4096;
unsafe fn init() {
todo!()
}

View File

@ -115,6 +115,10 @@ impl MemoryManagementArch for X86_64MMArch {
const USER_BRK_START: VirtAddr = VirtAddr::new(0x700000000000);
const USER_STACK_START: VirtAddr = VirtAddr::new(0x6ffff0a00000);
const FIXMAP_START_VADDR: VirtAddr = VirtAddr::new(0xffffb00000000000);
/// 设置FIXMAP区域大小为1M
const FIXMAP_SIZE: usize = 256 * 4096;
/// @brief 获取物理内存区域
unsafe fn init() {
extern "C" {