Skip to content

Commit e0ab1e2

Browse files
std.os.uefi: move allocators to heap
1 parent 7901b61 commit e0ab1e2

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

lib/std/heap.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pub const GeneralPurposeAllocatorConfig = DebugAllocatorConfig;
2424
/// Deprecated; to be removed after 0.14.0 is tagged.
2525
pub const GeneralPurposeAllocator = DebugAllocator;
2626

27+
pub const uefi = @import("heap/uefi_allocators.zig");
28+
2729
const memory_pool = @import("heap/memory_pool.zig");
2830
pub const MemoryPool = memory_pool.MemoryPool;
2931
pub const MemoryPoolAligned = memory_pool.MemoryPoolAligned;
@@ -355,7 +357,7 @@ else if (builtin.target.isWasm()) .{
355357
.ptr = undefined,
356358
.vtable = &SbrkAllocator(std.os.plan9.sbrk).vtable,
357359
} else if (builtin.target.os.tag == .uefi)
358-
std.os.uefi.global_page_allocator.allocator()
360+
uefi.global_page_allocator.allocator()
359361
else
360362
.{
361363
.ptr = undefined,

lib/std/os/uefi/allocator.zig renamed to lib/std/heap/uefi_allocators.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const std = @import("../../std.zig");
1+
const std = @import("../std.zig");
22

33
const mem = std.mem;
44
const uefi = std.os.uefi;
@@ -7,6 +7,9 @@ const Allocator = mem.Allocator;
77

88
const assert = std.debug.assert;
99

10+
pub var global_page_allocator = PageAllocator{};
11+
pub var global_pool_allocator = PoolAllocator{};
12+
1013
/// Allocates memory in pages.
1114
///
1215
/// This allocator is backed by `allocatePages` and is therefore only suitable for usage when Boot Services are available.

lib/std/os/uefi.zig

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ pub const tables = @import("uefi/tables.zig");
1414
/// used by UEFI applications to allocate pool memory.
1515
pub var efi_pool_memory_type: tables.MemoryType = .LoaderData;
1616

17-
const allocator = @import("uefi/allocator.zig");
18-
pub const PageAllocator = allocator.Page;
19-
pub const PoolAllocator = allocator.Pool;
20-
pub const RawPoolAllocator = allocator.RawPool;
21-
22-
pub var global_page_allocator = PageAllocator{};
23-
pub var global_pool_allocator = PoolAllocator{};
24-
2517
/// The EFI image's handle that is passed to its entry point.
2618
pub var handle: Handle = undefined;
2719

0 commit comments

Comments
 (0)