Commit a4f324e9ea

Nick Erdmann <n@nirf.de>
2019-09-03 22:04:22
std/os/uefi: add exitBootServices and allocatePool
1 parent 23a82b5
Changed files (2)
lib
std
lib/std/os/uefi/tables/boot_services.zig
@@ -21,7 +21,7 @@ pub const BootServices = extern struct {
     allocatePages: usize, // TODO
     freePages: usize, // TODO
     getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize,
-    allocatePool: usize, // TODO
+    allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize,
     freePool: usize, // TODO
     createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize,
     setTimer: extern fn (Event, TimerDelay, u64) usize,
@@ -42,7 +42,7 @@ pub const BootServices = extern struct {
     imageStart: usize, // TODO
     exit: extern fn (Handle, usize, usize, ?*const c_void) usize,
     imageUnload: usize, // TODO
-    exitBootServices: usize, // TODO
+    exitBootServices: extern fn (Handle, usize) usize,
     getNextMonotonicCount: usize, // TODO
     stall: extern fn (usize) usize,
     setWatchdogTimer: extern fn (usize, u64, usize, ?[*]const u16) usize,
@@ -82,25 +82,27 @@ pub const TimerDelay = extern enum(u32) {
     TimerRelative,
 };
 
+pub const MemoryType = extern enum(u32) {
+    ReservedMemoryType,
+    LoaderCode,
+    LoaderData,
+    BootServicesCode,
+    BootServicesData,
+    RuntimeServicesCode,
+    RuntimeServicesData,
+    ConventionalMemory,
+    UnusableMemory,
+    ACPIReclaimMemory,
+    ACPIMemoryNVS,
+    MemoryMappedIO,
+    MemoryMappedIOPortSpace,
+    PalCode,
+    PersistentMemory,
+    MaxMemoryType,
+};
+
 pub const MemoryDescriptor = extern struct {
-    type: extern enum(u32) {
-        ReservedMemoryType,
-        LoaderCode,
-        LoaderData,
-        BootServicesCode,
-        BootServicesData,
-        RuntimeServicesCode,
-        RuntimeServicesData,
-        ConventionalMemory,
-        UnusableMemory,
-        ACPIReclaimMemory,
-        ACPIMemoryNVS,
-        MemoryMappedIO,
-        MemoryMappedIOPortSpace,
-        PalCode,
-        PersistentMemory,
-        MaxMemoryType,
-    },
+    type: MemoryType,
     physical_start: u64,
     virtual_start: u64,
     number_of_pages: usize,
lib/std/os/uefi/tables.zig
@@ -2,6 +2,7 @@ pub const BootServices = @import("tables/boot_services.zig").BootServices;
 pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable;
 pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable;
 pub const MemoryDescriptor = @import("tables/boot_services.zig").MemoryDescriptor;
+pub const MemoryType = @import("tables/boot_services.zig").MemoryType;
 pub const ResetType = @import("tables/runtime_services.zig").ResetType;
 pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
 pub const SystemTable = @import("tables/system_table.zig").SystemTable;