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 {...@@ -158,12 +158,10 @@ pub const BootServices = extern struct {
158 _locateProtocol: *const fn (protocol: *const Guid, registration: ?EventRegistration, interface: *?*const anyopaque) callconv(cc) Status,158 _locateProtocol: *const fn (protocol: *const Guid, registration: ?EventRegistration, interface: *?*const anyopaque) callconv(cc) Status,
159159
160 /// Installs one or more protocol interfaces into the boot services environment160 /// Installs one or more protocol interfaces into the boot services environment
161 // TODO: use callconv(cc) instead once that works161 _installMultipleProtocolInterfaces: *const fn (handle: *?Handle, ...) callconv(cc) Status,
162 _installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
163162
164 /// Removes one or more protocol interfaces into the boot services environment163 /// Removes one or more protocol interfaces into the boot services environment
165 // TODO: use callconv(cc) instead once that works164 _uninstallMultipleProtocolInterfaces: *const fn (handle: Handle, ...) callconv(cc) Status,
166 _uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
167165
168 /// Computes and returns a 32-bit CRC for a data buffer.166 /// Computes and returns a 32-bit CRC for a data buffer.
169 _calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,167 _calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
...@@ -1238,8 +1236,9 @@ fn protocolInterfaces(...@@ -1238,8 +1236,9 @@ fn protocolInterfaces(
1238 @TypeOf(interfaces),1236 @TypeOf(interfaces),
1239 ) = undefined;1237 ) = undefined;
1240 result[0] = handle_arg;1238 result[0] = handle_arg;
1239 result[result.len - 1] = null;
12411240
1242 var idx: usize = 1;1241 comptime var idx: usize = 1;
1243 inline for (interfaces) |interface| {1242 inline for (interfaces) |interface| {
1244 const InterfacePtr = @TypeOf(interface);1243 const InterfacePtr = @TypeOf(interface);
1245 const Interface = switch (@typeInfo(InterfacePtr)) {1244 const Interface = switch (@typeInfo(InterfacePtr)) {
...@@ -1272,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {...@@ -1272,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {
1272 @compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));1271 @compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));
1273 const interfaces_info = interfaces_type_info.@"struct";1272 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;
1276 tuple_types[0] = HandleType;1275 tuple_types[0] = HandleType;
1276 tuple_types[tuple_types.len - 1] = ?*const Guid;
1277
1277 var idx = 1;1278 var idx = 1;
1278 while (idx < tuple_types.len) : (idx += 2) {1279 while (idx < tuple_types.len - 1) : (idx += 2) {
1279 tuple_types[idx] = *const Guid;1280 tuple_types[idx] = *const Guid;
1280 tuple_types[idx + 1] = *const anyopaque;1281 tuple_types[idx + 1] = *const anyopaque;
1281 }1282 }
12821283
1283 return std.meta.Tuple(tuple_types[0..]);1284 return @Tuple(tuple_types[0..]);
1284}1285}