Skip to content

Commit

Permalink
fix(arch): remove RAW_BOOT_INFO
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Oct 20, 2024
1 parent bff31ac commit bd58ee5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/arch/aarch64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use core::arch::global_asm;
use core::str;
use core::sync::atomic::{AtomicU32, AtomicU64, Ordering};

use hermit_entry::boot_info::{BootInfo, RawBootInfo};
use hermit_entry::boot_info::BootInfo;

use crate::arch::aarch64::kernel::core_local::*;
use crate::arch::aarch64::kernel::serial::SerialPort;
Expand All @@ -37,7 +37,6 @@ pub(crate) static CURRENT_STACK_ADDRESS: AtomicU64 = AtomicU64::new(0);
#[cfg(target_os = "none")]
global_asm!(include_str!("start.s"));

static mut RAW_BOOT_INFO: Option<&'static RawBootInfo> = None;
static mut BOOT_INFO: Option<BootInfo> = None;

pub fn boot_info() -> &'static BootInfo {
Expand Down
3 changes: 1 addition & 2 deletions src/arch/aarch64/kernel/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use hermit_entry::boot_info::{BootInfo, RawBootInfo};
use hermit_entry::Entry;

use crate::arch::aarch64::kernel::scheduler::TaskStacks;
use crate::arch::aarch64::kernel::{BOOT_INFO, RAW_BOOT_INFO};
use crate::arch::aarch64::kernel::BOOT_INFO;
use crate::KERNEL_STACK_SIZE;

extern "C" {
Expand Down Expand Up @@ -71,7 +71,6 @@ unsafe extern "C" fn pre_init(boot_info: Option<&'static RawBootInfo>, cpu_id: u

if cpu_id == 0 {
unsafe {
RAW_BOOT_INFO = boot_info;
BOOT_INFO = Some(BootInfo::from(*boot_info.unwrap()));
}
crate::boot_processor_main()
Expand Down
3 changes: 1 addition & 2 deletions src/arch/riscv64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use core::ptr;
use core::sync::atomic::{AtomicPtr, AtomicU32, AtomicU64, Ordering};

use fdt::Fdt;
use hermit_entry::boot_info::{BootInfo, RawBootInfo};
use hermit_entry::boot_info::BootInfo;
use hermit_sync::OnceCell;
use riscv::register::sstatus;

Expand All @@ -33,7 +33,6 @@ pub(crate) static mut HARTS_AVAILABLE: Vec<usize> = Vec::new();

/// Kernel header to announce machine features
static BOOT_INFO: OnceCell<BootInfo> = OnceCell::new();
static RAW_BOOT_INFO: AtomicPtr<RawBootInfo> = AtomicPtr::new(ptr::null_mut());
static CPU_ONLINE: AtomicU32 = AtomicU32::new(0);
static CURRENT_BOOT_ID: AtomicU32 = AtomicU32::new(0);
static CURRENT_STACK_ADDRESS: AtomicPtr<()> = AtomicPtr::new(ptr::null_mut());
Expand Down
3 changes: 1 addition & 2 deletions src/arch/riscv64/kernel/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use fdt::Fdt;
use hermit_entry::boot_info::RawBootInfo;
use hermit_entry::Entry;

use super::{get_dtb_ptr, CPU_ONLINE, CURRENT_BOOT_ID, HART_MASK, NUM_CPUS, RAW_BOOT_INFO};
use super::{get_dtb_ptr, CPU_ONLINE, CURRENT_BOOT_ID, HART_MASK, NUM_CPUS};
#[cfg(not(feature = "smp"))]
use crate::arch::riscv64::kernel::processor;
use crate::arch::riscv64::kernel::{BootInfo, BOOT_INFO, CURRENT_STACK_ADDRESS};
Expand Down Expand Up @@ -54,7 +54,6 @@ unsafe extern "C" fn pre_init(hart_id: usize, boot_info: Option<&'static RawBoot

if CPU_ONLINE.load(Ordering::Acquire) == 0 {
unsafe {
RAW_BOOT_INFO.store(boot_info.unwrap() as *const _ as *mut _, Ordering::Relaxed);
BOOT_INFO.set(BootInfo::from(*boot_info.unwrap())).unwrap();
let fdt = Fdt::from_ptr(get_dtb_ptr()).expect("FDT is invalid");
// Init HART_MASK
Expand Down
2 changes: 0 additions & 2 deletions src/arch/x86_64/kernel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ pub(crate) mod systemtime;
#[cfg(feature = "vga")]
mod vga;

static mut RAW_BOOT_INFO: Option<&'static RawBootInfo> = None;
static mut BOOT_INFO: Option<BootInfo> = None;

pub fn boot_info() -> &'static BootInfo {
Expand Down Expand Up @@ -258,7 +257,6 @@ unsafe extern "C" fn pre_init(boot_info: Option<&'static RawBootInfo>, cpu_id: u

if cpu_id == 0 {
unsafe {
RAW_BOOT_INFO = boot_info;
BOOT_INFO = Some(BootInfo::from(*boot_info.unwrap()));
}

Expand Down

0 comments on commit bd58ee5

Please sign in to comment.