commit 4e2147d14e34e6891f2a8f2e2c7f28fdb6d92c2a (tree)
parent 6067a8b1a086aaada732febc7f96d58ba80253db
Author: Andrew Kelley <andrew@ziglang.org>
Date: Mon, 20 Apr 2026 07:05:35 +0200
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>
Diffstat:
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig
@@ -158,12 +158,10 @@ pub const BootServices = extern struct {
_locateProtocol: *const fn (protocol: *const Guid, registration: ?EventRegistration, interface: *?*const anyopaque) callconv(cc) Status,
/// Installs one or more protocol interfaces into the boot services environment
- // TODO: use callconv(cc) instead once that works
- _installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
+ _installMultipleProtocolInterfaces: *const fn (handle: *?Handle, ...) callconv(cc) Status,
/// Removes one or more protocol interfaces into the boot services environment
- // TODO: use callconv(cc) instead once that works
- _uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.c) Status,
+ _uninstallMultipleProtocolInterfaces: *const fn (handle: Handle, ...) callconv(cc) Status,
/// Computes and returns a 32-bit CRC for a data buffer.
_calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
@@ -1238,8 +1236,9 @@ fn protocolInterfaces(
@TypeOf(interfaces),
) = undefined;
result[0] = handle_arg;
+ result[result.len - 1] = null;
- var idx: usize = 1;
+ comptime var idx: usize = 1;
inline for (interfaces) |interface| {
const InterfacePtr = @TypeOf(interface);
const Interface = switch (@typeInfo(InterfacePtr)) {
@@ -1272,13 +1271,15 @@ fn ProtocolInterfaces(HandleType: type, Interfaces: type) type {
@compileError("expected tuple of protocol interfaces, got " ++ @typeName(Interfaces));
const interfaces_info = interfaces_type_info.@"struct";
- var tuple_types: [interfaces_info.fields.len * 2 + 1]type = undefined;
+ var tuple_types: [interfaces_info.fields.len * 2 + 2]type = undefined;
tuple_types[0] = HandleType;
+ tuple_types[tuple_types.len - 1] = ?*const Guid;
+
var idx = 1;
- while (idx < tuple_types.len) : (idx += 2) {
+ while (idx < tuple_types.len - 1) : (idx += 2) {
tuple_types[idx] = *const Guid;
tuple_types[idx + 1] = *const anyopaque;
}
- return std.meta.Tuple(tuple_types[0..]);
+ return @Tuple(tuple_types[0..]);
}