diff --git a/Cargo.toml b/Cargo.toml index 31764326..1609a6d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ license.workspace = true version.workspace = true repository.workspace = true authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [workspace] members = [ diff --git a/api/Cargo.toml b/api/Cargo.toml index ef687b0c..45145d36 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -3,7 +3,7 @@ name = "bootloader_api" license.workspace = true version.workspace = true repository.workspace = true -edition = "2021" +edition = "2024" description = "Makes a kernel compatible with the bootloader crate" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/api/src/lib.rs b/api/src/lib.rs index 586ae1d0..3a8b49ef 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -114,7 +114,7 @@ macro_rules! entry_point { }; ($path:path, config = $config:expr) => { const _: () = { - #[link_section = ".bootloader-config"] + #[unsafe(link_section = ".bootloader-config")] pub static __BOOTLOADER_CONFIG: [u8; $crate::BootloaderConfig::SERIALIZED_LEN] = { // validate the type let config: &$crate::BootloaderConfig = $config; @@ -125,7 +125,7 @@ macro_rules! entry_point { static __BOOTLOADER_CONFIG_REF: &[u8; $crate::BootloaderConfig::SERIALIZED_LEN] = &__BOOTLOADER_CONFIG; - #[export_name = "_start"] + #[unsafe(export_name = "_start")] pub extern "C" fn __impl_start(boot_info: &'static mut $crate::BootInfo) -> ! { // validate the signature of the program entry point let f: fn(&'static mut $crate::BootInfo) -> ! = $path; diff --git a/bios/boot_sector/Cargo.toml b/bios/boot_sector/Cargo.toml index ca870600..c7f549fc 100644 --- a/bios/boot_sector/Cargo.toml +++ b/bios/boot_sector/Cargo.toml @@ -2,7 +2,7 @@ name = "bootloader-x86_64-bios-boot-sector" version.workspace = true authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" license.workspace = true repository.workspace = true description = "BIOS boot sector for the `bootloader` crate" diff --git a/bios/boot_sector/src/fail.rs b/bios/boot_sector/src/fail.rs index 07766f40..d00a01e6 100644 --- a/bios/boot_sector/src/fail.rs +++ b/bios/boot_sector/src/fail.rs @@ -28,7 +28,7 @@ impl UnwrapOrFail for Result { } } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn print_char(c: u8) { let ax = u16::from(c) | 0x0e00; unsafe { @@ -38,7 +38,7 @@ pub extern "C" fn print_char(c: u8) { #[cold] #[inline(never)] -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn fail(code: u8) -> ! { print_char(b'!'); print_char(code); diff --git a/bios/boot_sector/src/main.rs b/bios/boot_sector/src/main.rs index ab10922e..34736df3 100644 --- a/bios/boot_sector/src/main.rs +++ b/bios/boot_sector/src/main.rs @@ -11,7 +11,7 @@ mod dap; mod fail; mod mbr; -extern "C" { +unsafe extern "C" { static _partition_table: u8; static _second_stage_start: u8; } @@ -25,7 +25,7 @@ fn second_stage_start() -> *const () { ptr as *const () } -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn first_stage(disk_number: u16) { // read partition table and look for second stage partition let partition_table = unsafe { slice::from_raw_parts(partition_table_raw(), 16 * 4) }; diff --git a/bios/common/Cargo.toml b/bios/common/Cargo.toml index 0417d017..d06442f7 100644 --- a/bios/common/Cargo.toml +++ b/bios/common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootloader-x86_64-bios-common" version.workspace = true -edition = "2021" +edition = "2024" license.workspace = true repository.workspace = true description = "Common code for BIOS stages of the `bootloader` crate" diff --git a/bios/stage-2/Cargo.toml b/bios/stage-2/Cargo.toml index 2487e964..3bd72662 100644 --- a/bios/stage-2/Cargo.toml +++ b/bios/stage-2/Cargo.toml @@ -2,7 +2,7 @@ name = "bootloader-x86_64-bios-stage-2" version.workspace = true authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" license.workspace = true repository.workspace = true description = "Second BIOS stage of the `bootloader` crate" diff --git a/bios/stage-2/src/dap.rs b/bios/stage-2/src/dap.rs index f94b7fde..76f58cd1 100644 --- a/bios/stage-2/src/dap.rs +++ b/bios/stage-2/src/dap.rs @@ -37,20 +37,22 @@ impl DiskAddressPacket { pub unsafe fn perform_load(&self, disk_number: u16) { let self_addr = self as *const Self as u16; - asm!( - "push 'z'", // error code `z`, passed to `fail` on error - "mov {1:x}, si", - "mov si, {0:x}", - "int 0x13", - "jnc 2f", // carry is set on fail - "call fail", - "2:", - "pop si", // remove error code again - "mov si, {1:x}", - in(reg) self_addr, - out(reg) _, - in("ax") 0x4200u16, - in("dx") disk_number, - ); + unsafe { + asm!( + "push 'z'", // error code `z`, passed to `fail` on error + "mov {1:x}, si", + "mov si, {0:x}", + "int 0x13", + "jnc 2f", // carry is set on fail + "call fail", + "2:", + "pop si", // remove error code again + "mov si, {1:x}", + in(reg) self_addr, + out(reg) _, + in("ax") 0x4200u16, + in("dx") disk_number, + ); + } } } diff --git a/bios/stage-2/src/disk.rs b/bios/stage-2/src/disk.rs index 66880a9b..06a2e8fa 100644 --- a/bios/stage-2/src/disk.rs +++ b/bios/stage-2/src/disk.rs @@ -15,6 +15,7 @@ impl Read for DiskAccess { static mut TMP_BUF: AlignedArrayBuffer<1024> = AlignedArrayBuffer { buffer: [0; 512 * 2], }; + #[allow(static_mut_refs)] let buf = unsafe { &mut TMP_BUF }; assert!(current_sector_offset + len <= buf.buffer.len()); diff --git a/bios/stage-2/src/fat.rs b/bios/stage-2/src/fat.rs index 7d828bd6..9ce41d6f 100644 --- a/bios/stage-2/src/fat.rs +++ b/bios/stage-2/src/fat.rs @@ -205,7 +205,7 @@ impl FileSystem { fn read_root_dir<'a>( &'a mut self, buffer: &'a mut (dyn AlignedBuffer + 'a), - ) -> impl Iterator> + 'a { + ) -> impl Iterator, ()>> + 'a { match self.bpb.fat_type() { FatType::Fat32 => { // self.bpb.root_cluster; @@ -242,6 +242,7 @@ impl FileSystem { #[derive(Debug)] pub struct Cluster { + #[allow(unused)] pub index: u32, pub start_offset: u64, pub len_bytes: u32, diff --git a/bios/stage-2/src/main.rs b/bios/stage-2/src/main.rs index b5b07d65..555b4d55 100644 --- a/bios/stage-2/src/main.rs +++ b/bios/stage-2/src/main.rs @@ -7,7 +7,7 @@ use crate::{ copy_to_protected_mode, enter_protected_mode_and_jump_to_stage_3, enter_unreal_mode, }, }; -use bootloader_x86_64_bios_common::{hlt, BiosFramebufferInfo, BiosInfo, Region}; +use bootloader_x86_64_bios_common::{BiosFramebufferInfo, BiosInfo, Region, hlt}; use byteorder::{ByteOrder, LittleEndian}; use core::{fmt::Write as _, slice}; use disk::AlignedArrayBuffer; @@ -35,8 +35,8 @@ static mut DISK_BUFFER: AlignedArrayBuffer<0x4000> = AlignedArrayBuffer { buffer: [0; 0x4000], }; -#[no_mangle] -#[link_section = ".start"] +#[unsafe(no_mangle)] +#[unsafe(link_section = ".start")] pub extern "C" fn _start(disk_number: u16, partition_table_start: *const u8) -> ! { start(disk_number, partition_table_start) } @@ -87,6 +87,7 @@ fn start(disk_number: u16, partition_table_start: *const u8) -> ! { let mut fs = fat::FileSystem::parse(disk.clone()); + #[allow(static_mut_refs)] let disk_buffer = unsafe { &mut DISK_BUFFER }; let stage_3_len = load_file("boot-stage-3", STAGE_3_DST, &mut fs, &mut disk, disk_buffer); @@ -255,7 +256,7 @@ fn split_array_ref(slice: &[T]) -> (&[T; N], &[T]) { #[cold] #[inline(never)] -#[no_mangle] +#[unsafe(no_mangle)] pub extern "C" fn fail(code: u8) -> ! { panic!("fail: {}", code as char); } diff --git a/bios/stage-2/src/memory_map.rs b/bios/stage-2/src/memory_map.rs index c3ba6c97..d049cfd8 100644 --- a/bios/stage-2/src/memory_map.rs +++ b/bios/stage-2/src/memory_map.rs @@ -1,7 +1,7 @@ // From http://wiki.osdev.org/Detecting_Memory_(x86)#Getting_an_E820_Memory_Map use crate::split_array_ref; -use bootloader_x86_64_bios_common::{racy_cell::RacyCell, E820MemoryRegion}; +use bootloader_x86_64_bios_common::{E820MemoryRegion, racy_cell::RacyCell}; use core::arch::asm; static MEMORY_MAP: RacyCell<[E820MemoryRegion; 100]> = RacyCell::new( diff --git a/bios/stage-2/src/protected_mode.rs b/bios/stage-2/src/protected_mode.rs index 2b70182a..041a7171 100644 --- a/bios/stage-2/src/protected_mode.rs +++ b/bios/stage-2/src/protected_mode.rs @@ -85,20 +85,20 @@ pub fn enter_unreal_mode() { } } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe fn copy_to_protected_mode(target: *mut u8, bytes: &[u8]) { for (offset, byte) in bytes.iter().enumerate() { let dst = target.wrapping_add(offset); // we need to do the write in inline assembly because the compiler // seems to truncate the address unsafe { - asm!("mov [{}], {}", in(reg) dst, in(reg_byte) *byte, options(nostack, preserves_flags)) - }; - assert_eq!(read_from_protected_mode(dst), *byte); + asm!("mov [{}], {}", in(reg) dst, in(reg_byte) *byte, options(nostack, preserves_flags)); + assert_eq!(read_from_protected_mode(dst), *byte); + } } } -#[no_mangle] +#[unsafe(no_mangle)] pub unsafe fn read_from_protected_mode(ptr: *mut u8) -> u8 { let res; // we need to do the read in inline assembly because the compiler diff --git a/bios/stage-2/src/vesa.rs b/bios/stage-2/src/vesa.rs index 9bf54b55..a64ccb39 100644 --- a/bios/stage-2/src/vesa.rs +++ b/bios/stage-2/src/vesa.rs @@ -2,7 +2,7 @@ use bootloader_x86_64_bios_common::PixelFormat; -use crate::{disk::AlignedBuffer, AlignedArrayBuffer}; +use crate::{AlignedArrayBuffer, disk::AlignedBuffer}; use core::arch::asm; #[repr(C, packed)] @@ -109,11 +109,7 @@ impl<'a> VesaInfo<'a> { let base_ptr = video_mode_ptr as *const u16; let ptr = unsafe { base_ptr.add(index) }; let mode = unsafe { *ptr }; - if mode == 0xffff { - None - } else { - Some(mode) - } + if mode == 0xffff { None } else { Some(mode) } } } diff --git a/bios/stage-3/Cargo.toml b/bios/stage-3/Cargo.toml index 9db2bcce..0fe436c6 100644 --- a/bios/stage-3/Cargo.toml +++ b/bios/stage-3/Cargo.toml @@ -2,7 +2,7 @@ name = "bootloader-x86_64-bios-stage-3" version.workspace = true authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" license.workspace = true repository.workspace = true description = "Third BIOS stage of the `bootloader` crate" diff --git a/bios/stage-3/src/main.rs b/bios/stage-3/src/main.rs index 15d30f8b..4dcd7d1d 100644 --- a/bios/stage-3/src/main.rs +++ b/bios/stage-3/src/main.rs @@ -3,15 +3,15 @@ #![deny(unsafe_op_in_unsafe_fn)] use crate::screen::Writer; -use bootloader_x86_64_bios_common::{hlt, BiosInfo}; +use bootloader_x86_64_bios_common::{BiosInfo, hlt}; use core::{arch::asm, fmt::Write as _}; mod gdt; mod paging; mod screen; -#[no_mangle] -#[link_section = ".start"] +#[unsafe(no_mangle)] +#[unsafe(link_section = ".start")] pub extern "C" fn _start(info: &mut BiosInfo) { screen::init(info.framebuffer); // Writer.clear_screen(); @@ -29,7 +29,7 @@ pub extern "C" fn _start(info: &mut BiosInfo) { } } -#[no_mangle] +#[unsafe(no_mangle)] pub fn enter_long_mode_and_jump_to_stage_4(info: &mut BiosInfo) { let _ = writeln!(Writer, "Paging init done, jumping to stage 4"); unsafe { diff --git a/bios/stage-3/src/screen.rs b/bios/stage-3/src/screen.rs index 6e81bf1d..6cffd166 100644 --- a/bios/stage-3/src/screen.rs +++ b/bios/stage-3/src/screen.rs @@ -1,6 +1,6 @@ -use bootloader_x86_64_bios_common::{racy_cell::RacyCell, BiosFramebufferInfo, PixelFormat}; +use bootloader_x86_64_bios_common::{BiosFramebufferInfo, PixelFormat, racy_cell::RacyCell}; use core::{fmt, ptr}; -use noto_sans_mono_bitmap::{get_bitmap, BitmapChar, BitmapHeight, FontWeight}; +use noto_sans_mono_bitmap::{BitmapChar, BitmapHeight, FontWeight, get_bitmap}; static WRITER: RacyCell> = RacyCell::new(None); pub struct Writer; diff --git a/bios/stage-4/Cargo.toml b/bios/stage-4/Cargo.toml index 2afb8654..e45cf254 100644 --- a/bios/stage-4/Cargo.toml +++ b/bios/stage-4/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootloader-x86_64-bios-stage-4" version.workspace = true -edition = "2021" +edition = "2024" license.workspace = true repository.workspace = true description = "Fourth BIOS stage of the `bootloader` crate" diff --git a/bios/stage-4/src/main.rs b/bios/stage-4/src/main.rs index cf159a61..6dc017b2 100644 --- a/bios/stage-4/src/main.rs +++ b/bios/stage-4/src/main.rs @@ -7,8 +7,8 @@ use bootloader_boot_config::{BootConfig, LevelFilter}; use bootloader_x86_64_bios_common::{BiosFramebufferInfo, BiosInfo, E820MemoryRegion}; use bootloader_x86_64_common::RawFrameBufferInfo; use bootloader_x86_64_common::{ - legacy_memory_region::LegacyFrameAllocator, load_and_switch_to_kernel, Kernel, PageTables, - SystemInfo, + Kernel, PageTables, SystemInfo, legacy_memory_region::LegacyFrameAllocator, + load_and_switch_to_kernel, }; use core::{cmp, slice}; use usize_conversions::usize_from; @@ -22,8 +22,8 @@ const GIGABYTE: u64 = 4096 * 512 * 512; mod memory_descriptor; -#[no_mangle] -#[link_section = ".start"] +#[unsafe(no_mangle)] +#[unsafe(link_section = ".start")] pub extern "C" fn _start(info: &mut BiosInfo) -> ! { let memory_map: &mut [E820MemoryRegion] = unsafe { core::slice::from_raw_parts_mut( @@ -255,8 +255,8 @@ fn create_page_tables(frame_allocator: &mut impl FrameAllocator) -> Pa fn detect_rsdp() -> Option { use core::ptr::NonNull; use rsdp::{ - handler::{AcpiHandler, PhysicalMapping}, Rsdp, + handler::{AcpiHandler, PhysicalMapping}, }; #[derive(Clone)] @@ -271,13 +271,15 @@ fn detect_rsdp() -> Option { physical_address: usize, size: usize, ) -> PhysicalMapping { - PhysicalMapping::new( - physical_address, - NonNull::new(physical_address as *mut _).unwrap(), - size, - size, - Self, - ) + unsafe { + PhysicalMapping::new( + physical_address, + NonNull::new(physical_address as *mut _).unwrap(), + size, + size, + Self, + ) + } } fn unmap_physical_region(_region: &PhysicalMapping) {} diff --git a/common/Cargo.toml b/common/Cargo.toml index 7f9531c6..4fcc2ff6 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootloader-x86_64-common" version.workspace = true -edition = "2021" +edition = "2024" description = "Common code for the x86_64 bootloader implementations" license.workspace = true repository.workspace = true diff --git a/common/config/Cargo.toml b/common/config/Cargo.toml index 560c6284..8e397fc0 100644 --- a/common/config/Cargo.toml +++ b/common/config/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootloader-boot-config" version.workspace = true -edition = "2021" +edition = "2024" description = "The runtime configurations that are saved in a JSON file for the bootloader crate" license.workspace = true repository.workspace = true diff --git a/common/src/framebuffer.rs b/common/src/framebuffer.rs index bfcb52a2..0c00b511 100644 --- a/common/src/framebuffer.rs +++ b/common/src/framebuffer.rs @@ -2,7 +2,7 @@ use bootloader_api::info::{FrameBufferInfo, PixelFormat}; use core::{fmt, ptr}; use font_constants::BACKUP_CHAR; use noto_sans_mono_bitmap::{ - get_raster, get_raster_width, FontWeight, RasterHeight, RasterizedChar, + FontWeight, RasterHeight, RasterizedChar, get_raster, get_raster_width, }; /// Additional vertical space between lines diff --git a/common/src/gdt.rs b/common/src/gdt.rs index 5ba16c5b..10beac3d 100644 --- a/common/src/gdt.rs +++ b/common/src/gdt.rs @@ -1,10 +1,10 @@ use x86_64::{ + VirtAddr, instructions::segmentation::{self, Segment}, structures::{ gdt::{Descriptor, GlobalDescriptorTable}, paging::PhysFrame, }, - VirtAddr, }; pub fn create_and_load(frame: PhysFrame) { diff --git a/common/src/legacy_memory_region.rs b/common/src/legacy_memory_region.rs index 0c613392..c6c9d179 100644 --- a/common/src/legacy_memory_region.rs +++ b/common/src/legacy_memory_region.rs @@ -1,9 +1,8 @@ use bootloader_api::info::{MemoryRegion, MemoryRegionKind}; use core::{cmp, mem::MaybeUninit}; use x86_64::{ - align_down, align_up, + PhysAddr, align_down, align_up, structures::paging::{FrameAllocator, PhysFrame, Size4KiB}, - PhysAddr, }; /// A slice of memory that is used by the bootloader and needs to be reserved diff --git a/common/src/level_4_entries.rs b/common/src/level_4_entries.rs index 926dd541..a7f88e80 100644 --- a/common/src/level_4_entries.rs +++ b/common/src/level_4_entries.rs @@ -1,9 +1,8 @@ use crate::{ - entropy, - load_kernel::{calc_elf_memory_requirements, ElfMemoryRequirements, VirtualAddressOffset}, - BootInfo, RawFrameBufferInfo, + BootInfo, RawFrameBufferInfo, entropy, + load_kernel::{ElfMemoryRequirements, VirtualAddressOffset, calc_elf_memory_requirements}, }; -use bootloader_api::{config, info::MemoryRegion, BootloaderConfig}; +use bootloader_api::{BootloaderConfig, config, info::MemoryRegion}; use core::{alloc::Layout, iter::Step}; use rand::{ distributions::{Distribution, Uniform}, @@ -12,10 +11,10 @@ use rand::{ use rand_hc::Hc128Rng; use usize_conversions::IntoUsize; use x86_64::{ - structures::paging::{Page, PageTableIndex, Size4KiB}, PhysAddr, VirtAddr, + structures::paging::{Page, PageTableIndex, Size4KiB}, }; -use xmas_elf::{header, program::ProgramHeader, ElfFile}; +use xmas_elf::{ElfFile, header, program::ProgramHeader}; /// Keeps track of used entries in a level 4 page table. /// diff --git a/common/src/lib.rs b/common/src/lib.rs index 0a4f729d..1ebe9aa0 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -4,20 +4,20 @@ use crate::legacy_memory_region::{LegacyFrameAllocator, LegacyMemoryRegion}; use bootloader_api::{ + BootInfo, BootloaderConfig, config::Mapping, info::{FrameBuffer, FrameBufferInfo, MemoryRegion, TlsTemplate}, - BootInfo, BootloaderConfig, }; use bootloader_boot_config::{BootConfig, LevelFilter}; use core::{alloc::Layout, arch::asm, mem::MaybeUninit, slice}; use level_4_entries::UsedLevel4Entries; use usize_conversions::FromUsize; use x86_64::{ + PhysAddr, VirtAddr, structures::paging::{ - page_table::PageTableLevel, FrameAllocator, Mapper, OffsetPageTable, Page, PageSize, - PageTableFlags, PageTableIndex, PhysFrame, Size2MiB, Size4KiB, + FrameAllocator, Mapper, OffsetPageTable, Page, PageSize, PageTableFlags, PageTableIndex, + PhysFrame, Size2MiB, Size4KiB, page_table::PageTableLevel, }, - PhysAddr, VirtAddr, }; use xmas_elf::ElfFile; diff --git a/common/src/load_kernel.rs b/common/src/load_kernel.rs index b54bd246..41b183a6 100644 --- a/common/src/load_kernel.rs +++ b/common/src/load_kernel.rs @@ -1,20 +1,18 @@ -use crate::{level_4_entries::UsedLevel4Entries, PAGE_SIZE}; +use crate::{PAGE_SIZE, level_4_entries::UsedLevel4Entries}; use bootloader_api::{config::Mapping, info::TlsTemplate}; use core::{cmp, iter::Step, mem::size_of, ops::Add}; use x86_64::{ - align_up, + PhysAddr, VirtAddr, align_up, structures::paging::{ - mapper::{MappedFrame, MapperAllSizes, TranslateResult}, FrameAllocator, Page, PageSize, PageTableFlags as Flags, PhysFrame, Size4KiB, Translate, + mapper::{MappedFrame, MapperAllSizes, TranslateResult}, }, - PhysAddr, VirtAddr, }; use xmas_elf::{ - dynamic, header, + ElfFile, dynamic, header, program::{self, ProgramHeader, SegmentData, Type}, sections::Rela, - ElfFile, }; use super::Kernel; @@ -65,7 +63,7 @@ where return Err(concat!( "Invalid kernel_code mapping. ", "Executable can only be mapped at virtual_address_offset 0." - )) + )); } }, header::Type::SharedObject => { diff --git a/tests/runner/Cargo.toml b/tests/runner/Cargo.toml index 796ffb01..17b918d0 100644 --- a/tests/runner/Cargo.toml +++ b/tests/runner/Cargo.toml @@ -2,7 +2,7 @@ name = "bootloader_test_runner" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/tests/test_kernels/config_file/Cargo.toml b/tests/test_kernels/config_file/Cargo.toml index 86a90cf7..57cc20eb 100644 --- a/tests/test_kernels/config_file/Cargo.toml +++ b/tests/test_kernels/config_file/Cargo.toml @@ -2,7 +2,7 @@ name = "test_kernel_config_file" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/config_file/src/bin/custom_config.rs b/tests/test_kernels/config_file/src/bin/custom_config.rs index 425e268a..1a42067c 100644 --- a/tests/test_kernels/config_file/src/bin/custom_config.rs +++ b/tests/test_kernels/config_file/src/bin/custom_config.rs @@ -1,9 +1,9 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; use core::fmt::Write; -use test_kernel_config_file::{exit_qemu, serial, QemuExitCode}; +use test_kernel_config_file::{QemuExitCode, exit_qemu, serial}; entry_point!(kernel_main); diff --git a/tests/test_kernels/config_file/src/bin/no_config.rs b/tests/test_kernels/config_file/src/bin/no_config.rs index d0898bde..7ab98864 100644 --- a/tests/test_kernels/config_file/src/bin/no_config.rs +++ b/tests/test_kernels/config_file/src/bin/no_config.rs @@ -1,9 +1,9 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; use core::fmt::Write; -use test_kernel_config_file::{exit_qemu, serial, QemuExitCode}; +use test_kernel_config_file::{QemuExitCode, exit_qemu, serial}; entry_point!(kernel_main); diff --git a/tests/test_kernels/default_settings/Cargo.toml b/tests/test_kernels/default_settings/Cargo.toml index 8d643cdd..276ff900 100644 --- a/tests/test_kernels/default_settings/Cargo.toml +++ b/tests/test_kernels/default_settings/Cargo.toml @@ -2,7 +2,7 @@ name = "test_kernel_default_settings" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/default_settings/src/bin/basic_boot.rs b/tests/test_kernels/default_settings/src/bin/basic_boot.rs index e2b7cc0b..d60dba6a 100644 --- a/tests/test_kernels/default_settings/src/bin/basic_boot.rs +++ b/tests/test_kernels/default_settings/src/bin/basic_boot.rs @@ -1,9 +1,9 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; use core::fmt::Write; -use test_kernel_default_settings::{exit_qemu, serial, QemuExitCode}; +use test_kernel_default_settings::{QemuExitCode, exit_qemu, serial}; entry_point!(kernel_main); diff --git a/tests/test_kernels/default_settings/src/bin/check_boot_info.rs b/tests/test_kernels/default_settings/src/bin/check_boot_info.rs index bc8fbad7..1960eeff 100644 --- a/tests/test_kernels/default_settings/src/bin/check_boot_info.rs +++ b/tests/test_kernels/default_settings/src/bin/check_boot_info.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, info::PixelFormat, BootInfo}; -use test_kernel_default_settings::{exit_qemu, QemuExitCode}; +use bootloader_api::{BootInfo, entry_point, info::PixelFormat}; +use test_kernel_default_settings::{QemuExitCode, exit_qemu}; entry_point!(kernel_main); diff --git a/tests/test_kernels/default_settings/src/bin/should_panic.rs b/tests/test_kernels/default_settings/src/bin/should_panic.rs index 0f78d0ba..1a9c66c2 100644 --- a/tests/test_kernels/default_settings/src/bin/should_panic.rs +++ b/tests/test_kernels/default_settings/src/bin/should_panic.rs @@ -1,7 +1,7 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; entry_point!(kernel_main); @@ -13,6 +13,6 @@ fn kernel_main(_boot_info: &'static mut BootInfo) -> ! { #[cfg(not(test))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { - use test_kernel_default_settings::{exit_qemu, QemuExitCode}; + use test_kernel_default_settings::{QemuExitCode, exit_qemu}; exit_qemu(QemuExitCode::Success); } diff --git a/tests/test_kernels/fixed_kernel_address/Cargo.toml b/tests/test_kernels/fixed_kernel_address/Cargo.toml index 8a402dca..4d8a872c 100644 --- a/tests/test_kernels/fixed_kernel_address/Cargo.toml +++ b/tests/test_kernels/fixed_kernel_address/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test_kernel_fixed_kernel_address" version = "0.1.0" -edition = "2021" +edition = "2024" [target.'cfg(target_arch = "x86_64")'.dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/fixed_kernel_address/src/bin/basic_boot.rs b/tests/test_kernels/fixed_kernel_address/src/bin/basic_boot.rs index 6d8f696c..fd04f983 100644 --- a/tests/test_kernels/fixed_kernel_address/src/bin/basic_boot.rs +++ b/tests/test_kernels/fixed_kernel_address/src/bin/basic_boot.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_fixed_kernel_address::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_fixed_kernel_address::{BOOTLOADER_CONFIG, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/fixed_kernel_address/src/bin/check_boot_info.rs b/tests/test_kernels/fixed_kernel_address/src/bin/check_boot_info.rs index 24267c7a..7c6468f9 100644 --- a/tests/test_kernels/fixed_kernel_address/src/bin/check_boot_info.rs +++ b/tests/test_kernels/fixed_kernel_address/src/bin/check_boot_info.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_fixed_kernel_address::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG, KERNEL_ADDR}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_fixed_kernel_address::{BOOTLOADER_CONFIG, KERNEL_ADDR, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/fixed_kernel_address/src/bin/should_panic.rs b/tests/test_kernels/fixed_kernel_address/src/bin/should_panic.rs index a005c051..4607c898 100644 --- a/tests/test_kernels/fixed_kernel_address/src/bin/should_panic.rs +++ b/tests/test_kernels/fixed_kernel_address/src/bin/should_panic.rs @@ -1,7 +1,7 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; use test_kernel_fixed_kernel_address::BOOTLOADER_CONFIG; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); @@ -14,7 +14,7 @@ fn kernel_main(_boot_info: &'static mut BootInfo) -> ! { #[cfg(not(test))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { - use test_kernel_fixed_kernel_address::{exit_qemu, QemuExitCode}; + use test_kernel_fixed_kernel_address::{QemuExitCode, exit_qemu}; exit_qemu(QemuExitCode::Success); } diff --git a/tests/test_kernels/fixed_kernel_address/src/bin/verify_kernel_address.rs b/tests/test_kernels/fixed_kernel_address/src/bin/verify_kernel_address.rs index 13944bd1..6d5728ce 100644 --- a/tests/test_kernels/fixed_kernel_address/src/bin/verify_kernel_address.rs +++ b/tests/test_kernels/fixed_kernel_address/src/bin/verify_kernel_address.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_fixed_kernel_address::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG, KERNEL_ADDR}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_fixed_kernel_address::{BOOTLOADER_CONFIG, KERNEL_ADDR, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/fixed_kernel_address/src/lib.rs b/tests/test_kernels/fixed_kernel_address/src/lib.rs index 1231418a..9a8212e2 100644 --- a/tests/test_kernels/fixed_kernel_address/src/lib.rs +++ b/tests/test_kernels/fixed_kernel_address/src/lib.rs @@ -1,6 +1,6 @@ #![no_std] -use bootloader_api::{config::Mapping, BootloaderConfig}; +use bootloader_api::{BootloaderConfig, config::Mapping}; pub const KERNEL_ADDR: u64 = 0x1987_6543_0000; diff --git a/tests/test_kernels/higher_half/Cargo.toml b/tests/test_kernels/higher_half/Cargo.toml index b7d7f2c7..c215c8b3 100644 --- a/tests/test_kernels/higher_half/Cargo.toml +++ b/tests/test_kernels/higher_half/Cargo.toml @@ -4,7 +4,7 @@ cargo-features = ["profile-rustflags"] name = "test_kernel_higher_half" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/higher_half/src/bin/basic_boot.rs b/tests/test_kernels/higher_half/src/bin/basic_boot.rs index 4133963e..8f6c1a20 100644 --- a/tests/test_kernels/higher_half/src/bin/basic_boot.rs +++ b/tests/test_kernels/higher_half/src/bin/basic_boot.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_higher_half::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_higher_half::{BOOTLOADER_CONFIG, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/higher_half/src/bin/check_boot_info.rs b/tests/test_kernels/higher_half/src/bin/check_boot_info.rs index 3cc96c3c..6367d89e 100644 --- a/tests/test_kernels/higher_half/src/bin/check_boot_info.rs +++ b/tests/test_kernels/higher_half/src/bin/check_boot_info.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, info::PixelFormat, BootInfo}; -use test_kernel_higher_half::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG}; +use bootloader_api::{BootInfo, entry_point, info::PixelFormat}; +use test_kernel_higher_half::{BOOTLOADER_CONFIG, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/higher_half/src/bin/should_panic.rs b/tests/test_kernels/higher_half/src/bin/should_panic.rs index 44287806..a2366713 100644 --- a/tests/test_kernels/higher_half/src/bin/should_panic.rs +++ b/tests/test_kernels/higher_half/src/bin/should_panic.rs @@ -1,7 +1,7 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; use test_kernel_higher_half::BOOTLOADER_CONFIG; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); @@ -14,7 +14,7 @@ fn kernel_main(_boot_info: &'static mut BootInfo) -> ! { #[cfg(not(test))] #[panic_handler] fn panic(_info: &core::panic::PanicInfo) -> ! { - use test_kernel_higher_half::{exit_qemu, QemuExitCode}; + use test_kernel_higher_half::{QemuExitCode, exit_qemu}; exit_qemu(QemuExitCode::Success); } diff --git a/tests/test_kernels/higher_half/src/bin/verify_higher_half.rs b/tests/test_kernels/higher_half/src/bin/verify_higher_half.rs index 79a1e964..159ae3b3 100644 --- a/tests/test_kernels/higher_half/src/bin/verify_higher_half.rs +++ b/tests/test_kernels/higher_half/src/bin/verify_higher_half.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_higher_half::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_higher_half::{BOOTLOADER_CONFIG, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/lower_memory_free/Cargo.toml b/tests/test_kernels/lower_memory_free/Cargo.toml index be0249c7..643c33fe 100644 --- a/tests/test_kernels/lower_memory_free/Cargo.toml +++ b/tests/test_kernels/lower_memory_free/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test_kernel_lower_memory_free" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/lower_memory_free/src/bin/lower_memory_free.rs b/tests/test_kernels/lower_memory_free/src/bin/lower_memory_free.rs index 9620d1ca..e788fb3c 100644 --- a/tests/test_kernels/lower_memory_free/src/bin/lower_memory_free.rs +++ b/tests/test_kernels/lower_memory_free/src/bin/lower_memory_free.rs @@ -2,9 +2,9 @@ #![no_main] // disable all Rust-level entry points use bootloader_api::{ - config::Mapping, entry_point, info::MemoryRegionKind, BootInfo, BootloaderConfig, + BootInfo, BootloaderConfig, config::Mapping, entry_point, info::MemoryRegionKind, }; -use test_kernel_lower_memory_free::{exit_qemu, QemuExitCode}; +use test_kernel_lower_memory_free::{QemuExitCode, exit_qemu}; const LOWER_MEMORY_END_PAGE: u64 = 0x0010_0000; diff --git a/tests/test_kernels/map_phys_mem/Cargo.toml b/tests/test_kernels/map_phys_mem/Cargo.toml index 5dcb5b16..7850d9f3 100644 --- a/tests/test_kernels/map_phys_mem/Cargo.toml +++ b/tests/test_kernels/map_phys_mem/Cargo.toml @@ -2,7 +2,7 @@ name = "test_kernel_map_phys_mem" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [target.'cfg(target_arch = "x86_64")'.dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/map_phys_mem/src/bin/access_phys_mem.rs b/tests/test_kernels/map_phys_mem/src/bin/access_phys_mem.rs index 538362fb..67bc97e3 100644 --- a/tests/test_kernels/map_phys_mem/src/bin/access_phys_mem.rs +++ b/tests/test_kernels/map_phys_mem/src/bin/access_phys_mem.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_map_phys_mem::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_map_phys_mem::{BOOTLOADER_CONFIG, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/map_phys_mem/src/bin/check_boot_info.rs b/tests/test_kernels/map_phys_mem/src/bin/check_boot_info.rs index 5b3a8610..d672fa2e 100644 --- a/tests/test_kernels/map_phys_mem/src/bin/check_boot_info.rs +++ b/tests/test_kernels/map_phys_mem/src/bin/check_boot_info.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, info::PixelFormat, BootInfo}; -use test_kernel_map_phys_mem::{exit_qemu, QemuExitCode, BOOTLOADER_CONFIG}; +use bootloader_api::{BootInfo, entry_point, info::PixelFormat}; +use test_kernel_map_phys_mem::{BOOTLOADER_CONFIG, QemuExitCode, exit_qemu}; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG); diff --git a/tests/test_kernels/map_phys_mem/src/lib.rs b/tests/test_kernels/map_phys_mem/src/lib.rs index cfd76ad5..86301304 100644 --- a/tests/test_kernels/map_phys_mem/src/lib.rs +++ b/tests/test_kernels/map_phys_mem/src/lib.rs @@ -1,6 +1,6 @@ #![no_std] -use bootloader_api::{config::Mapping, BootloaderConfig}; +use bootloader_api::{BootloaderConfig, config::Mapping}; pub const BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); diff --git a/tests/test_kernels/min_stack/Cargo.toml b/tests/test_kernels/min_stack/Cargo.toml index 82aae6d3..b2864ee8 100644 --- a/tests/test_kernels/min_stack/Cargo.toml +++ b/tests/test_kernels/min_stack/Cargo.toml @@ -2,7 +2,7 @@ name = "test_kernel_min_stack" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/min_stack/src/bin/basic_boot.rs b/tests/test_kernels/min_stack/src/bin/basic_boot.rs index 29a6602d..54aff95d 100644 --- a/tests/test_kernels/min_stack/src/bin/basic_boot.rs +++ b/tests/test_kernels/min_stack/src/bin/basic_boot.rs @@ -1,9 +1,9 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo, BootloaderConfig}; +use bootloader_api::{BootInfo, BootloaderConfig, entry_point}; use core::fmt::Write; -use test_kernel_min_stack::{exit_qemu, serial, QemuExitCode}; +use test_kernel_min_stack::{QemuExitCode, exit_qemu, serial}; const BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); diff --git a/tests/test_kernels/ramdisk/Cargo.toml b/tests/test_kernels/ramdisk/Cargo.toml index 0ca537e7..cc48a77e 100644 --- a/tests/test_kernels/ramdisk/Cargo.toml +++ b/tests/test_kernels/ramdisk/Cargo.toml @@ -2,7 +2,7 @@ name = "test_kernel_ramdisk" version = "0.1.0" authors = ["Philipp Oppermann "] -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/ramdisk/src/bin/basic_boot.rs b/tests/test_kernels/ramdisk/src/bin/basic_boot.rs index 949c878b..b81b5389 100644 --- a/tests/test_kernels/ramdisk/src/bin/basic_boot.rs +++ b/tests/test_kernels/ramdisk/src/bin/basic_boot.rs @@ -1,8 +1,8 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; -use test_kernel_ramdisk::{exit_qemu, QemuExitCode}; +use bootloader_api::{BootInfo, entry_point}; +use test_kernel_ramdisk::{QemuExitCode, exit_qemu}; entry_point!(kernel_main); diff --git a/tests/test_kernels/ramdisk/src/bin/memory_map.rs b/tests/test_kernels/ramdisk/src/bin/memory_map.rs index b939a420..ce148cdf 100644 --- a/tests/test_kernels/ramdisk/src/bin/memory_map.rs +++ b/tests/test_kernels/ramdisk/src/bin/memory_map.rs @@ -2,13 +2,13 @@ #![no_main] // disable all Rust-level entry points use bootloader_api::{ - config::Mapping, entry_point, info::MemoryRegionKind, BootInfo, BootloaderConfig, + BootInfo, BootloaderConfig, config::Mapping, entry_point, info::MemoryRegionKind, }; use core::{fmt::Write, ptr::slice_from_raw_parts}; -use test_kernel_ramdisk::{exit_qemu, serial, QemuExitCode, RAMDISK_CONTENTS}; +use test_kernel_ramdisk::{QemuExitCode, RAMDISK_CONTENTS, exit_qemu, serial}; use x86_64::{ - structures::paging::{OffsetPageTable, PageTable, PageTableFlags, Translate}, VirtAddr, + structures::paging::{OffsetPageTable, PageTable, PageTableFlags, Translate}, }; pub const BOOTLOADER_CONFIG: BootloaderConfig = { @@ -84,5 +84,5 @@ pub unsafe fn active_level_4_table(physical_memory_offset: VirtAddr) -> &'static let virt = physical_memory_offset + phys.as_u64(); let page_table_ptr: *mut PageTable = virt.as_mut_ptr(); - &mut *page_table_ptr // unsafe + unsafe { &mut *page_table_ptr } } diff --git a/tests/test_kernels/ramdisk/src/bin/ramdisk.rs b/tests/test_kernels/ramdisk/src/bin/ramdisk.rs index 44fb5cd6..d3d29573 100644 --- a/tests/test_kernels/ramdisk/src/bin/ramdisk.rs +++ b/tests/test_kernels/ramdisk/src/bin/ramdisk.rs @@ -1,9 +1,9 @@ #![no_std] // don't link the Rust standard library #![no_main] // disable all Rust-level entry points -use bootloader_api::{entry_point, BootInfo}; +use bootloader_api::{BootInfo, entry_point}; use core::{fmt::Write, ptr::slice_from_raw_parts}; -use test_kernel_ramdisk::{exit_qemu, serial, QemuExitCode, RAMDISK_CONTENTS}; +use test_kernel_ramdisk::{QemuExitCode, RAMDISK_CONTENTS, exit_qemu, serial}; entry_point!(kernel_main); diff --git a/tests/test_kernels/write_usable_memory/Cargo.toml b/tests/test_kernels/write_usable_memory/Cargo.toml index 200abc9d..1a9d1f96 100644 --- a/tests/test_kernels/write_usable_memory/Cargo.toml +++ b/tests/test_kernels/write_usable_memory/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "test_kernel_write_usable_memory" version = "0.1.0" -edition = "2021" +edition = "2024" [dependencies] bootloader_api = { path = "../../../api" } diff --git a/tests/test_kernels/write_usable_memory/src/bin/write_usable_memory.rs b/tests/test_kernels/write_usable_memory/src/bin/write_usable_memory.rs index 95a27d37..9e6bb258 100644 --- a/tests/test_kernels/write_usable_memory/src/bin/write_usable_memory.rs +++ b/tests/test_kernels/write_usable_memory/src/bin/write_usable_memory.rs @@ -2,9 +2,9 @@ #![no_main] // disable all Rust-level entry points use bootloader_api::{ - config::Mapping, entry_point, info::MemoryRegionKind, BootInfo, BootloaderConfig, + BootInfo, BootloaderConfig, config::Mapping, entry_point, info::MemoryRegionKind, }; -use test_kernel_write_usable_memory::{exit_qemu, QemuExitCode}; +use test_kernel_write_usable_memory::{QemuExitCode, exit_qemu}; pub const BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); diff --git a/uefi/Cargo.toml b/uefi/Cargo.toml index 9e96ce64..99128c74 100644 --- a/uefi/Cargo.toml +++ b/uefi/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bootloader-x86_64-uefi" version.workspace = true -edition = "2021" +edition = "2024" description = "UEFI bootloader for x86_64" license.workspace = true repository.workspace = true diff --git a/uefi/src/main.rs b/uefi/src/main.rs index 99a4821c..b3b9f0df 100644 --- a/uefi/src/main.rs +++ b/uefi/src/main.rs @@ -6,7 +6,7 @@ use crate::memory_descriptor::UefiMemoryDescriptor; use bootloader_api::info::FrameBufferInfo; use bootloader_boot_config::BootConfig; use bootloader_x86_64_common::{ - legacy_memory_region::LegacyFrameAllocator, Kernel, RawFrameBufferInfo, SystemInfo, + Kernel, RawFrameBufferInfo, SystemInfo, legacy_memory_region::LegacyFrameAllocator, }; use core::{ cell::UnsafeCell, @@ -14,8 +14,10 @@ use core::{ ptr, slice, }; use uefi::{ - prelude::{entry, Boot, Handle, Status, SystemTable}, + CStr8, CStr16, + prelude::{Boot, Handle, Status, SystemTable, entry}, proto::{ + ProtocolPointer, console::gop::{GraphicsOutput, PixelFormat}, device_path::DevicePath, loaded_image::LoadedImage, @@ -24,19 +26,17 @@ use uefi::{ fs::SimpleFileSystem, }, network::{ - pxe::{BaseCode, DhcpV4Packet}, IpAddress, + pxe::{BaseCode, DhcpV4Packet}, }, - ProtocolPointer, }, table::boot::{ AllocateType, MemoryType, OpenProtocolAttributes, OpenProtocolParams, ScopedProtocol, }, - CStr16, CStr8, }; use x86_64::{ - structures::paging::{FrameAllocator, OffsetPageTable, PageTable, PhysFrame, Size4KiB}, PhysAddr, VirtAddr, + structures::paging::{FrameAllocator, OffsetPageTable, PageTable, PhysFrame, Size4KiB}, }; mod memory_descriptor;