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
signaturelock-open 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 @@...@@ -1,6 +1,7 @@
1pub const BootServices = @import("tables/boot_services.zig").BootServices;1pub const BootServices = @import("tables/boot_services.zig").BootServices;
2pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable;2pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable;
3pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable;3pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable;
4pub const MemoryDescriptor = @import("tables/boot_services.zig").MemoryDescriptor;
4pub const ResetType = @import("tables/runtime_services.zig").ResetType;5pub const ResetType = @import("tables/runtime_services.zig").ResetType;
5pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;6pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
6pub const SystemTable = @import("tables/system_table.zig").SystemTable;7pub 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 {...@@ -20,7 +20,7 @@ pub const BootServices = extern struct {
20 restoreTpl: usize, // TODO20 restoreTpl: usize, // TODO
21 allocatePages: usize, // TODO21 allocatePages: usize, // TODO
22 freePages: usize, // TODO22 freePages: usize, // TODO
23 getMemoryMap: usize, // TODO23 getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize,
24 allocatePool: usize, // TODO24 allocatePool: usize, // TODO
25 freePool: usize, // TODO25 freePool: usize, // TODO
26 createEvent: extern fn (u32, usize, ?extern fn (Event, ?*const c_void) void, ?*const c_void, *Event) usize,26 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) {...@@ -81,3 +81,45 @@ pub const TimerDelay = extern enum(u32) {
81 TimerPeriodic,81 TimerPeriodic,
82 TimerRelative,82 TimerRelative,
83};83};
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};