From 10b1ae2ecc0f5dcf8c10004bc6f53c94fb8469cb Mon Sep 17 00:00:00 2001 From: bjorn3 <17426603+bjorn3@users.noreply.github.com> Date: Tue, 31 Mar 2026 22:49:40 +0200 Subject: [PATCH] Remove unused arch consts --- src/arch/aarch64/consts.rs | 17 ----------------- src/arch/riscv64/consts.rs | 17 ----------------- src/arch/x86/consts.rs | 7 ------- src/arch/x86_64/consts.rs | 4 ---- 4 files changed, 45 deletions(-) diff --git a/src/arch/aarch64/consts.rs b/src/arch/aarch64/consts.rs index 4cdd0d87c5..df87c46d5a 100644 --- a/src/arch/aarch64/consts.rs +++ b/src/arch/aarch64/consts.rs @@ -1,41 +1,24 @@ -#![allow(unused)] - // Because the memory map is so important to not be aliased, it is defined here, in one place // The lower 256 PML4 entries are reserved for userspace // Each PML4 entry references up to 512 GB of memory // The second from the top (510) PML4 is reserved for the kernel /// The size of a single PML4 pub const PML4_SIZE: usize = 0x0000_0080_0000_0000; -pub const PML4_MASK: usize = 0x0000_ff80_0000_0000; /// Offset of recursive paging (deprecated, but still reserved) pub const RECURSIVE_PAGE_OFFSET: usize = (-(PML4_SIZE as isize)) as usize; -pub const RECURSIVE_PAGE_PML4: usize = (RECURSIVE_PAGE_OFFSET & PML4_MASK) / PML4_SIZE; /// Offset of kernel pub const KERNEL_OFFSET: usize = RECURSIVE_PAGE_OFFSET - PML4_SIZE; -pub const KERNEL_PML4: usize = (KERNEL_OFFSET & PML4_MASK) / PML4_SIZE; /// Offset to kernel heap pub const KERNEL_HEAP_OFFSET: usize = KERNEL_OFFSET - PML4_SIZE; -pub const KERNEL_HEAP_PML4: usize = (KERNEL_HEAP_OFFSET & PML4_MASK) / PML4_SIZE; /// Size of kernel heap pub const KERNEL_HEAP_SIZE: usize = 1 * 1024 * 1024; // 1 MB -/// Offset of temporary mapping for misc kernel bring-up actions -pub const KERNEL_TMP_MISC_OFFSET: usize = KERNEL_HEAP_OFFSET - PML4_SIZE; - -/// Offset to kernel percpu variables -pub const KERNEL_PERCPU_OFFSET: usize = KERNEL_TMP_MISC_OFFSET - PML4_SIZE; -pub const KERNEL_PERCPU_PML4: usize = (KERNEL_PERCPU_OFFSET & PML4_MASK) / PML4_SIZE; -/// Size of kernel percpu variables -pub const KERNEL_PERCPU_SHIFT: u8 = 16; // 2^16 = 64 KiB -pub const KERNEL_PERCPU_SIZE: usize = 1_usize << KERNEL_PERCPU_SHIFT; - /// Offset of physmap // This needs to match RMM's PHYS_OFFSET pub const PHYS_OFFSET: usize = 0xFFFF_8000_0000_0000; -pub const PHYS_PML4: usize = (PHYS_OFFSET & PML4_MASK) / PML4_SIZE; /// End offset of the user image, i.e. kernel start pub const USER_END_OFFSET: usize = 256 * PML4_SIZE; diff --git a/src/arch/riscv64/consts.rs b/src/arch/riscv64/consts.rs index 95b3d9a4de..5f017f3f4e 100644 --- a/src/arch/riscv64/consts.rs +++ b/src/arch/riscv64/consts.rs @@ -1,5 +1,3 @@ -#![allow(unused)] - use super::CurrentRmmArch; use rmm::Arch; @@ -7,36 +5,21 @@ const PML4_SHIFT: usize = (CurrentRmmArch::PAGE_LEVELS - 1) * CurrentRmmArch::PA + CurrentRmmArch::PAGE_SHIFT; /// The size of a single PML4 pub const PML4_SIZE: usize = 1_usize << PML4_SHIFT; -pub const PML4_MASK: usize = CurrentRmmArch::PAGE_ENTRY_MASK << PML4_SHIFT; /// Offset of recursive paging (deprecated, but still reserved) pub const RECURSIVE_PAGE_OFFSET: usize = (-(PML4_SIZE as isize)) as usize; -pub const RECURSIVE_PAGE_PTE3: usize = (RECURSIVE_PAGE_OFFSET & PML4_MASK) / PML4_SIZE; /// Offset of kernel pub const KERNEL_OFFSET: usize = RECURSIVE_PAGE_OFFSET - PML4_SIZE; -pub const KERNEL_PTE3: usize = (KERNEL_OFFSET & PML4_MASK) / PML4_SIZE; /// Offset to kernel heap pub const KERNEL_HEAP_OFFSET: usize = KERNEL_OFFSET - PML4_SIZE; -pub const KERNEL_HEAP_PTE3: usize = (KERNEL_HEAP_OFFSET & PML4_MASK) / PML4_SIZE; /// Size of kernel heap pub const KERNEL_HEAP_SIZE: usize = 1 * 1024 * 1024; // 1 MB -/// Offset of temporary mapping for misc kernel bring-up actions -pub const KERNEL_TMP_MISC_OFFSET: usize = KERNEL_HEAP_OFFSET - PML4_SIZE; - -/// Offset to kernel percpu variables -pub const KERNEL_PERCPU_OFFSET: usize = KERNEL_TMP_MISC_OFFSET - PML4_SIZE; -pub const KERNEL_PERCPU_PML4: usize = (KERNEL_PERCPU_OFFSET & PML4_MASK) / PML4_SIZE; -/// Size of kernel percpu variables -pub const KERNEL_PERCPU_SHIFT: u8 = 16; // 2^16 = 64 KiB -pub const KERNEL_PERCPU_SIZE: usize = 1_usize << KERNEL_PERCPU_SHIFT; - /// Offset of physmap // This needs to match RMM's PHYS_OFFSET pub const PHYS_OFFSET: usize = (-1_isize << (CurrentRmmArch::PAGE_ADDRESS_SHIFT - 1)) as usize; -pub const PHYS_PML4: usize = (PHYS_OFFSET & PML4_MASK) / PML4_SIZE; /// End offset of the user image, i.e. kernel start pub const USER_END_OFFSET: usize = 1_usize << (CurrentRmmArch::PAGE_ADDRESS_SHIFT - 1); diff --git a/src/arch/x86/consts.rs b/src/arch/x86/consts.rs index 73946ecdb2..902de7f2d9 100644 --- a/src/arch/x86/consts.rs +++ b/src/arch/x86/consts.rs @@ -1,4 +1,3 @@ -#![allow(unused)] // Because the memory map is so important to not be aliased, it is defined here, in one place // The lower 256 PML4 entries are reserved for userspace // Each PML4 entry references up to 512 GB of memory @@ -19,12 +18,6 @@ pub const KERNEL_HEAP_OFFSET: usize = 0xE000_0000; /// Size of kernel heap pub const KERNEL_HEAP_SIZE: usize = rmm::MEGABYTE; -/// Offset to kernel percpu variables (256 MiB max) -pub const KERNEL_PERCPU_OFFSET: usize = 0xF000_0000; -/// Size of kernel percpu variables -pub const KERNEL_PERCPU_SHIFT: u8 = 16; // 2^16 = 64 KiB -pub const KERNEL_PERCPU_SIZE: usize = 1_usize << KERNEL_PERCPU_SHIFT; - /// Offset of physmap (1 GiB max) // This needs to match RMM's PHYS_OFFSET pub const PHYS_OFFSET: usize = 0x8000_0000; diff --git a/src/arch/x86_64/consts.rs b/src/arch/x86_64/consts.rs index fda5ed1bda..9936492312 100644 --- a/src/arch/x86_64/consts.rs +++ b/src/arch/x86_64/consts.rs @@ -10,23 +10,19 @@ /// The size of a single PML4 pub const PML4_SIZE: usize = 0x0000_0080_0000_0000; -pub const PML4_MASK: usize = 0x0000_ff80_0000_0000; /// Offset of kernel pub const KERNEL_MAX_SIZE: usize = 1_usize << 31; pub const KERNEL_OFFSET: usize = KERNEL_MAX_SIZE.wrapping_neg(); -pub const KERNEL_PML4: usize = (KERNEL_OFFSET & PML4_MASK) / PML4_SIZE; /// Offset to kernel heap pub const KERNEL_HEAP_OFFSET: usize = KERNEL_OFFSET - PML4_SIZE; -pub const KERNEL_HEAP_PML4: usize = (KERNEL_HEAP_OFFSET & PML4_MASK) / PML4_SIZE; /// Size of kernel heap pub const KERNEL_HEAP_SIZE: usize = 1 * 1024 * 1024; // 1 MB /// Offset of physmap // This needs to match RMM's PHYS_OFFSET pub const PHYS_OFFSET: usize = 0xFFFF_8000_0000_0000; -pub const PHYS_PML4: usize = (PHYS_OFFSET & PML4_MASK) / PML4_SIZE; /// End offset of the user image, i.e. kernel start // TODO: Make this offset at least PAGE_SIZE less? There are known hardware bugs on some arches,