dev: rework device management (&'static -> Arc)

This commit is contained in:
2024-12-10 11:52:26 +02:00
parent 18bfeaf917
commit 56fbcefa80
125 changed files with 3493 additions and 3407 deletions
+10 -8
View File
@@ -9,7 +9,7 @@ use core::{
sync::atomic::{AtomicUsize, Ordering},
};
use alloc::vec::Vec;
use alloc::{boxed::Box, vec::Vec};
use device_api::interrupt::{LocalInterruptController, MessageInterruptController};
use kernel_arch_interface::{
cpu::{CpuImpl, IpiQueue},
@@ -52,14 +52,16 @@ pub struct PerCpuData {
// 0x10, used in assembly
pub tmp_address: usize,
pub local_apic: &'static dyn LocalApicInterface,
pub local_apic: Box<dyn LocalApicInterface>,
// pub local_apic: &'static dyn LocalApicInterface,
pub available_features: CpuFeatures,
pub enabled_features: CpuFeatures,
}
impl PerCpuData {
pub fn local_apic(&self) -> &'static dyn LocalApicInterface {
self.local_apic
#[inline]
pub fn local_apic(&self) -> &dyn LocalApicInterface {
self.local_apic.as_ref()
}
}
@@ -182,12 +184,12 @@ impl Architecture for ArchitectureImpl {
fn local_interrupt_controller() -> Option<&'static dyn LocalInterruptController> {
let cpu = Self::local_cpu_data()?;
Some(cpu.local_apic)
Some(cpu.local_apic.as_ref())
}
fn message_interrupt_controller() -> &'static dyn MessageInterruptController {
let local = Self::local_cpu_data().unwrap();
local.local_apic
fn message_interrupt_controller() -> Option<&'static dyn MessageInterruptController> {
let cpu = Self::local_cpu_data()?;
Some(cpu.local_apic.as_ref())
}
fn cpu_enabled_features<S: Scheduler>(cpu: &CpuImpl<Self, S>) -> Option<&Self::CpuFeatures> {
+1 -1
View File
@@ -56,7 +56,7 @@ split_spinlock! {
use libk_mm_interface::KernelImageObject;
#[link_section = ".data.tables"]
static KERNEL_TABLES<lock: ArchitectureImpl>: KernelImageObject<FixedTables> =
static KERNEL_TABLES @ inner<lock: ArchitectureImpl>: KernelImageObject<FixedTables> =
unsafe { KernelImageObject::new(FixedTables::zeroed()) };
}