mirror of
https://github.com/rdmsr/zag.git
synced 2026-11-01 23:58:21 +00:00
fix(mm/heap): rename alloc_pages to alloc
This commit is contained in:
+1
-1
@@ -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");
|
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();
|
const ipl = heap_lock.acquire();
|
||||||
defer heap_lock.release(ipl);
|
defer heap_lock.release(ipl);
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ pub const init = private.init.init;
|
|||||||
pub const vmem = private.vmem;
|
pub const vmem = private.vmem;
|
||||||
pub const phys = private.phys;
|
pub const phys = private.phys;
|
||||||
pub const zone = private.zone;
|
pub const zone = private.zone;
|
||||||
|
pub const heap = private.heap;
|
||||||
|
|
||||||
// 16 TB of maximum physical memory.
|
// 16 TB of maximum physical memory.
|
||||||
// This should be fine on consumer hardware for at least a decade :^)
|
// This should be fine on consumer hardware for at least a decade :^)
|
||||||
|
|||||||
+2
-2
@@ -577,7 +577,7 @@ pub const Zone = struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const capacity = (self.slab_size - self.color) / self.chunk_size;
|
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();
|
var ret: *Slab = try slab_zone.create();
|
||||||
|
|
||||||
@@ -746,7 +746,7 @@ fn gpa_alloc(
|
|||||||
if (ptr_align.toByteUnits() > mm.page_size) return null;
|
if (ptr_align.toByteUnits() > mm.page_size) return null;
|
||||||
|
|
||||||
const pages = std.mem.alignForward(usize, len, mm.page_size);
|
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);
|
return @ptrCast(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user