fix(mm/heap): rename alloc_pages to alloc

This commit is contained in:
Loïc Grégoire
2026-04-15 19:36:50 -04:00
parent a34f179d84
commit 986fe82383
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ pub fn init() void {
heap_arena.init("kernel heap", mi.impl.kernel_heap_base, b.tib(16), mm.page_size) catch @panic("failed to initialize kernel heap arena");
}
pub fn alloc_pages(size: usize) mm.Error!*anyopaque {
pub fn alloc(size: usize) mm.Error!*anyopaque {
const ipl = heap_lock.acquire();
defer heap_lock.release(ipl);
+1
View File
@@ -9,6 +9,7 @@ pub const init = private.init.init;
pub const vmem = private.vmem;
pub const phys = private.phys;
pub const zone = private.zone;
pub const heap = private.heap;
// 16 TB of maximum physical memory.
// This should be fine on consumer hardware for at least a decade :^)
+2 -2
View File
@@ -577,7 +577,7 @@ pub const Zone = struct {
}
const capacity = (self.slab_size - self.color) / self.chunk_size;
const buf = try mi.heap.alloc_pages(self.slab_size);
const buf = try mi.heap.alloc(self.slab_size);
var ret: *Slab = try slab_zone.create();
@@ -746,7 +746,7 @@ fn gpa_alloc(
if (ptr_align.toByteUnits() > mm.page_size) return null;
const pages = std.mem.alignForward(usize, len, mm.page_size);
const ptr = mi.heap.alloc_pages(pages) catch return null;
const ptr = mi.heap.alloc(pages) catch return null;
return @ptrCast(ptr);
}