1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
//! Hikari EFI Boot Services
const efi = @import("../efi.zig");
const types = @import("../types/types.zig");
const table = @import("../types/table.zig");
const memory = @import("../types/memory.zig");
pub const BootServices = extern struct {
header: table.TableHeader,
raise_tpl: *const fn (new_tpl: usize) callconv(efi.akiba) usize,
restore_tpl: *const fn (old_tpl: usize) callconv(efi.akiba) void,
allocate_pages: *const fn (
allocate_type: memory.AllocateType,
memory_type: memory.MemoryType,
pages: usize,
physical_address: *types.PhysicalAddress,
) callconv(efi.akiba) types.Status,
free_pages: *const fn (
physical_address: types.PhysicalAddress,
pages: usize,
) callconv(efi.akiba) types.Status,
get_memory_map: *const fn (
memory_map_size: *usize,
memory_map: [*]memory.MemoryDescriptor,
map_key: *usize,
descriptor_size: *usize,
descriptor_version: *u32,
) callconv(efi.akiba) types.Status,
allocate_pool: *const fn (
pool_type: memory.MemoryType,
size: usize,
buffer: *[*]align(8) u8,
) callconv(efi.akiba) types.Status,
free_pool: *const fn (
buffer: [*]align(8) u8,
) callconv(efi.akiba) types.Status,
create_event: *const fn (
event_type: u32,
notify_tpl: usize,
notify_function: ?*const fn (types.Event, ?*anyopaque) callconv(efi.akiba) void,
notify_context: ?*anyopaque,
event: *types.Event,
) callconv(efi.akiba) types.Status,
set_timer: *const fn (
event: types.Event,
timer_type: TimerDelay,
trigger_time: u64,
) callconv(efi.akiba) types.Status,
wait_for_event: *const fn (
number_of_events: usize,
events: [*]const types.Event,
index: *usize,
) callconv(efi.akiba) types.Status,
signal_event: *const fn (
event: types.Event,
) callconv(efi.akiba) types.Status,
close_event: *const fn (
event: types.Event,
) callconv(efi.akiba) types.Status,
check_event: *const fn (
event: types.Event,
) callconv(efi.akiba) types.Status,
install_protocol_interface: *const fn (
handle: *types.Handle,
protocol: *align(8) const types.Guid,
interface_type: InterfaceType,
interface: ?*anyopaque,
) callconv(efi.akiba) types.Status,
reinstall_protocol_interface: *const fn (
handle: types.Handle,
protocol: *align(8) const types.Guid,
old_interface: ?*anyopaque,
new_interface: ?*anyopaque,
) callconv(efi.akiba) types.Status,
uninstall_protocol_interface: *const fn (
handle: types.Handle,
protocol: *align(8) const types.Guid,
interface: ?*anyopaque,
) callconv(efi.akiba) types.Status,
handle_protocol: *const fn (
handle: types.Handle,
protocol: *align(8) const types.Guid,
interface: *?*anyopaque,
) callconv(efi.akiba) types.Status,
reserved: *anyopaque,
register_protocol_notify: *const fn (
protocol: *align(8) const types.Guid,
event: types.Event,
registration: **anyopaque,
) callconv(efi.akiba) types.Status,
locate_handle: *const fn (
search_type: memory.LocateSearchType,
protocol: ?*align(8) const types.Guid,
search_key: ?*anyopaque,
buffer_size: *usize,
buffer: [*]types.Handle,
) callconv(efi.akiba) types.Status,
locate_device_location: *const fn (
protocol: *align(8) const types.Guid,
device_location: **anyopaque,
device: *types.Handle,
) callconv(efi.akiba) types.Status,
install_configuration_table: *const fn (
guid: *align(8) const types.Guid,
table_ptr: ?*anyopaque,
) callconv(efi.akiba) types.Status,
load_image: *const fn (
boot_policy: bool,
parent_image_handle: types.Handle,
device_location: ?*anyopaque,
source_buffer: ?[*]const u8,
source_size: usize,
image_handle: *types.Handle,
) callconv(efi.akiba) types.Status,
start_image: *const fn (
image_handle: types.Handle,
exit_data_size: *usize,
exit_data: ?*[*]types.Char16,
) callconv(efi.akiba) types.Status,
exit: *const fn (
image_handle: types.Handle,
exit_status: types.Status,
exit_data_size: usize,
exit_data: ?[*]const types.Char16,
) callconv(efi.akiba) types.Status,
unload_image: *const fn (
image_handle: types.Handle,
) callconv(efi.akiba) types.Status,
exit_boot_services: *const fn (
image_handle: types.Handle,
map_key: usize,
) callconv(efi.akiba) types.Status,
get_next_monotonic_count: *const fn (
count: *u64,
) callconv(efi.akiba) types.Status,
stall: *const fn (
microseconds: usize,
) callconv(efi.akiba) types.Status,
set_watchdog_timer: *const fn (
timeout: usize,
watchdog_code: u64,
data_size: usize,
watchdog_data: ?[*]const types.Char16,
) callconv(efi.akiba) types.Status,
connect_controller: *const fn (
controller_handle: types.Handle,
driver_image_handle: ?types.Handle,
remaining_device_location: ?*anyopaque,
recursive: bool,
) callconv(efi.akiba) types.Status,
disconnect_controller: *const fn (
controller_handle: types.Handle,
driver_image_handle: ?types.Handle,
child_handle: ?types.Handle,
) callconv(efi.akiba) types.Status,
open_protocol: *const fn (
handle: types.Handle,
protocol: *align(8) const types.Guid,
interface: ?*?*anyopaque,
agent_handle: ?types.Handle,
controller_handle: ?types.Handle,
attributes: u32,
) callconv(efi.akiba) types.Status,
close_protocol: *const fn (
handle: types.Handle,
protocol: *align(8) const types.Guid,
agent_handle: types.Handle,
controller_handle: ?types.Handle,
) callconv(efi.akiba) types.Status,
open_protocol_information: *const fn (
handle: types.Handle,
protocol: *align(8) const types.Guid,
entry_buffer: *[*]OpenProtocolInformationEntry,
entry_count: *usize,
) callconv(efi.akiba) types.Status,
protocols_per_handle: *const fn (
handle: types.Handle,
protocol_buffer: *[*]*align(8) types.Guid,
protocol_buffer_count: *usize,
) callconv(efi.akiba) types.Status,
locate_handle_buffer: *const fn (
search_type: memory.LocateSearchType,
protocol: ?*align(8) const types.Guid,
search_key: ?*anyopaque,
handle_count: *usize,
buffer: *[*]types.Handle,
) callconv(efi.akiba) types.Status,
locate_protocol: *const fn (
protocol: *align(8) const types.Guid,
registration: ?*anyopaque,
interface: *?*anyopaque,
) callconv(efi.akiba) types.Status,
install_multiple_protocol_interfaces: *const anyopaque,
uninstall_multiple_protocol_interfaces: *const anyopaque,
calculate_crc32: *const fn (
data: [*]const u8,
data_size: usize,
crc32: *u32,
) callconv(efi.akiba) types.Status,
copy_memory: *const fn (
destination: [*]u8,
source: [*]const u8,
length: usize,
) callconv(efi.akiba) void,
set_memory: *const fn (
buffer: [*]u8,
size: usize,
value: u8,
) callconv(efi.akiba) void,
create_event_ex: *const fn (
event_type: u32,
notify_tpl: usize,
notify_function: ?*const fn (types.Event, ?*anyopaque) callconv(efi.akiba) void,
notify_context: ?*const anyopaque,
event_group: ?*align(8) const types.Guid,
event: *types.Event,
) callconv(efi.akiba) types.Status,
};
pub const TimerDelay = enum(u32) {
cancel = 0,
periodic = 1,
relative = 2,
};
pub const InterfaceType = enum(u32) {
native = 0,
};
pub const OpenProtocolInformationEntry = extern struct {
agent_handle: types.Handle,
controller_handle: types.Handle,
attributes: u32,
open_count: u32,
};
pub const open_protocol_by_handle_protocol: u32 = 0x00000001;
pub const open_protocol_get_protocol: u32 = 0x00000002;
pub const open_protocol_test_protocol: u32 = 0x00000004;
pub const open_protocol_by_child_controller: u32 = 0x00000008;
pub const open_protocol_by_driver: u32 = 0x00000010;
pub const open_protocol_exclusive: u32 = 0x00000020;
pub const tpl_application: usize = 4;
pub const tpl_callback: usize = 8;
pub const tpl_notify: usize = 16;
pub const tpl_high_level: usize = 31;
pub const event_timer: u32 = 0x80000000;
pub const event_runtime: u32 = 0x40000000;
pub const event_notify_wait: u32 = 0x00000100;
pub const event_notify_signal: u32 = 0x00000200;
pub const event_signal_exit_boot_services: u32 = 0x00000201;
pub const event_signal_virtual_address_change: u32 = 0x60000202;
|