diff --git a/src/arch/aarch64/mod.rs b/src/arch/aarch64/mod.rs index 800d4c1e..ba619290 100644 --- a/src/arch/aarch64/mod.rs +++ b/src/arch/aarch64/mod.rs @@ -81,7 +81,7 @@ pub fn output_message_byte(byte: u8) { } pub unsafe fn get_memory(_memory_size: u64) -> u64 { - (ptr::addr_of!(kernel_end).addr() as u64).align_up(LargePageSize::SIZE as u64) + (unsafe { ptr::addr_of!(kernel_end) }.addr() as u64).align_up(LargePageSize::SIZE as u64) } pub fn find_kernel() -> &'static [u8] { @@ -159,21 +159,21 @@ pub unsafe fn boot_kernel(kernel_info: LoadedKernel) -> ! { for i in pgt_slice.iter_mut() { *i = 0; } - pgt_slice[0] = ptr::addr_of!(l1_pgtable).addr() as u64 + PT_PT; - pgt_slice[511] = ptr::addr_of!(l0_pgtable).addr() as u64 + PT_PT + PT_SELF; + pgt_slice[0] = unsafe { ptr::addr_of!(l1_pgtable) }.addr() as u64 + PT_PT; + pgt_slice[511] = unsafe { ptr::addr_of!(l0_pgtable) }.addr() as u64 + PT_PT + PT_SELF; let pgt_slice = unsafe { core::slice::from_raw_parts_mut(ptr::addr_of_mut!(l1_pgtable), 512) }; for i in pgt_slice.iter_mut() { *i = 0; } - pgt_slice[0] = ptr::addr_of!(l2_pgtable).addr() as u64 + PT_PT; - pgt_slice[1] = ptr::addr_of!(l2k_pgtable).addr() as u64 + PT_PT; + pgt_slice[0] = unsafe { ptr::addr_of!(l2_pgtable) }.addr() as u64 + PT_PT; + pgt_slice[1] = unsafe { ptr::addr_of!(l2k_pgtable) }.addr() as u64 + PT_PT; let pgt_slice = unsafe { core::slice::from_raw_parts_mut(ptr::addr_of_mut!(l2_pgtable), 512) }; for i in pgt_slice.iter_mut() { *i = 0; } - pgt_slice[0] = ptr::addr_of!(l3_pgtable).addr() as u64 + PT_PT; + pgt_slice[0] = unsafe { ptr::addr_of!(l3_pgtable) }.addr() as u64 + PT_PT; let pgt_slice = unsafe { core::slice::from_raw_parts_mut(ptr::addr_of_mut!(l3_pgtable), 512) }; for i in pgt_slice.iter_mut() { @@ -187,8 +187,9 @@ pub unsafe fn boot_kernel(kernel_info: LoadedKernel) -> ! { *i = 0; } for (i, pgt_slice) in pgt_slice.iter_mut().enumerate().take(10) { - *pgt_slice = - ptr::addr_of!(L0mib_pgtable).addr() as u64 + (i * BasePageSize::SIZE) as u64 + PT_PT; + *pgt_slice = unsafe { ptr::addr_of!(L0mib_pgtable) }.addr() as u64 + + (i * BasePageSize::SIZE) as u64 + + PT_PT; } let pgt_slice = diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index 37de072a..f2b0e938 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -284,7 +284,8 @@ pub unsafe fn boot_kernel(kernel_info: LoadedKernel) -> ! { } = kernel_info; // determine boot stack address - let new_stack = (ptr::addr_of!(kernel_end).addr() + 0x1000).align_up(Size4KiB::SIZE as usize); + let new_stack = + (unsafe { ptr::addr_of!(kernel_end) }.addr() + 0x1000).align_up(Size4KiB::SIZE as usize); let cmdline_ptr = unsafe { *(sptr::from_exposed_addr(boot_params + LINUX_SETUP_HEADER_OFFSET + CMD_LINE_PTR_OFFSET)) @@ -444,7 +445,7 @@ pub unsafe fn boot_kernel(kernel_info: LoadedKernel) -> ! { let multiboot = unsafe { Multiboot::from_ptr(mb_info as u64, &mut mem).unwrap() }; // determine boot stack address - let mut new_stack = ptr::addr_of!(kernel_end) + let mut new_stack = unsafe { ptr::addr_of!(kernel_end) } .addr() .align_up(Size4KiB::SIZE as usize);