authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-20 07:05:35+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-04-20 07:05:35+02:00
log4e2147d14e34e6891f2a8f2e2c7f28fdb6d92c2a
tree08a706e21dc941ff20d2859472c149dafd42a4bf
parent6067a8b1a086aaada732febc7f96d58ba80253db
parent7020c9e4a9f340bb390f13b27aef32450d165310

Merge pull request 'Fix uefi `(un)installMultipleProtocolInterfaces`' (#31934) from mrosowski/zig:uefi-fix-install-multiple into master

Reviewed-on: https://codeberg.org/ziglang/zig/pulls/31934 Reviewed-by: linus <mail@linusgroh.de>

1 files changed, 9 insertions(+), 8 deletions(-)

lib/std/os/uefi/tables/boot_services.zig+9-8
......@@ -158,12 +158,10 @@ pub const BootServices = extern struct {
158158 _locateProtocol: *const fn (protocol: *const Guid, registration: ?EventRegistration, interface: *?*const anyopaque) callconv(cc) Status,
159159
160160 /// Installs one or more protocol interfaces into the boot services environment
161 // TODO: use callconv(cc) instead once that works
162 _installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
161 _installMultipleProtocolInterfaces: *const fn (handle: *?Handle, ...) callconv(cc) Status,
163162
164163 /// Removes one or more protocol interfaces into the boot services environment
165 // TODO: use callconv(cc) instead once that works
166 _uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
164 _uninstallMultipleProtocolInterfaces: *const fn (handle: Handle, ...) callconv(cc) Status,
167165
168166 /// Computes and returns a 32-bit CRC for a data buffer.
169167 _calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
......@@ -1238,8 +1236,9 @@ fn protocolInterfaces(
12381236 @TypeOf(interfaces),
12391237 ) = undefined;
12401238 result[0] = handle_arg;
1239 result[result.len - 1] = null;
12411240
1242 var idx: usize = 1;
1241 comptime var idx: usize = 1;
12431242 inline for (interfaces) |interface| {
12441243 const InterfacePtr = @TypeOf(interface);
12451244 const Interface = switch (@typeInfo(InterfacePtr)) {
......@@ -1272,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {
12721271 @compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));
12731272 const interfaces_info = interfaces_type_info.@"struct";
12741273
1275 var tuple_types: [interfaces_info.fields.len * 2 + 1]type = undefined;
1274 var tuple_types: [interfaces_info.fields.len * 2 + 2]type = undefined;
12761275 tuple_types[0] = HandleType;
1276 tuple_types[tuple_types.len - 1] = ?*const Guid;
1277
12771278 var idx = 1;
1278 while (idx < tuple_types.len) : (idx += 2) {
1279 while (idx < tuple_types.len - 1) : (idx += 2) {
12791280 tuple_types[idx] = *const Guid;
12801281 tuple_types[idx + 1] = *const anyopaque;
12811282 }
12821283
1283 return std.meta.Tuple(tuple_types[0..]);
1284 return @Tuple(tuple_types[0..]);
12841285}