From 1d7c8108b1ff7c7ff2b1841c7145b48a54e83423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Rosowski?= Date: Fri, 17 Apr 2026 16:55:22 +0200 Subject: [PATCH 1/4] std.os.uefi: fix comptime idx --- lib/std/os/uefi/tables/boot_services.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index 506961315dcf2a001b7914072b441a9d8c9c816f..2070f8192cb7b286f185c0ad1fa95b5f98c49a5f 100644 --- a/lib/std/os/uefi/tables/boot_services.zig +++ b/lib/std/os/uefi/tables/boot_services.zig @@ -1239,7 +1239,7 @@ fn protocolInterfaces( ) = undefined; result[0] = handle_arg; - var idx: usize = 1; + comptime var idx: usize = 1; inline for (interfaces) |interface| { const InterfacePtr = @TypeOf(interface); const Interface = switch (@typeInfo(InterfacePtr)) { -- 2.54.0 From a3a1dd1d910864db80806aac43a173f3ca2ea6cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Rosowski?= Date: Fri, 17 Apr 2026 16:55:24 +0200 Subject: [PATCH 2/4] std.os.uefi: use uefi callconv for `_(un)installMultipleProtocolInterfaces` --- lib/std/os/uefi/tables/boot_services.zig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index 2070f8192cb7b286f185c0ad1fa95b5f98c49a5f..e1d9fd82a347cbd1aeb0129d6c427d9657565e0a 100644 --- 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, -- 2.54.0 From 0473ddb1a7f94c3af7ddfd26cf714614c63fe314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Rosowski?= Date: Fri, 17 Apr 2026 16:55:25 +0200 Subject: [PATCH 3/4] std.os.uefi: fix `_(un)installMultipleProtocolInterface` signatures --- lib/std/os/uefi/tables/boot_services.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index e1d9fd82a347cbd1aeb0129d6c427d9657565e0a..c864fec9bfd03cbfb321b05e4275e2969799d9f9 100644 --- a/lib/std/os/uefi/tables/boot_services.zig +++ b/lib/std/os/uefi/tables/boot_services.zig @@ -158,10 +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 - _installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(cc) Status, + _installMultipleProtocolInterfaces: *const fn (handle: *?Handle, ...) callconv(cc) Status, /// Removes one or more protocol interfaces into the boot services environment - _uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(cc) 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, -- 2.54.0 From 7020c9e4a9f340bb390f13b27aef32450d165310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Rosowski?= Date: Fri, 17 Apr 2026 16:55:26 +0200 Subject: [PATCH 4/4] std.os.uefi: pass null terminator in `(un)installMultipleProtocolInterfaces` --- lib/std/os/uefi/tables/boot_services.zig | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/std/os/uefi/tables/boot_services.zig b/lib/std/os/uefi/tables/boot_services.zig index c864fec9bfd03cbfb321b05e4275e2969799d9f9..219c3704d1031d3440f3343a411dcea9ce6f3e5d 100644 --- a/lib/std/os/uefi/tables/boot_services.zig +++ b/lib/std/os/uefi/tables/boot_services.zig @@ -1236,6 +1236,7 @@ fn protocolInterfaces( @TypeOf(interfaces), ) = undefined; result[0] = handle_arg; + result[result.len - 1] = null; comptime var idx: usize = 1; inline for (interfaces) |interface| { @@ -1270,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..]); } -- 2.54.0