From f4b50dd826b81295dc9628b655fc5f360445230b Mon Sep 17 00:00:00 2001 From: Tianhao Wang Date: Mon, 3 Jun 2024 21:31:24 +0200 Subject: mm: provide high memory kernel mapping in asm code. we use the first pml4 entry (+one pdp table) to map phy 0~512G to virt 0~512G for init code. This doesn't change. For the kernel to work in higher half memory, we also need to create mapping for it. We take the 256th entry of pml4 entry (hence one additional pdp table). Entry 0~63 are mapped to to the physical memory (with offset 0xffff_8000_0000_0000) Entry 64~127 are not used Entry 128~191 are mapped to the kernel image (text and code) (with offset 0xffff_8020_0000_0000) details in docs/mem_layout.txt --- src/defs.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/defs.rs b/src/defs.rs index ddde0da..a89a6c7 100644 --- a/src/defs.rs +++ b/src/defs.rs @@ -1,25 +1,25 @@ // exported symbols from asm/linker. // They are always unsafe. extern "C" { - fn ___KERNEL_START__(); - fn ___KERNEL_END__(); - fn ___BSS_START__(); - fn ___BSS_END__(); + fn ___KERNEL_PM_START__(); + fn ___KERNEL_PM_END__(); + fn ___BSS_PM_START__(); + fn ___BSS_PM_END__(); } pub fn pmap_kernel_start() -> u64 { - return ___KERNEL_START__ as u64; + return ___KERNEL_PM_START__ as u64; } pub fn pmap_kernel_end() -> u64 { - return ___KERNEL_END__ as u64; + return ___KERNEL_PM_END__ as u64; } pub fn pmap_bss_start() -> u64 { - return ___BSS_START__ as u64; + return ___BSS_PM_START__ as u64; } pub fn pmap_bss_end() -> u64 { - return ___BSS_END__ as u64; + return ___BSS_PM_END__ as u64; } pub fn roundup_4k(addr: u64) -> u64 { -- cgit v1.2.3-70-g09d2