authorgravatar for n@nirf.deNick Erdmann <n@nirf.de> 2019-09-02 19:04:26+02:00
committergravatar for n@nirf.deNick Erdmann <n@nirf.de> 2019-09-02 22:10:50+02:00
log8db41b7adbd0d1112a914d05ed94e9b55cfaf2db
tree21855726b7f876913df3813eafdb77126bdc9f39
parent03abc6edf450cfa6a55a3d416def44595a19a453
signature Commit is signed but in an unrecognized format.

std/os/uefi: add support for getting memory map


2 files changed, 44 insertions(+), 1 deletions(-)

std/os/uefi/tables.zig+1
......@@ -1,6 +1,7 @@
11pub const BootServices = @import("tables/boot_services.zig").BootServices;
22pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable;
33pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable;
4pub const MemoryDescriptor = @import("tables/boot_services.zig").MemoryDescriptor;
45pub const ResetType = @import("tables/runtime_services.zig").ResetType;
56pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
67pub const SystemTable = @import("tables/system_table.zig").SystemTable;
std/os/uefi/tables/boot_services.zig+43-1
......@@ -20,7 +20,7 @@ pub const BootServices = extern struct {
2020 restoreTpl: usize, // TODO
2121 allocatePages: usize, // TODO
2222 freePages: usize, // TODO
23 getMemoryMap: usize, // TODO
23 getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize,
2424 allocatePool: usize, // TODO
2525 freePool: usize, // TODO
2626 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) {
8181 TimerPeriodic,
8282 TimerRelative,
8383};
84
85pub const MemoryDescriptor = extern struct {
86 type: extern enum(u32) {
87 ReservedMemoryType,
88 LoaderCode,
89 LoaderData,
90 BootServicesCode,
91 BootServicesData,
92 RuntimeServicesCode,
93 RuntimeServicesData,
94 ConventionalMemory,
95 UnusableMemory,
96 ACPIReclaimMemory,
97 ACPIMemoryNVS,
98 MemoryMappedIO,
99 MemoryMappedIOPortSpace,
100 PalCode,
101 PersistentMemory,
102 MaxMemoryType,
103 },
104 physical_start: u64,
105 virtual_start: u64,
106 number_of_pages: usize,
107 attribute: packed struct {
108 uc: bool,
109 wc: bool,
110 wt: bool,
111 wb: bool,
112 uce: bool,
113 _pad1: u7,
114 wp: bool,
115 rp: bool,
116 xp: bool,
117 nv: bool,
118 more_reliable: bool,
119 ro: bool,
120 sp: bool,
121 cpu_crypto: bool,
122 _pad2: u43,
123 memory_runtime: bool,
124 },
125};