From b0a557fe12f3915f2a0c8c86f23ba4c5be35937f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Kr=C3=B6ning?= Date: Wed, 17 Apr 2024 12:49:55 +0200 Subject: [PATCH] fix(x86_64/physicalmem): rename `detect_from_limits` to `detect_from_uhyve` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Martin Kröning --- src/arch/x86_64/mm/physicalmem.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/arch/x86_64/mm/physicalmem.rs b/src/arch/x86_64/mm/physicalmem.rs index 11c6ff94f8..2b6a8b86a0 100644 --- a/src/arch/x86_64/mm/physicalmem.rs +++ b/src/arch/x86_64/mm/physicalmem.rs @@ -8,8 +8,8 @@ use multiboot::information::{MemoryType, Multiboot}; use crate::arch::x86_64::kernel::{get_fdt, get_limit, get_mbinfo}; use crate::arch::x86_64::mm::paging::{BasePageSize, PageSize}; use crate::arch::x86_64::mm::{MultibootMemory, PhysAddr, VirtAddr}; -use crate::mm; use crate::mm::freelist::{FreeList, FreeListEntry}; +use crate::{env, mm}; static PHYSICAL_FREE_LIST: InterruptTicketMutex = InterruptTicketMutex::new(FreeList::new()); @@ -102,12 +102,13 @@ fn detect_from_multiboot_info() -> Result<(), ()> { Ok(()) } -fn detect_from_limits() -> Result<(), ()> { - let limit = get_limit(); - if limit == 0 { +fn detect_from_uhyve() -> Result<(), ()> { + if !env::is_uhyve() { return Err(()); } + let limit = get_limit(); + assert_ne!(limit, 0); let mut free_list = PHYSICAL_FREE_LIST.lock(); let total_memory; @@ -136,7 +137,7 @@ fn detect_from_limits() -> Result<(), ()> { pub fn init() { detect_from_fdt() .or_else(|_e| detect_from_multiboot_info()) - .or_else(|_e| detect_from_limits()) + .or_else(|_e| detect_from_uhyve()) .unwrap(); }