Skip to content

Commit

Permalink
kernel: don't allow default construction of CoreConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Jul 28, 2024
1 parent 871fe7d commit f94cd73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
15 changes: 15 additions & 0 deletions oro-common/src/boot.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//! Boot protocol types and serializer implementation.
//! Provides boot-time information to the kernel from the boot
//! stage configuration.
//!
//! Note that no core-specific information is provided here, as
//! that is handled by passing information to the kernel via
//! architecture-specific transfer stubs.
#[repr(C, align(4096))]
pub struct BootConfig {
/// The total number of cores being booted.
pub core_count: u64,
/// The physical address of the top of the page frame allocator stack.
pub pfa_stack_top: u64,
}
4 changes: 1 addition & 3 deletions oro-kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use oro_common::Arch;
///
/// All general, system-wide configuration should be stored
/// in the boot protocol configuration otherwise.
#[derive(Default)]
#[repr(C, align(16))]
pub struct CoreConfig {
/// The core ID.
Expand All @@ -32,15 +31,14 @@ pub struct CoreConfig {
}

/// The core type.
#[derive(Default, PartialEq, Eq, Copy, Clone)]
#[derive(PartialEq, Eq, Copy, Clone)]
pub enum CoreType {
/// The core is the primary core.
///
/// # Safety
/// Exactly one core must be marked as primary.
Primary,
/// The core is a secondary core.
#[default]
Secondary,
}

Expand Down

0 comments on commit f94cd73

Please sign in to comment.