Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions uefi-raw/src/protocol/console.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,9 @@ pub struct SimplePointerState {
#[derive(Debug)]
#[repr(C)]
pub struct SimplePointerProtocol {
pub reset: unsafe extern "efiapi" fn(
this: *mut SimplePointerProtocol,
extended_verification: Boolean,
) -> Status,
pub get_state: unsafe extern "efiapi" fn(
this: *mut SimplePointerProtocol,
state: *mut SimplePointerState,
) -> Status,
pub reset: unsafe extern "efiapi" fn(this: *mut Self, extended_verification: Boolean) -> Status,
pub get_state:
unsafe extern "efiapi" fn(this: *mut Self, state: *mut SimplePointerState) -> Status,
pub wait_for_input: Event,
pub mode: *const SimplePointerMode,
}
Expand Down
4 changes: 2 additions & 2 deletions uefi-raw/src/protocol/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use core::ffi::c_void;
#[repr(C)]
pub struct LoadFileProtocol {
pub load_file: unsafe extern "efiapi" fn(
this: *mut LoadFileProtocol,
this: *mut Self,
file_path: *const DevicePathProtocol,
boot_policy: Boolean,
buffer_size: *mut usize,
Expand All @@ -24,7 +24,7 @@ impl LoadFileProtocol {
#[repr(C)]
pub struct LoadFile2Protocol {
pub load_file: unsafe extern "efiapi" fn(
this: *mut LoadFile2Protocol,
this: *mut Self,
file_path: *const DevicePathProtocol,
boot_policy: Boolean,
buffer_size: *mut usize,
Expand Down
4 changes: 2 additions & 2 deletions uefi-raw/src/protocol/rng.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ newtype_enum! {
#[repr(C)]
pub struct RngProtocol {
pub get_info: unsafe extern "efiapi" fn(
this: *mut RngProtocol,
this: *mut Self,
algorithm_list_size: *mut usize,
algorithm_list: *mut RngAlgorithmType,
) -> Status,

pub get_rng: unsafe extern "efiapi" fn(
this: *mut RngProtocol,
this: *mut Self,
algorithm: *const RngAlgorithmType,
value_length: usize,
value: *mut u8,
Expand Down
4 changes: 2 additions & 2 deletions uefi-raw/src/protocol/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use bitflags::bitflags;
#[derive(Debug)]
#[repr(C)]
pub struct ListEntry {
pub f_link: *mut ListEntry,
pub b_link: *mut ListEntry,
pub f_link: *mut Self,
pub b_link: *mut Self,
}

/// ShellFileInfo for File Lists
Expand Down
10 changes: 5 additions & 5 deletions uefi-test-runner/src/boot/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,14 @@ mod bootservices {
/// global allocator.
mod global {
use alloc::boxed::Box;
use core::ops::Deref;
use uefi_raw::table::boot::PAGE_SIZE;

/// Simple test to ensure our custom allocator works with the `alloc` crate.
pub fn alloc_vec() {
info!("Allocating a vector using the global allocator");

#[allow(clippy::useless_vec)]
let mut values = vec![-5, 16, 23, 4, 0];

let mut values = Box::new([-5, 16, 23, 4, 0]);
values.sort_unstable();

assert_eq!(values[..], [-5, 0, 4, 16, 23], "Failed to sort vector");
Expand All @@ -115,8 +114,9 @@ mod global {
#[repr(align(0x100))]
struct Block([u8; 0x100]);

let value = vec![Block([1; 0x100])];
assert_eq!(value.as_ptr() as usize % 0x100, 0, "Wrong alignment");
let value = Box::new(Block([1; 0x100]));
let inner_value = value.deref();
assert_eq!(align_of_val(inner_value), 0x100, "Wrong alignment");
}
{
info!("Allocating a memory page ({PAGE_SIZE}) using the global allocator");
Expand Down
16 changes: 8 additions & 8 deletions uefi/src/proto/debug/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ mod exception;
pub struct DebugSupport {
isa: ProcessorArch,
get_maximum_processor_index:
extern "efiapi" fn(this: &mut DebugSupport, max_processor_index: &mut usize) -> Status,
extern "efiapi" fn(this: &mut Self, max_processor_index: &mut usize) -> Status,
register_periodic_callback: unsafe extern "efiapi" fn(
this: &mut DebugSupport,
this: &mut Self,
processor_index: usize,
periodic_callback: Option<unsafe extern "efiapi" fn(SystemContext)>,
) -> Status,
register_exception_callback: unsafe extern "efiapi" fn(
this: &mut DebugSupport,
this: &mut Self,
processor_index: usize,
exception_callback: Option<unsafe extern "efiapi" fn(ExceptionType, SystemContext)>,
exception_type: ExceptionType,
) -> Status,
invalidate_instruction_cache: unsafe extern "efiapi" fn(
this: &mut DebugSupport,
this: &mut Self,
processor_index: usize,
start: *mut c_void,
length: u64,
Expand Down Expand Up @@ -192,20 +192,20 @@ pub enum ProcessorArch: u32 => {
#[repr(C)]
#[unsafe_protocol("eba4e8d2-3858-41ec-a281-2647ba9660d0")]
pub struct DebugPort {
reset: extern "efiapi" fn(this: &DebugPort) -> Status,
reset: extern "efiapi" fn(this: &Self) -> Status,
write: extern "efiapi" fn(
this: &DebugPort,
this: &Self,
timeout: u32,
buffer_size: &mut usize,
buffer: *const c_void,
) -> Status,
read: extern "efiapi" fn(
this: &DebugPort,
this: &Self,
timeout: u32,
buffer_size: &mut usize,
buffer: *mut c_void,
) -> Status,
poll: extern "efiapi" fn(this: &DebugPort) -> Status,
poll: extern "efiapi" fn(this: &Self) -> Status,
}

impl DebugPort {
Expand Down
14 changes: 7 additions & 7 deletions uefi/src/proto/pi/mp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,17 @@ pub struct CpuPhysicalLocation {
#[unsafe_protocol("3fdda605-a76e-4f46-ad29-12f4531b3d08")]
pub struct MpServices {
get_number_of_processors: extern "efiapi" fn(
this: *const MpServices,
this: *const Self,
number_of_processors: *mut usize,
number_of_enabled_processors: *mut usize,
) -> Status,
get_processor_info: extern "efiapi" fn(
this: *const MpServices,
this: *const Self,
processor_number: usize,
processor_info_buffer: *mut ProcessorInformation,
) -> Status,
startup_all_aps: extern "efiapi" fn(
this: *const MpServices,
this: *const Self,
procedure: Procedure,
single_thread: bool,
wait_event: *mut c_void,
Expand All @@ -124,7 +124,7 @@ pub struct MpServices {
failed_cpu_list: *mut *mut usize,
) -> Status,
startup_this_ap: extern "efiapi" fn(
this: *const MpServices,
this: *const Self,
procedure: Procedure,
processor_number: usize,
wait_event: *mut c_void,
Expand All @@ -133,17 +133,17 @@ pub struct MpServices {
finished: *mut bool,
) -> Status,
switch_bsp: extern "efiapi" fn(
this: *const MpServices,
this: *const Self,
processor_number: usize,
enable_old_bsp: bool,
) -> Status,
enable_disable_ap: extern "efiapi" fn(
this: *const MpServices,
this: *const Self,
processor_number: usize,
enable_ap: bool,
health_flag: *const u32,
) -> Status,
who_am_i: extern "efiapi" fn(this: *const MpServices, processor_number: *mut usize) -> Status,
who_am_i: extern "efiapi" fn(this: *const Self, processor_number: *mut usize) -> Status,
}

impl MpServices {
Expand Down
9 changes: 2 additions & 7 deletions xtask/src/arch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use std::fmt;

#[derive(Clone, Copy, Debug, Eq, PartialEq, clap::ValueEnum)]
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, clap::ValueEnum)]
pub enum UefiArch {
#[value(name = "aarch64")]
AArch64,
Expand All @@ -11,6 +11,7 @@ pub enum UefiArch {
IA32,

#[value(name = "x86_64")]
#[default]
X86_64,
}

Expand All @@ -32,12 +33,6 @@ impl UefiArch {
}
}

impl Default for UefiArch {
fn default() -> Self {
Self::X86_64
}
}

impl fmt::Display for UefiArch {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.as_str())
Expand Down
Loading