File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ unsafe fn init() {
6464/// End of the virtual memory address space reserved for kernel memory (inclusive).
6565/// The virtual memory address space reserved for the task heap starts after this.
6666#[ inline]
67- pub fn kernel_heap_end ( ) -> VirtAddr {
67+ pub const fn kernel_heap_end ( ) -> VirtAddr {
6868 cfg_select ! {
6969 target_arch = "aarch64" => {
7070 // maximum address, which can be supported by TTBR0
@@ -75,17 +75,13 @@ pub fn kernel_heap_end() -> VirtAddr {
7575 VirtAddr :: new( 0x0040_0000_0000 - 1 )
7676 }
7777 target_arch = "x86_64" => {
78- use x86_64:: structures:: paging:: PageTableIndex ;
79-
8078 let p4_index = if cfg!( feature = "common-os" ) {
81- PageTableIndex :: new ( 1 )
79+ 1u64
8280 } else {
83- PageTableIndex :: new ( 256 )
81+ 256u64
8482 } ;
8583
86- let addr = u64 :: from( p4_index) << 39 ;
87- assert_eq!( VirtAddr :: new_truncate( addr) . p4_index( ) , p4_index) ;
88-
84+ let addr = p4_index << 39 ;
8985 VirtAddr :: new_truncate( addr - 1 )
9086 }
9187 }
You can’t perform that action at this time.
0 commit comments