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 May 14, 2024
1 parent 9716ec3 commit bc077d6
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 @@ -7,7 +7,7 @@ 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::{env, mm};

pub static PHYSICAL_FREE_LIST: InterruptTicketMutex<FreeList<16>> =
InterruptTicketMutex::new(FreeList::new());
Expand Down Expand Up @@ -105,12 +105,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 @@ -146,7 +147,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 bc077d6

Please sign in to comment.