Fix warnings

This commit is contained in:
Mark Poliakov 2023-12-11 21:14:09 +02:00
parent 004bfe9678
commit 920053a25d
2 changed files with 8 additions and 5 deletions

View File

@ -85,10 +85,10 @@ fn boot_partition(
bs.open_protocol_exclusive::<SimpleFileSystem>(fs_handle)
}
fn load_kernel<'a, 'b>(
fn load_kernel<'a>(
ih: Handle,
st: &'a SystemTable<Boot>,
) -> Result<(u64, u64, &'b mut LoadProtocolV1), Error> {
st: &SystemTable<Boot>,
) -> Result<(u64, u64, &'a mut LoadProtocolV1), Error> {
let bs = st.boot_services();
// Obtain the memory map

View File

@ -71,6 +71,9 @@ pub fn memory_map(bs: &BootServices) -> Result<MemoryMap, Error> {
}
// TODO handle other offsets
/// # Safety
///
/// Not really safe.
pub unsafe fn map_image() -> u64 {
// Load the original cr3 to obtain the first 512GiB, these are still in use by UEFI
let mut cr3: usize;
@ -85,8 +88,8 @@ pub unsafe fn map_image() -> u64 {
PDS[pd_index].data[pd_offset] = (i << 21) as u64 | PTE_BLOCK | PTE_WRITABLE | PTE_PRESENT;
}
for i in 0..PDS.len() {
let addr = PDS[i].data.as_mut_ptr() as u64;
for (i, pd) in PDS.iter_mut().enumerate() {
let addr = pd.data.as_mut_ptr() as u64;
PDPT.data[i] = addr | PTE_WRITABLE | PTE_PRESENT;
}