Skip to content

Commit

Permalink
kernel: remove global modules list
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Jan 20, 2025
1 parent 7b4340f commit 32ce794
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
14 changes: 3 additions & 11 deletions oro-kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ use core::mem::MaybeUninit;

use oro_macro::assert;
use oro_mem::{
alloc::{
sync::{Arc, Weak},
vec::Vec,
},
alloc::{sync::Arc, vec::Vec},
global_alloc::GlobalPfa,
mapper::{AddressSegment, AddressSpace as _, MapError},
pfa::Alloc,
Expand Down Expand Up @@ -212,17 +209,13 @@ impl<A: Arch> Kernel<A> {
/// Global state shared by all [`Kernel`] instances across
/// core boot/powerdown/bringup cycles.
pub struct KernelState<A: Arch> {
/// List of all modules.
modules: TicketMutex<Vec<Weak<ReentrantMutex<module::Module<A>>>>>,
/// List of all threads.
threads: TicketMutex<Vec<tab::Tab<thread::Thread<A>>>>,

threads: TicketMutex<Vec<tab::Tab<thread::Thread<A>>>>,
/// The root ring.
root_ring: Arc<ReentrantMutex<ring::Ring<A>>>,

/// The system-wide registry, loaded at boot with all of the "static" kernel
/// interfaces.
registry: Arc<ReentrantMutex<RootRegistry<A>>>,
registry: Arc<ReentrantMutex<RootRegistry<A>>>,
}

impl<A: Arch> KernelState<A> {
Expand Down Expand Up @@ -270,7 +263,6 @@ impl<A: Arch> KernelState<A> {

this.write(Self {
root_ring,
modules: TicketMutex::default(),
threads: TicketMutex::default(),
registry,
});
Expand Down
8 changes: 1 addition & 7 deletions oro-kernel/src/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use oro_mem::{
};
use oro_sync::{Lock, ReentrantMutex};

use crate::{AddressSpace, Kernel, UserHandle, arch::Arch, instance::Instance};
use crate::{AddressSpace, UserHandle, arch::Arch, instance::Instance};

/// A singular executable module.
///
Expand Down Expand Up @@ -56,12 +56,6 @@ impl<A: Arch> Module<A> {
entry_points: Vec::new(),
}));

Kernel::<A>::get()
.state()
.modules
.lock()
.push(Arc::downgrade(&r));

Ok(r)
}

Expand Down

0 comments on commit 32ce794

Please sign in to comment.