mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-23 17:33:23 +00:00
Fix workspace clippy usage
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
7eac2772d0
commit
f415585dff
@ -19,7 +19,7 @@ pub fn load_elf(file: &[u8]) {
|
||||
}
|
||||
|
||||
fn load_segment(file: &xmas_elf::ElfFile, program: &xmas_elf::program::ProgramHeader64) {
|
||||
let SegmentData::Undefined(header_data) = program.get_data(&file).unwrap() else {
|
||||
let SegmentData::Undefined(header_data) = program.get_data(file).unwrap() else {
|
||||
panic!("[setup] Unexpected segment data type!");
|
||||
};
|
||||
// Safety: the physical address from the ELF file is valid
|
||||
|
@ -40,5 +40,5 @@ fn get_payload(boot_params: &BootParams) -> &'static [u8] {
|
||||
let payload_length = hdr.payload_length as usize;
|
||||
// Safety: the payload_offset and payload_length is valid if we assume that the
|
||||
// boot_params struct is correct.
|
||||
unsafe { core::slice::from_raw_parts_mut(payload_offset as *mut u8, payload_length as usize) }
|
||||
unsafe { core::slice::from_raw_parts_mut(payload_offset as *mut u8, payload_length) }
|
||||
}
|
||||
|
@ -12,6 +12,10 @@ use super::{
|
||||
relocation::apply_rela_dyn_relocations,
|
||||
};
|
||||
|
||||
// Suppress warnings since using todo!.
|
||||
#[allow(unreachable_code)]
|
||||
#[allow(unused_variables)]
|
||||
#[allow(clippy::diverging_sub_expression)]
|
||||
#[export_name = "efi_stub_entry"]
|
||||
extern "sysv64" fn efi_stub_entry(handle: Handle, mut system_table: SystemTable<Boot>) -> ! {
|
||||
unsafe {
|
||||
@ -19,13 +23,9 @@ extern "sysv64" fn efi_stub_entry(handle: Handle, mut system_table: SystemTable<
|
||||
}
|
||||
uefi_services::init(&mut system_table).unwrap();
|
||||
|
||||
// Suppress TODO warning.
|
||||
#[allow(unreachable_code)]
|
||||
efi_phase_boot(
|
||||
handle,
|
||||
system_table,
|
||||
todo!("Use EFI boot services to fill boot params"),
|
||||
);
|
||||
let boot_params_ptr = todo!("Use EFI boot services to fill boot params");
|
||||
|
||||
efi_phase_boot(handle, system_table, boot_params_ptr);
|
||||
}
|
||||
|
||||
#[export_name = "efi_handover_entry"]
|
||||
@ -65,7 +65,7 @@ fn efi_phase_boot(
|
||||
let Ok(loaded_image) = boot_services.open_protocol_exclusive::<LoadedImage>(handle) else {
|
||||
panic!("Failed to open LoadedImage protocol");
|
||||
};
|
||||
loaded_image.data_type().clone()
|
||||
loaded_image.data_type()
|
||||
};
|
||||
let (system_table, memory_map) = system_table.exit_boot_services(memory_type);
|
||||
|
||||
@ -115,8 +115,8 @@ fn efi_phase_runtime(
|
||||
break;
|
||||
}
|
||||
e820_table[e820_entries] = linux_boot_params::BootE820Entry {
|
||||
addr: md.phys_start as u64,
|
||||
size: md.page_count as u64 * 4096,
|
||||
addr: md.phys_start,
|
||||
size: md.page_count * 4096,
|
||||
typ: match md.ty {
|
||||
uefi::table::boot::MemoryType::CONVENTIONAL => linux_boot_params::E820Type::Ram,
|
||||
uefi::table::boot::MemoryType::RESERVED => linux_boot_params::E820Type::Reserved,
|
||||
|
@ -13,8 +13,8 @@ global_asm!(include_str!("setup.S"));
|
||||
pub const ASTER_ENTRY_POINT: u32 = 0x8001200;
|
||||
|
||||
unsafe fn call_aster_entrypoint(entrypoint: u64, boot_params_ptr: u64) -> ! {
|
||||
asm!("mov rsi, {}", in(reg) boot_params_ptr as u64);
|
||||
asm!("mov rax, {}", in(reg) entrypoint as u64);
|
||||
asm!("mov rsi, {}", in(reg) boot_params_ptr);
|
||||
asm!("mov rax, {}", in(reg) entrypoint);
|
||||
asm!("jmp rax");
|
||||
|
||||
unreachable!();
|
||||
|
@ -30,7 +30,7 @@ fn get_rela_array() -> &'static [Elf64Rela] {
|
||||
end = in(reg) end,
|
||||
start = in(reg) start,
|
||||
);
|
||||
len / core::mem::size_of::<Elf64Rela>() as usize
|
||||
len / core::mem::size_of::<Elf64Rela>()
|
||||
};
|
||||
#[cfg(feature = "debug_print")]
|
||||
unsafe {
|
||||
@ -44,7 +44,7 @@ fn get_rela_array() -> &'static [Elf64Rela] {
|
||||
print_str("\n");
|
||||
}
|
||||
// Safety: the linker will ensure that the symbols are valid.
|
||||
unsafe { core::slice::from_raw_parts(start as *const Elf64Rela, len) }
|
||||
unsafe { core::slice::from_raw_parts(start, len) }
|
||||
}
|
||||
|
||||
const R_X86_64_RELATIVE: u32 = 8;
|
||||
|
@ -16,6 +16,7 @@ const START_OF_SETUP32_VA: usize = 0x100000;
|
||||
/// The setup is a position-independent executable. We can get the loaded base
|
||||
/// address from the symbol.
|
||||
#[inline]
|
||||
#[allow(clippy::fn_to_numeric_cast)]
|
||||
pub fn get_image_loaded_offset() -> isize {
|
||||
extern "C" {
|
||||
fn start_of_setup32();
|
||||
|
Reference in New Issue
Block a user