set up 1mb of static kernel-allocable memory
This commit is contained in:
parent
a740f46ec3
commit
29bc4daf9e
|
|
@ -1,19 +1,5 @@
|
|||
const std = @import("std");
|
||||
|
||||
var GlobAlloc: ?std.heap.FixedBufferAllocator = null;
|
||||
|
||||
pub export fn kalloc_init(start: usize, len: usize) void {
|
||||
// const aligned = std.mem.alignForward(start, 8);
|
||||
const ptr = @intToPtr([*]u8, start);
|
||||
const buf = ptr[0..len];
|
||||
GlobAlloc = std.heap.FixedBufferAllocator.init(buf);
|
||||
}
|
||||
|
||||
// export fn kalloc(bytes: usize, a: usize) void {
|
||||
// var a = GlobAlloc.?.allocator.allocAdvanced(u8, a, bytes, std.mem.Allocator.Exact.at_least);
|
||||
// return a catch unreachable;
|
||||
// }
|
||||
|
||||
pub fn kallocNop() void {
|
||||
std.log.err("calling kallocNop", .{});
|
||||
}
|
||||
var buf: [1024*1024]u8 = undefined;
|
||||
pub var KAlloc = std.heap.FixedBufferAllocator.init(&buf);
|
||||
// pub var KAlloc = std.heap.GeneralPurposeAllocator(.{.thread_safe=false}){.backing_allocator = &GlobAlloc.allocator};
|
||||
|
|
|
|||
Loading…
Reference in New Issue