Skip to content

Commit

Permalink
fix(x86_64/physicalmem): rename detect_from_limits to `detect_from_…
Browse files Browse the repository at this point in the history
…uhyve`

Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Apr 17, 2024
1 parent da25e38 commit b0a557f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/arch/x86_64/mm/physicalmem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<FreeList> =
InterruptTicketMutex::new(FreeList::new());
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}

Expand Down

0 comments on commit b0a557f

Please sign in to comment.