x86-64: fix some loop {}s

This commit is contained in:
Mark Poliakov 2023-09-15 00:09:26 +03:00
parent 399e9531e7
commit 5351ccf038
2 changed files with 15 additions and 10 deletions

View File

@ -15,7 +15,7 @@ use crate::{
mem::{
address::{FromRaw, IntoRaw, KernelImageObject},
device::RawDeviceMemoryMapping,
table::{EntryLevel, KernelAddressSpace, MapAttributes},
table::EntryLevel,
PhysicalAddress, KERNEL_VIRT_OFFSET,
},
};
@ -96,12 +96,12 @@ unsafe fn map_early_pages(physical: PhysicalAddress, count: usize) -> Result<usi
return Ok(EARLY_MAPPING_OFFSET + l3i * L3::SIZE);
}
loop {}
Err(Error::OutOfMemory)
}
unsafe fn unmap_early_page(address: usize) {
if address < EARLY_MAPPING_OFFSET || address >= EARLY_MAPPING_OFFSET + L2::SIZE {
loop {}
panic!("Tried to unmap invalid early mapping: {:#x}", address);
}
let l3i = L3::index(address - EARLY_MAPPING_OFFSET);
@ -135,7 +135,8 @@ unsafe fn map_device_memory_l3(base: PhysicalAddress, count: usize) -> Result<us
return Ok(DEVICE_MAPPING_OFFSET + i * L3::SIZE);
}
loop {}
Err(Error::OutOfMemory)
}
unsafe fn map_device_memory_l2(base: PhysicalAddress, count: usize) -> Result<usize, Error> {
@ -159,7 +160,8 @@ unsafe fn map_device_memory_l2(base: PhysicalAddress, count: usize) -> Result<us
);
return Ok(DEVICE_MAPPING_OFFSET + i * L2::SIZE);
}
loop {}
Err(Error::OutOfMemory)
}
pub(super) unsafe fn map_device_memory(
@ -226,12 +228,12 @@ pub(super) unsafe fn unmap_device_memory(map: &RawDeviceMemoryMapping) {
pub(super) unsafe fn map_heap_block(index: usize, page: PhysicalAddress) {
if L2::page_offset(page.into_raw()) != 0 {
loop {}
panic!("Attempted to map a misaligned 2MiB page");
}
assert!(index < 512);
if HEAP_MAPPING_L2[index].is_present() {
loop {}
panic!("Page is already mappged: {:#x}", page);
}
// TODO NX

View File

@ -173,7 +173,10 @@ impl Architecture for X86_64 {
let end_l1i = (IntoRaw::<usize>::into_raw(memory_end) + (1 << 30) - 1) >> 30;
if end_l1i > 512 {
loop {}
todo!(
"Cannot handle {}GiB of RAM",
end_l1i * L1::SIZE / (1024 * 1024 * 1024)
);
}
MEMORY_LIMIT.init(memory_end.into_raw());
@ -196,7 +199,7 @@ impl Architecture for X86_64 {
Ok(())
} else {
loop {}
todo!();
}
}
@ -235,7 +238,7 @@ impl Architecture for X86_64 {
impl X86_64 {
unsafe fn handle_ipi(&self, msg: CpuMessage) {
loop {}
todo!()
}
fn set_boot_data(&self, data: BootData) {