| ... | @@ -19,16 +19,23 @@ const DevicePathProtocol = uefi.protocols.DevicePathProtocol; | ... | @@ -19,16 +19,23 @@ const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| 19 | pub const BootServices = extern struct { | 19 | pub const BootServices = extern struct { |
| 20 | hdr: TableHeader, | 20 | hdr: TableHeader, |
| 21 | | 21 | |
| 22 | raiseTpl: usize, // TODO | 22 | /// Raises a task's priority level and returns its previous level. |
| 23 | restoreTpl: usize, // TODO | 23 | raiseTpl: extern fn (usize) usize, |
| 24 | allocatePages: usize, // TODO | 24 | |
| 25 | freePages: usize, // TODO | 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 | /// Returns the current memory map. | 34 | /// Returns the current memory map. |
| 28 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, | 35 | getMemoryMap: extern fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) usize, |
| 29 | | 36 | |
| 30 | /// Allocates pool memory. | 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 | /// Returns pool memory to the system. | 40 | /// Returns pool memory to the system. |
| 34 | freePool: extern fn ([*]align(8) u8) usize, | 41 | freePool: extern fn ([*]align(8) u8) usize, |
| ... | @@ -61,7 +68,10 @@ pub const BootServices = extern struct { | ... | @@ -61,7 +68,10 @@ pub const BootServices = extern struct { |
| 61 | reserved: *c_void, | 68 | reserved: *c_void, |
| 62 | | 69 | |
| 63 | registerProtocolNotify: usize, // TODO | 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 | locateDevicePath: usize, // TODO | 75 | locateDevicePath: usize, // TODO |
| 66 | installConfigurationTable: usize, // TODO | 76 | installConfigurationTable: usize, // TODO |
| 67 | | 77 | |
| ... | @@ -80,7 +90,8 @@ pub const BootServices = extern struct { | ... | @@ -80,7 +90,8 @@ pub const BootServices = extern struct { |
| 80 | /// Terminates all boot services. | 90 | /// Terminates all boot services. |
| 81 | exitBootServices: extern fn (Handle, usize) usize, | 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 | /// Induces a fine-grained stall. | 96 | /// Induces a fine-grained stall. |
| 86 | stall: extern fn (usize) usize, | 97 | stall: extern fn (usize) usize, |
| ... | @@ -100,7 +111,8 @@ pub const BootServices = extern struct { | ... | @@ -100,7 +111,8 @@ pub const BootServices = extern struct { |
| 100 | /// Retrieves the list of agents that currently have a protocol interface opened. | 111 | /// Retrieves the list of agents that currently have a protocol interface opened. |
| 101 | openProtocolInformation: extern fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) usize, | 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 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. | 117 | /// Returns an array of handles that support the requested protocol in a buffer allocated from pool. |
| 106 | locateHandleBuffer: extern fn (LocateSearchType, ?*align(8) const Guid, ?*const c_void, *usize, *[*]Handle) usize, | 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,9 +122,16 @@ pub const BootServices = extern struct { |
| 110 | | 122 | |
| 111 | installMultipleProtocolInterfaces: usize, // TODO | 123 | installMultipleProtocolInterfaces: usize, // TODO |
| 112 | uninstallMultipleProtocolInterfaces: usize, // TODO | 124 | uninstallMultipleProtocolInterfaces: usize, // TODO |
| 113 | calculateCrc32: usize, // TODO | 125 | |
| 114 | copyMem: usize, // TODO | 126 | /// Computes and returns a 32-bit CRC for a data buffer. |
| 115 | setMem: usize, // TODO | 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 | createEventEx: usize, // TODO | 135 | createEventEx: usize, // TODO |
| 117 | | 136 | |
| 118 | pub const signature: u64 = 0x56524553544f4f42; | 137 | pub const signature: u64 = 0x56524553544f4f42; |
| ... | @@ -187,13 +206,13 @@ pub const LocateSearchType = extern enum(u32) { | ... | @@ -187,13 +206,13 @@ pub const LocateSearchType = extern enum(u32) { |
| 187 | }; | 206 | }; |
| 188 | | 207 | |
| 189 | pub const OpenProtocolAttributes = packed struct { | 208 | pub const OpenProtocolAttributes = packed struct { |
| 190 | by_handle_protocol: bool, | 209 | by_handle_protocol: bool = false, |
| 191 | get_protocol: bool, | 210 | get_protocol: bool = false, |
| 192 | test_protocol: bool, | 211 | test_protocol: bool = false, |
| 193 | by_child_controller: bool, | 212 | by_child_controller: bool = false, |
| 194 | by_driver: bool, | 213 | by_driver: bool = false, |
| 195 | exclusive: bool, | 214 | exclusive: bool = false, |
| 196 | _pad: u26, | 215 | _pad: u26 = undefined, |
| 197 | }; | 216 | }; |
| 198 | | 217 | |
| 199 | pub const ProtocolInformationEntry = extern struct { | 218 | pub const ProtocolInformationEntry = extern struct { |
| ... | @@ -202,3 +221,9 @@ pub const ProtocolInformationEntry = extern struct { | ... | @@ -202,3 +221,9 @@ pub const ProtocolInformationEntry = extern struct { |
| 202 | attributes: OpenProtocolAttributes, | 221 | attributes: OpenProtocolAttributes, |
| 203 | open_count: u32, | 222 | open_count: u32, |
| 204 | }; | 223 | }; |
| | 224 | |
| | 225 | pub const AllocateType = extern enum(u32) { |
| | 226 | AllocateAnyPages, |
| | 227 | AllocateMaxAddress, |
| | 228 | AllocateAddress, |
| | 229 | }; |