diff --git a/.gitmodules b/.gitmodules index 0a0f6ac8..fb61b355 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "slab_allocator"] - path = slab_allocator - url = https://gitlab.redox-os.org/redox-os/slab_allocator [submodule "rmm"] path = rmm url = https://gitlab.redox-os.org/redox-os/rmm.git diff --git a/Cargo.lock b/Cargo.lock index eae15d55..dc61ff05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -28,9 +28,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" [[package]] name = "bit_field" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" +checksum = "1e4b40c7323adcfc0a41c4b88143ed58346ff65a288fc144329c5c45e05d70c6" [[package]] name = "bitfield" @@ -46,9 +46,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.1" +version = "2.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +checksum = "2261d10cca569e4643e526d8dc2e62e433cc8aba21ab764233731f8d369bf394" [[package]] name = "byteorder" @@ -58,18 +58,19 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "cc" -version = "1.2.31" +version = "1.2.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a42d84bb6b69d3a8b3eaacf0d88f179e1929695e1ad012b6cf64d9caaa5fd2" +checksum = "80f41ae168f955c12fb8960b057d70d0ca153fb83182b57d86380443527be7e9" dependencies = [ + "find-msvc-tools", "shlex", ] [[package]] name = "cfg-if" -version = "1.0.1" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +checksum = "2fd1289c04a9ea8cb22300a459a72a385d7c73d3259e2ed7dcb2af674838cfa9" [[package]] name = "equivalent" @@ -82,6 +83,12 @@ name = "fdt" version = "0.2.0-alpha1" source = "git+https://github.com/repnop/fdt.git?rev=2fb1409edd1877c714a0aa36b6a7c5351004be54#2fb1409edd1877c714a0aa36b6a7c5351004be54" +[[package]] +name = "find-msvc-tools" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ced73b1dacfc750a6db6c0a0c3a3853c8b41997e2e2c563dc90804ae6867959" + [[package]] name = "hashbrown" version = "0.14.5" @@ -93,18 +100,18 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.15.4" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d" [[package]] name = "indexmap" -version = "2.10.0" +version = "2.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +checksum = "4b0f83760fb341a774ed326568e19f5a863af4a952def8c39f9ab92fd95b88e5" dependencies = [ "equivalent", - "hashbrown 0.15.4", + "hashbrown 0.16.0", ] [[package]] @@ -113,13 +120,13 @@ version = "0.5.12" dependencies = [ "arrayvec", "bitfield", - "bitflags 2.9.1", + "bitflags 2.9.4", "byteorder", "cc", "fdt", "hashbrown 0.14.5", "indexmap", - "linked_list_allocator 0.9.1", + "linked_list_allocator", "object", "raw-cpuid", "redox-path", @@ -129,22 +136,12 @@ dependencies = [ "rustc-demangle", "sbi-rt", "slab", - "slab_allocator", - "spin 0.9.8", + "spin", "spinning_top 0.3.0", "toml", "x86", ] -[[package]] -name = "linked_list_allocator" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47de1a43fad0250ee197e9e124e5b5deab3d7b39d4428ae8a6d741ceb340c362" -dependencies = [ - "spin 0.5.2", -] - [[package]] name = "linked_list_allocator" version = "0.9.1" @@ -187,9 +184,9 @@ checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" [[package]] name = "proc-macro2" -version = "1.0.95" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" dependencies = [ "unicode-ident", ] @@ -223,7 +220,7 @@ name = "redox_syscall" version = "0.5.17" source = "git+https://gitlab.redox-os.org/redox-os/syscall.git?branch=master#aedadf4d5cb915e0c6a22a5c7358fa853354e21d" dependencies = [ - "bitflags 2.9.1", + "bitflags 2.9.4", ] [[package]] @@ -268,18 +265,27 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.219" +version = "1.0.225" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "fd6c24dee235d0da097043389623fb913daddf92c76e9f5a1db88607a0bcbd1d" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_core" +version = "1.0.225" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "659356f9a0cb1e529b24c01e43ad2bdf520ec4ceaf83047b83ddcc2251f96383" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.225" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "0ea936adf78b1f766949a4977b91d2f5595825bd6ec079aa9543ad2685fc4516" dependencies = [ "proc-macro2", "quote", @@ -303,29 +309,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "slab" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d" - -[[package]] -name = "slab_allocator" -version = "0.3.1" -dependencies = [ - "linked_list_allocator 0.6.6", - "spin 0.4.10", -] - -[[package]] -name = "spin" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f" - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" [[package]] name = "spin" @@ -356,9 +342,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.104" +version = "2.0.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40" +checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" dependencies = [ "proc-macro2", "quote", @@ -428,9 +414,9 @@ checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" [[package]] name = "unicode-ident" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" +checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d" [[package]] name = "version_check" @@ -440,9 +426,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "winnow" -version = "0.7.12" +version = "0.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3edebf492c8125044983378ecb5766203ad3b4c2f7a922bd7dd207f6d443e95" +checksum = "21a0236b59786fed61e2a80582dd500fe61f18b5dca67a4a067d0bc9039339cf" dependencies = [ "memchr", ] @@ -460,18 +446,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1039dd0d3c310cf05de012d8a39ff557cb0d23087fd44cad61df08fc31907a2f" +checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.26" +version = "0.8.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ecf5b4cc5364572d7f4c329661bcc82724222973f2cab6f050a4e5c22f75181" +checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 648dfbc5..a00db082 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,18 +10,17 @@ rustc-cfg = "0.5" toml = "0.8" [dependencies] -bitflags = "2" +arrayvec = { version = "0.7.4", default-features = false } bitfield = "0.13.2" +bitflags = "2" hashbrown = { version = "0.14.3", default-features = false, features = ["ahash", "inline-more"] } linked_list_allocator = "0.9.0" redox-path = "0.2.0" redox_syscall = { git = "https://gitlab.redox-os.org/redox-os/syscall.git", branch = "master", default-features = false } -slab_allocator = { path = "slab_allocator", optional = true } -spin = "0.9.8" -spinning_top = { version = "0.3", features = ["arc_lock"] } rmm = { path = "rmm", default-features = false } -arrayvec = { version = "0.7.4", default-features = false } slab = { version = "0.4", default-features = false } +spin = { version = "0.9.8" } +spinning_top = { version = "0.3", features = ["arc_lock"] } # TODO: Remove indexmap = { version = "2.5.0", default-features = false } @@ -70,7 +69,6 @@ pti = [] qemu_debug = [] serial_debug = [] system76_ec_debug = [] -slab = ["slab_allocator"] sys_stat = [] x86_kvm_pv = [] diff --git a/slab_allocator b/slab_allocator deleted file mode 160000 index a9e2bb08..00000000 --- a/slab_allocator +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a9e2bb08a842752d44598a7b188760c21f15c335 diff --git a/src/allocator/mod.rs b/src/allocator/mod.rs index 98b9c9b3..35d77aed 100644 --- a/src/allocator/mod.rs +++ b/src/allocator/mod.rs @@ -4,18 +4,9 @@ use crate::{ }; use rmm::Flusher; -#[cfg(not(feature = "slab"))] pub use self::linked_list::Allocator; - -#[cfg(feature = "slab")] -pub use self::slab::Allocator; - -#[cfg(not(feature = "slab"))] mod linked_list; -#[cfg(feature = "slab")] -mod slab; - unsafe fn map_heap(mapper: &mut KernelMapper, offset: usize, size: usize) { unsafe { let mapper = mapper diff --git a/src/allocator/slab.rs b/src/allocator/slab.rs deleted file mode 100644 index 2185645a..00000000 --- a/src/allocator/slab.rs +++ /dev/null @@ -1,43 +0,0 @@ -use core::alloc::{Alloc, AllocErr, Layout}; -use slab_allocator::Heap; -use spin::Mutex; - -static HEAP: Mutex> = Mutex::new(None); - -pub struct Allocator; - -impl Allocator { - pub unsafe fn init(offset: usize, size: usize) { - *HEAP.lock() = Some(Heap::new(offset, size)); - } -} - -unsafe impl<'a> Alloc for &'a Allocator { - unsafe fn alloc(&mut self, layout: Layout) -> Result<*mut u8, AllocErr> { - if let Some(ref mut heap) = *HEAP.lock() { - heap.allocate(layout) - } else { - panic!("__rust_allocate: heap not initialized"); - } - } - - unsafe fn dealloc(&mut self, ptr: *mut u8, layout: Layout) { - if let Some(ref mut heap) = *HEAP.lock() { - heap.deallocate(ptr, layout) - } else { - panic!("__rust_deallocate: heap not initialized"); - } - } - - fn oom(&mut self, error: AllocErr) -> ! { - panic!("Out of memory: {:?}", error); - } - - fn usable_size(&self, layout: &Layout) -> (usize, usize) { - if let Some(ref mut heap) = *HEAP.lock() { - heap.usable_size(layout) - } else { - panic!("__rust_usable_size: heap not initialized"); - } - } -}