| ... | ... | @@ -19,16 +19,23 @@ const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| 19 | 19 | pub const BootServices = extern struct { |
| 20 | 20 | hdr: TableHeader, |
| 21 | 21 | |
| 22 | | raiseTpl: usize, // TODO |
| 23 | | restoreTpl: usize, // TODO |
| 24 | | allocatePages: usize, // TODO |
| 25 | | freePages: usize, // TODO |
| 22 | /// Raises a task's priority level and returns its previous level. |
| 23 | raiseTpl: extern fn (usize) usize, |
| 24 | |
| 25 | /// Restores a task's priority level to its previous value. |
| 26 | restoreTpl: extern fn (usize) void, |
| 27 | |
| 28 | /// Allocates memory pages from the system. |
| 29 | allocatePages: extern fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) usize, |
| 30 | |
| 31 | /// Frees memory pages. |
| 32 | freePages: extern fn ([*]align(4096) u8, usize) usize, |
| 26 | 33 | |
| 27 | 34 | /// Returns the current memory map. |
| 28 | 35 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, |
| 29 | 36 | |
| 30 | 37 | /// Allocates pool memory. |
| 31 | | allocatePool: extern fn (MemoryType, usize, *align(8) [*]u8) usize, |
| 38 | allocatePool: extern fn (MemoryType, usize, *[*]align(8) u8) usize, |
| 32 | 39 | |
| 33 | 40 | /// Returns pool memory to the system. |
| 34 | 41 | freePool: extern fn ([*]align(8) u8) usize, |
| ... | ... | @@ -61,7 +68,10 @@ pub const BootServices = extern struct { |
| 61 | 68 | reserved: *c_void, |
| 62 | 69 | |
| 63 | 70 | registerProtocolNotify: usize, // TODO |
| 64 | | locateHandle: usize, // TODO |
| 71 | |
| 72 | /// Returns an array of handles that support a specified protocol. |
| 73 | locateHandle: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, [*]Handle) usize, |
| 74 | |
| 65 | 75 | locateDevicePath: usize, // TODO |
| 66 | 76 | installConfigurationTable: usize, // TODO |
| 67 | 77 | |
| ... | ... | @@ -80,7 +90,8 @@ pub const BootServices = extern struct { |
| 80 | 90 | /// Terminates all boot services. |
| 81 | 91 | exitBootServices: extern fn (Handle, usize) usize, |
| 82 | 92 | |
| 83 | | getNextMonotonicCount: usize, // TODO |
| 93 | /// Returns a monotonically increasing count for the platform. |
| 94 | getNextMonotonicCount: extern fn (*u64) usize, |
| 84 | 95 | |
| 85 | 96 | /// Induces a fine-grained stall. |
| 86 | 97 | stall: extern fn (usize) usize, |
| ... | ... | @@ -100,7 +111,8 @@ pub const BootServices = extern struct { |
| 100 | 111 | /// Retrieves the list of agents that currently have a protocol interface opened. |
| 101 | 112 | openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) usize, |
| 102 | 113 | |
| 103 | | protocolsPerHandle: usize, // TODO |
| 114 | /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool. |
| 115 | protocolsPerHandle: extern fn (Handle, *[*]*align(8) const Guid, *usize) usize, |
| 104 | 116 | |
| 105 | 117 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. |
| 106 | 118 | locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) usize, |
| ... | ... | @@ -110,9 +122,16 @@ pub const BootServices = extern struct { |
| 110 | 122 | |
| 111 | 123 | installMultipleProtocolInterfaces: usize, // TODO |
| 112 | 124 | uninstallMultipleProtocolInterfaces: usize, // TODO |
| 113 | | calculateCrc32: usize, // TODO |
| 114 | | copyMem: usize, // TODO |
| 115 | | setMem: usize, // TODO |
| 125 | |
| 126 | /// Computes and returns a 32-bit CRC for a data buffer. |
| 127 | calculateCrc32: extern fn ([*]const u8, usize, *u32) usize, |
| 128 | |
| 129 | /// Copies the contents of one buffer to another buffer |
| 130 | copyMem: extern fn ([*]u8, [*]const u8, usize) void, |
| 131 | |
| 132 | /// Fills a buffer with a specified value |
| 133 | setMem: extern fn ([*]u8, usize, u8) void, |
| 134 | |
| 116 | 135 | createEventEx: usize, // TODO |
| 117 | 136 | |
| 118 | 137 | pub const signature: u64 = 0x56524553544f4f42; |
| ... | ... | @@ -187,13 +206,13 @@ pub const LocateSearchType = extern enum(u32) { |
| 187 | 206 | }; |
| 188 | 207 | |
| 189 | 208 | pub const OpenProtocolAttributes = packed struct { |
| 190 | | by_handle_protocol: bool, |
| 191 | | get_protocol: bool, |
| 192 | | test_protocol: bool, |
| 193 | | by_child_controller: bool, |
| 194 | | by_driver: bool, |
| 195 | | exclusive: bool, |
| 196 | | _pad: u26, |
| 209 | by_handle_protocol: bool = false, |
| 210 | get_protocol: bool = false, |
| 211 | test_protocol: bool = false, |
| 212 | by_child_controller: bool = false, |
| 213 | by_driver: bool = false, |
| 214 | exclusive: bool = false, |
| 215 | _pad: u26 = undefined, |
| 197 | 216 | }; |
| 198 | 217 | |
| 199 | 218 | pub const ProtocolInformationEntry = extern struct { |
| ... | ... | @@ -202,3 +221,9 @@ pub const ProtocolInformationEntry = extern struct { |
| 202 | 221 | attributes: OpenProtocolAttributes, |
| 203 | 222 | open_count: u32, |
| 204 | 223 | }; |
| 224 | |
| 225 | pub const AllocateType = extern enum(u32) { |
| 226 | AllocateAnyPages, |
| 227 | AllocateMaxAddress, |
| 228 | AllocateAddress, |
| 229 | }; |