Skip to content

Commit

Permalink
kernel: add Tab system for resource allocation and tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
Qix- committed Jan 19, 2025
1 parent 7a90367 commit dc9d880
Show file tree
Hide file tree
Showing 5 changed files with 978 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions oro-kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,20 @@ license = "MPL-2.0"

[features]
default = ["boot-vbuf-v0"]

# Enable the root ring boot-time video buffer interface.
boot-vbuf-v0 = ["dep:oro-boot-protocol"]

# Allow IDs to be reused when they exhaust their version space.
# Instead of turning into tombstones, they are made alive again and reused.
# SAFETY(qix-): Enabling this feature may cause ABA issues in some cases.
# SAFETY(qix-): Therefore, it is disabled by default.
zombie-tombs = []

# Debugs tombstones in the global table.
# If enabled, tombstones will occur after 255 frees of a slot.
debug-tombs = []

[dependencies]
oro-mem.workspace = true
oro-macro.workspace = true
Expand All @@ -23,6 +35,7 @@ oro-debug.workspace = true
oro-sync.workspace = true
oro-sysabi.workspace = true
oro-boot-protocol = { workspace = true, optional = true, features = ["utils"] }
oro-dbgutil.workspace = true

hashbrown.workspace = true

Expand Down
10 changes: 10 additions & 0 deletions oro-kernel/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
// SAFETY(qix-): Necessary to make the hashbrown crate wrapper work.
// SAFETY(qix-): https://github.com/rust-lang/rust/issues/32838
#![feature(allocator_api)]
// SAFETY(qix-): Needed for the global table to initialize arrays of null pointers
// SAFETY(qix-): safely, in order not to assume that `null == 0` (which is true on
// SAFETY(qix-): most platforms, but is not specified anywhere). Technically we could
// SAFETY(qix-): eschew this given that _we're the ones making a platform_ but it's still
// SAFETY(qix-): a good idea to be explicit.
#![feature(maybe_uninit_uninit_array)]
// SAFETY(qix-): To be stabilized soon. Needed for the global table.
// SAFETY(qix-): https://github.com/rust-lang/rust/issues/96097
#![feature(maybe_uninit_array_assume_init)]
#![cfg_attr(doc, feature(doc_cfg, doc_auto_cfg))]

pub mod arch;
Expand All @@ -30,6 +39,7 @@ pub mod registry;
pub mod ring;
pub mod scheduler;
pub mod sync;
pub mod tab;
pub mod table;
pub mod thread;

Expand Down
2 changes: 1 addition & 1 deletion oro-kernel/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ static HAS_SET_KERNEL_ID_FN: core::sync::atomic::AtomicBool =
/// [`oro_sync::ReentrantLock`] implementation.
#[doc(hidden)]
#[no_mangle]
unsafe extern "C" fn oro_sync_current_core_id() -> u32 {
pub(crate) unsafe extern "C" fn oro_sync_current_core_id() -> u32 {
#[cfg(debug_assertions)]
{
assert!(
Expand Down
Loading

0 comments on commit dc9d880

Please sign in to comment.