Some more clippy fixes, warnings are noisy

This commit is contained in:
2025-03-05 00:57:06 +00:00
parent d53661b9a0
commit 014ec5310c
8 changed files with 34 additions and 19 deletions
+2
View File
@@ -1,3 +1,5 @@
#![expect(unused)]
use core::arch::x86_64::__cpuid;
use crate::arch::x86_64::memory::mapping::PHYSICAL_MEMORY_OFFSET;
+1
View File
@@ -1,3 +1,4 @@
#![expect(unused)]
use core::arch::x86_64::__cpuid;
use spin::Lazy;
use x86_64::registers::model_specific::Msr;
+2
View File
@@ -1,3 +1,5 @@
#![allow(clippy::missing_safety_doc)]
use x86_64::instructions::port::Port;
const CMD_INIT: u8 = 0x11;
@@ -173,15 +173,22 @@ impl FoundryFallbackAllocator {
}
}
/// Initialises the Foundry OS fallback allocator. This is currently a
/// linked list allocator pulled from the linked_list_allocator crate.
///
/// # Safety
///
/// This function assumes you passed a valid `heap_start` and `heap_size`,
/// as these are unchecked.
pub unsafe fn init(&mut self, heap_start: usize, heap_size: usize) {
unsafe { self.add_region(heap_start, heap_size) };
}
unsafe fn add_region(&mut self, addr: usize, size: usize) {
let mut node = FallbackListNode::new(size);
node.next = self.head.next.take();
let node_ptr = addr as *mut FallbackListNode;
unsafe {
let mut node = FallbackListNode::new(size);
node.next = self.head.next.take();
let node_ptr = addr as *mut FallbackListNode;
node_ptr.write(node);
self.head.next = Some(&mut *node_ptr);
}