diff --git a/std/os/uefi/tables.zig b/std/os/uefi/tables.zig index 901591dea4..fbb9abe7f6 100644 --- a/std/os/uefi/tables.zig +++ b/std/os/uefi/tables.zig @@ -1,6 +1,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 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; diff --git a/std/os/uefi/tables/boot_services.zig b/std/os/uefi/tables/boot_services.zig index ae548137c3..55b0de3478 100644 --- a/std/os/uefi/tables/boot_services.zig +++ b/std/os/uefi/tables/boot_services.zig @@ -20,7 +20,7 @@ pub const BootServices = extern struct { restoreTpl: usize, // TODO allocatePages: usize, // TODO freePages: usize, // TODO - getMemoryMap: usize, // TODO + getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, allocatePool: usize, // TODO freePool: usize, // TODO createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize, @@ -81,3 +81,45 @@ pub const TimerDelay = extern enum(u32) { TimerPeriodic, TimerRelative, }; + +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, + }, + physical_start: u64, + virtual_start: u64, + number_of_pages: usize, + attribute: packed struct { + uc: bool, + wc: bool, + wt: bool, + wb: bool, + uce: bool, + _pad1: u7, + wp: bool, + rp: bool, + xp: bool, + nv: bool, + more_reliable: bool, + ro: bool, + sp: bool, + cpu_crypto: bool, + _pad2: u43, + memory_runtime: bool, + }, +};