Struct stivale_boot::v2::StivaleSmpTag
source · [−]#[repr(C)]pub struct StivaleSmpTag {
pub flags: StivaleSmpHeaderTagFlags,
pub bsp_lapic_id: u32,
pub unused: u32,
pub smp_info_array: [StivaleSmpInfo],
/* private fields */
}
Fields
flags: StivaleSmpHeaderTagFlags
bsp_lapic_id: u32
LAPIC ID of the BSP (bootstrap processor).
unused: u32
Stivale specification says that this field is reserved for future use.
smp_info_array: [StivaleSmpInfo]
The variable length SMP info array (including BSP).
Implementations
sourceimpl StivaleSmpTag
impl StivaleSmpTag
sourcepub fn header(&self) -> &StivaleTagHeader
pub fn header(&self) -> &StivaleTagHeader
Return’s the tag header
sourcepub fn as_slice(&self) -> &[StivaleSmpInfo]
pub fn as_slice(&self) -> &[StivaleSmpInfo]
Return’s the SMP info array pointer as a rust slice.
sourcepub unsafe fn as_slice_mut(&mut self) -> &mut [StivaleSmpInfo]
pub unsafe fn as_slice_mut(&mut self) -> &mut [StivaleSmpInfo]
Return’s the SMP info array pointer as a mutable rust slice.
Safety
If this tag was returned by a bootloader mutating the slice must conform to the following rules in order to not trigger UB:
- Writing to
StivaleSmpInfo::goto_address
will cause it to start executing at the provided address as such a proper stack must have been set atStivaleSmpInfo::target_stack
already if a stack is needed. - The stack pointer written to
StivaleSmpInfo::target_stack
must not alias already mapped memory, this means that the memory area dedicated to the stack must be exclusively used for the AP stack and stack overflows can trigger UB (consider using a guard page). - The address pointed by
StivaleSmpInfo::goto_address
must be that of aextern "C" fn(&'static StivaleSmpInfo) -> !
, this also means that once written this struct must not be mutated any further.
sourcepub unsafe fn new_from_ptr_count(ptr: *mut (), cpu_count: u64) -> *mut Self
pub unsafe fn new_from_ptr_count(ptr: *mut (), cpu_count: u64) -> *mut Self
Safety
ptr
must be a pointer to a properly initialized StivaleSmpTag
struct with cpu_count
entries in the smp_info_array
.