Skip to content

Commit 5127c77

Browse files
authored
Merge pull request #2349 from hermit-os/dependabot/cargo/talc-5.0.2
build(deps): upgrade talc to 5
2 parents 00b4f0c + 0a3ac7f commit 5127c77

4 files changed

Lines changed: 23 additions & 9 deletions

File tree

Cargo.lock

Lines changed: 10 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ shell-words = { version = "1.1", default-features = false }
316316
simple-shell = { version = "0.0.1", optional = true }
317317
smallvec = { version = "1", features = ["const_new"] }
318318
take-static = "0.1"
319-
talc = { version = "4" }
319+
talc = { version = "5" }
320320
thiserror = { version = "2", default-features = false }
321321
time = { version = "0.3", default-features = false }
322322
volatile = "0.6"

src/executor/alloc_stats.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ async fn print_alloc_stats() {
88
future::poll_fn(|cx| {
99
let talc = ALLOCATOR.lock();
1010

11-
debug!("<alloc-stats>\n{}", talc.get_counters());
11+
let counters = talc.counters();
12+
debug!("<alloc-stats>\n{counters}");
1213

1314
cx.waker().wake_by_ref();
1415
Poll::<()>::Pending

src/mm/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ use align_address::Align;
5252
use free_list::{PageLayout, PageRange};
5353
use hermit_sync::{Lazy, RawInterruptTicketMutex};
5454
pub use memory_addresses::{PhysAddr, VirtAddr};
55-
use talc::{ErrOnOom, Span, Talc, Talck};
55+
#[cfg(target_os = "none")]
56+
use talc::TalcLock;
57+
#[cfg(target_os = "none")]
58+
use talc::source::Manual;
5659

5760
pub use self::page_range_alloc::{PageRangeAllocator, PageRangeBox};
5861
pub use self::physicalmem::{FrameAlloc, FrameBox};
@@ -65,7 +68,7 @@ use crate::{arch, env};
6568

6669
#[cfg(target_os = "none")]
6770
#[global_allocator]
68-
pub(crate) static ALLOCATOR: Talck<RawInterruptTicketMutex, ErrOnOom> = Talc::new(ErrOnOom).lock();
71+
pub(crate) static ALLOCATOR: TalcLock<RawInterruptTicketMutex, Manual> = TalcLock::new(Manual);
6972

7073
/// Physical and virtual address range of the 2 MiB pages that map the kernel.
7174
static KERNEL_ADDR_RANGE: Lazy<Range<VirtAddr>> = Lazy::new(|| {
@@ -277,9 +280,12 @@ pub(crate) fn init() {
277280

278281
let heap_end_addr = map_addr;
279282

280-
let arena = Span::new(heap_start_addr.as_mut_ptr(), heap_end_addr.as_mut_ptr());
283+
let size = heap_end_addr.as_usize() - heap_start_addr.as_usize();
281284
unsafe {
282-
ALLOCATOR.lock().claim(arena).unwrap();
285+
ALLOCATOR
286+
.lock()
287+
.claim(heap_start_addr.as_mut_ptr(), size)
288+
.unwrap();
283289
}
284290

285291
info!("Heap is located at {heap_start_addr:p}..{heap_end_addr:p} ({map_size} Bytes unmapped)");

0 commit comments

Comments
 (0)