authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-07-10 10:41:19-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2023-07-10 10:41:19-07:00
log2b8c1f0d4619565255b9faff2d24bc2360012552
treebabdd081bafa95518c8ab9a21385aaa364081601
parent3a30f0fa505e25c98772f9faffe5490b92773708
parent026c63d8fe5caa30d003230b5514d8a3e274f82c
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

Merge pull request #16339 from r00ster91/ueficc

std.os.uefi: use std.os.uefi.cc instead of .C as calling convention

28 files changed, 232 insertions(+), 159 deletions(-)

lib/std/os/uefi.zig+6
...@@ -23,6 +23,12 @@ pub var system_table: *tables.SystemTable = undefined;...@@ -23,6 +23,12 @@ pub var system_table: *tables.SystemTable = undefined;
23/// A handle to an event structure.23/// A handle to an event structure.
24pub const Event = *opaque {};24pub const Event = *opaque {};
2525
26/// The calling convention used for all external functions part of the UEFI API.
27pub const cc = switch (@import("builtin").target.cpu.arch) {
28 .x86_64 => .Win64,
29 else => .C,
30};
31
26pub const MacAddress = extern struct {32pub const MacAddress = extern struct {
27 address: [32]u8,33 address: [32]u8,
28};34};
lib/std/os/uefi/protocols/absolute_pointer_protocol.zig+3-2
...@@ -3,11 +3,12 @@ const uefi = std.os.uefi;...@@ -3,11 +3,12 @@ const uefi = std.os.uefi;
3const Event = uefi.Event;3const Event = uefi.Event;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7/// Protocol for touchscreens8/// Protocol for touchscreens
8pub const AbsolutePointerProtocol = extern struct {9pub const AbsolutePointerProtocol = extern struct {
9 _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status,10 _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(cc) Status,
10 _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status,11 _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(cc) Status,
11 wait_for_input: Event,12 wait_for_input: Event,
12 mode: *AbsolutePointerMode,13 mode: *AbsolutePointerMode,
1314
lib/std/os/uefi/protocols/block_io_protocol.zig+5-4
...@@ -1,6 +1,7 @@...@@ -1,6 +1,7 @@
1const std = @import("std");1const std = @import("std");
2const uefi = std.os.uefi;2const uefi = std.os.uefi;
3const Status = uefi.Status;3const Status = uefi.Status;
4const cc = uefi.cc;
45
5pub const EfiBlockMedia = extern struct {6pub const EfiBlockMedia = extern struct {
6 /// The current media ID. If the media changes, this value is changed.7 /// The current media ID. If the media changes, this value is changed.
...@@ -44,10 +45,10 @@ pub const BlockIoProtocol = extern struct {...@@ -44,10 +45,10 @@ pub const BlockIoProtocol = extern struct {
44 revision: u64,45 revision: u64,
45 media: *EfiBlockMedia,46 media: *EfiBlockMedia,
4647
47 _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status,48 _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(cc) Status,
48 _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,49 _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status,
49 _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status,50 _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status,
50 _flush_blocks: *const fn (*BlockIoProtocol) callconv(.C) Status,51 _flush_blocks: *const fn (*BlockIoProtocol) callconv(cc) Status,
5152
52 /// Resets the block device hardware.53 /// Resets the block device hardware.
53 pub fn reset(self: *Self, extended_verification: bool) Status {54 pub fn reset(self: *Self, extended_verification: bool) Status {
lib/std/os/uefi/protocols/edid_override_protocol.zig+2-1
...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Handle = uefi.Handle;4const Handle = uefi.Handle;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7/// Override EDID information8/// Override EDID information
8pub const EdidOverrideProtocol = extern struct {9pub const EdidOverrideProtocol = extern struct {
9 _get_edid: *const fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(.C) Status,10 _get_edid: *const fn (*const EdidOverrideProtocol, Handle, *EdidOverrideProtocolAttributes, *usize, *?[*]u8) callconv(cc) Status,
1011
11 /// Returns policy information and potentially a replacement EDID for the specified video output device.12 /// Returns policy information and potentially a replacement EDID for the specified video output device.
12 pub fn getEdid(13 pub fn getEdid(
lib/std/os/uefi/protocols/file_protocol.zig+11-10
...@@ -4,19 +4,20 @@ const io = std.io;...@@ -4,19 +4,20 @@ const io = std.io;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Time = uefi.Time;5const Time = uefi.Time;
6const Status = uefi.Status;6const Status = uefi.Status;
7const cc = uefi.cc;
78
8pub const FileProtocol = extern struct {9pub const FileProtocol = extern struct {
9 revision: u64,10 revision: u64,
10 _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status,11 _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(cc) Status,
11 _close: *const fn (*const FileProtocol) callconv(.C) Status,12 _close: *const fn (*const FileProtocol) callconv(cc) Status,
12 _delete: *const fn (*const FileProtocol) callconv(.C) Status,13 _delete: *const fn (*const FileProtocol) callconv(cc) Status,
13 _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status,14 _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(cc) Status,
14 _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status,15 _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(cc) Status,
15 _get_position: *const fn (*const FileProtocol, *u64) callconv(.C) Status,16 _get_position: *const fn (*const FileProtocol, *u64) callconv(cc) Status,
16 _set_position: *const fn (*const FileProtocol, u64) callconv(.C) Status,17 _set_position: *const fn (*const FileProtocol, u64) callconv(cc) Status,
17 _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status,18 _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(cc) Status,
18 _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status,19 _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(cc) Status,
19 _flush: *const fn (*const FileProtocol) callconv(.C) Status,20 _flush: *const fn (*const FileProtocol) callconv(cc) Status,
2021
21 pub const SeekError = error{SeekError};22 pub const SeekError = error{SeekError};
22 pub const GetSeekPosError = error{GetSeekPosError};23 pub const GetSeekPosError = error{GetSeekPosError};
lib/std/os/uefi/protocols/graphics_output_protocol.zig+4-3
...@@ -2,12 +2,13 @@ const std = @import("std");...@@ -2,12 +2,13 @@ const std = @import("std");
2const uefi = std.os.uefi;2const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Status = uefi.Status;4const Status = uefi.Status;
5const cc = uefi.cc;
56
6/// Graphics output7/// Graphics output
7pub const GraphicsOutputProtocol = extern struct {8pub const GraphicsOutputProtocol = extern struct {
8 _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status,9 _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(cc) Status,
9 _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status,10 _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(cc) Status,
10 _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status,11 _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(cc) Status,
11 mode: *GraphicsOutputProtocolMode,12 mode: *GraphicsOutputProtocolMode,
1213
13 /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports.14 /// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports.
lib/std/os/uefi/protocols/hii_database_protocol.zig+5-4
...@@ -3,14 +3,15 @@ const uefi = std.os.uefi;...@@ -3,14 +3,15 @@ const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Status = uefi.Status;4const Status = uefi.Status;
5const hii = uefi.protocols.hii;5const hii = uefi.protocols.hii;
6const cc = uefi.cc;
67
7/// Database manager for HII-related data structures.8/// Database manager for HII-related data structures.
8pub const HIIDatabaseProtocol = extern struct {9pub const HIIDatabaseProtocol = extern struct {
9 _new_package_list: Status, // TODO10 _new_package_list: Status, // TODO
10 _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status,11 _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(cc) Status,
11 _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status,12 _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(cc) Status,
12 _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status,13 _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(cc) Status,
13 _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status,14 _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(cc) Status,
14 _register_package_notify: Status, // TODO15 _register_package_notify: Status, // TODO
15 _unregister_package_notify: Status, // TODO16 _unregister_package_notify: Status, // TODO
16 _find_keyboard_layouts: Status, // TODO17 _find_keyboard_layouts: Status, // TODO
lib/std/os/uefi/protocols/hii_popup_protocol.zig+2-1
...@@ -3,11 +3,12 @@ const uefi = std.os.uefi;...@@ -3,11 +3,12 @@ const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Status = uefi.Status;4const Status = uefi.Status;
5const hii = uefi.protocols.hii;5const hii = uefi.protocols.hii;
6const cc = uefi.cc;
67
7/// Display a popup window8/// Display a popup window
8pub const HIIPopupProtocol = extern struct {9pub const HIIPopupProtocol = extern struct {
9 revision: u64,10 revision: u64,
10 _create_popup: *const fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status,11 _create_popup: *const fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(cc) Status,
1112
12 /// Displays a popup window.13 /// Displays a popup window.
13 pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status {14 pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status {
lib/std/os/uefi/protocols/ip6_config_protocol.zig+5-4
...@@ -3,12 +3,13 @@ const uefi = std.os.uefi;...@@ -3,12 +3,13 @@ const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Event = uefi.Event;4const Event = uefi.Event;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7pub const Ip6ConfigProtocol = extern struct {8pub const Ip6ConfigProtocol = extern struct {
8 _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status,9 _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(cc) Status,
9 _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status,10 _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(cc) Status,
10 _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,11 _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(cc) Status,
11 _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,12 _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(cc) Status,
1213
13 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {14 pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {
14 return self._set_data(self, data_type, data_size, data);15 return self._set_data(self, data_type, data_size, data);
lib/std/os/uefi/protocols/ip6_protocol.zig+10-9
...@@ -6,17 +6,18 @@ const Status = uefi.Status;...@@ -6,17 +6,18 @@ const Status = uefi.Status;
6const MacAddress = uefi.protocols.MacAddress;6const MacAddress = uefi.protocols.MacAddress;
7const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;7const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
8const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;8const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
9const cc = uefi.cc;
910
10pub const Ip6Protocol = extern struct {11pub const Ip6Protocol = extern struct {
11 _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,12 _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status,
12 _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status,13 _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(cc) Status,
13 _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,14 _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(cc) Status,
14 _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status,15 _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(cc) Status,
15 _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status,16 _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(cc) Status,
16 _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,17 _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(cc) Status,
17 _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,18 _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(cc) Status,
18 _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status,19 _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(cc) Status,
19 _poll: *const fn (*const Ip6Protocol) callconv(.C) Status,20 _poll: *const fn (*const Ip6Protocol) callconv(cc) Status,
2021
21 /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.22 /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
22 pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {23 pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
lib/std/os/uefi/protocols/ip6_service_binding_protocol.zig+3-2
...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;
3const Handle = uefi.Handle;3const Handle = uefi.Handle;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7pub const Ip6ServiceBindingProtocol = extern struct {8pub const Ip6ServiceBindingProtocol = extern struct {
8 _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status,9 _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(cc) Status,
9 _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status,10 _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(cc) Status,
1011
11 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {12 pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {
12 return self._create_child(self, handle);13 return self._create_child(self, handle);
lib/std/os/uefi/protocols/loaded_image_protocol.zig+2-1
...@@ -6,6 +6,7 @@ const Status = uefi.Status;...@@ -6,6 +6,7 @@ const Status = uefi.Status;
6const SystemTable = uefi.tables.SystemTable;6const SystemTable = uefi.tables.SystemTable;
7const MemoryType = uefi.tables.MemoryType;7const MemoryType = uefi.tables.MemoryType;
8const DevicePathProtocol = uefi.protocols.DevicePathProtocol;8const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
9const cc = uefi.cc;
910
10pub const LoadedImageProtocol = extern struct {11pub const LoadedImageProtocol = extern struct {
11 revision: u32,12 revision: u32,
...@@ -20,7 +21,7 @@ pub const LoadedImageProtocol = extern struct {...@@ -20,7 +21,7 @@ pub const LoadedImageProtocol = extern struct {
20 image_size: u64,21 image_size: u64,
21 image_code_type: MemoryType,22 image_code_type: MemoryType,
22 image_data_type: MemoryType,23 image_data_type: MemoryType,
23 _unload: *const fn (*const LoadedImageProtocol, Handle) callconv(.C) Status,24 _unload: *const fn (*const LoadedImageProtocol, Handle) callconv(cc) Status,
2425
25 /// Unloads an image from memory.26 /// Unloads an image from memory.
26 pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {27 pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {
lib/std/os/uefi/protocols/managed_network_protocol.zig+9-8
...@@ -6,16 +6,17 @@ const Status = uefi.Status;...@@ -6,16 +6,17 @@ const Status = uefi.Status;
6const Time = uefi.Time;6const Time = uefi.Time;
7const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;7const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
8const MacAddress = uefi.protocols.MacAddress;8const MacAddress = uefi.protocols.MacAddress;
9const cc = uefi.cc;
910
10pub const ManagedNetworkProtocol = extern struct {11pub const ManagedNetworkProtocol = extern struct {
11 _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,12 _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status,
12 _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status,13 _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(cc) Status,
13 _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,14 _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(cc) Status,
14 _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,15 _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(cc) Status,
15 _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,16 _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(cc) Status,
16 _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,17 _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(cc) Status,
17 _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status,18 _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(cc) Status,
18 _poll: *const fn (*const ManagedNetworkProtocol) callconv(.C) Status,19 _poll: *const fn (*const ManagedNetworkProtocol) callconv(cc) Status,
1920
20 /// Returns the operational parameters for the current MNP child driver.21 /// Returns the operational parameters for the current MNP child driver.
21 /// May also support returning the underlying SNP driver mode data.22 /// May also support returning the underlying SNP driver mode data.
lib/std/os/uefi/protocols/managed_network_service_binding_protocol.zig+3-2
...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;
3const Handle = uefi.Handle;3const Handle = uefi.Handle;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7pub const ManagedNetworkServiceBindingProtocol = extern struct {8pub const ManagedNetworkServiceBindingProtocol = extern struct {
8 _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status,9 _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(cc) Status,
9 _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status,10 _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(cc) Status,
1011
11 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {12 pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {
12 return self._create_child(self, handle);13 return self._create_child(self, handle);
lib/std/os/uefi/protocols/rng_protocol.zig+3-2
...@@ -2,11 +2,12 @@ const std = @import("std");...@@ -2,11 +2,12 @@ const std = @import("std");
2const uefi = std.os.uefi;2const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Status = uefi.Status;4const Status = uefi.Status;
5const cc = uefi.cc;
56
6/// Random Number Generator protocol7/// Random Number Generator protocol
7pub const RNGProtocol = extern struct {8pub const RNGProtocol = extern struct {
8 _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status,9 _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(cc) Status,
9 _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status,10 _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(cc) Status,
1011
11 /// Returns information about the random number generation implementation.12 /// Returns information about the random number generation implementation.
12 pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status {13 pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status {
lib/std/os/uefi/protocols/simple_file_system_protocol.zig+2-1
...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const FileProtocol = uefi.protocols.FileProtocol;4const FileProtocol = uefi.protocols.FileProtocol;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7pub const SimpleFileSystemProtocol = extern struct {8pub const SimpleFileSystemProtocol = extern struct {
8 revision: u64,9 revision: u64,
9 _open_volume: *const fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status,10 _open_volume: *const fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(cc) Status,
1011
11 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {12 pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {
12 return self._open_volume(self, root);13 return self._open_volume(self, root);
lib/std/os/uefi/protocols/simple_network_protocol.zig+14-13
...@@ -3,22 +3,23 @@ const uefi = std.os.uefi;...@@ -3,22 +3,23 @@ const uefi = std.os.uefi;
3const Event = uefi.Event;3const Event = uefi.Event;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7pub const SimpleNetworkProtocol = extern struct {8pub const SimpleNetworkProtocol = extern struct {
8 revision: u64,9 revision: u64,
9 _start: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,10 _start: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status,
10 _stop: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,11 _stop: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status,
11 _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status,12 _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(cc) Status,
12 _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status,13 _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(cc) Status,
13 _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status,14 _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status,
14 _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status,15 _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(cc) Status,
15 _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,16 _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(cc) Status,
16 _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status,17 _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(cc) Status,
17 _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,18 _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(cc) Status,
18 _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status,19 _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(cc) Status,
19 _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status,20 _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(cc) Status,
20 _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status,21 _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(cc) Status,
21 _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status,22 _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(cc) Status,
22 wait_for_packet: Event,23 wait_for_packet: Event,
23 mode: *SimpleNetworkMode,24 mode: *SimpleNetworkMode,
2425
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+3-2
...@@ -3,11 +3,12 @@ const uefi = std.os.uefi;...@@ -3,11 +3,12 @@ const uefi = std.os.uefi;
3const Event = uefi.Event;3const Event = uefi.Event;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7/// Protocol for mice8/// Protocol for mice
8pub const SimplePointerProtocol = struct {9pub const SimplePointerProtocol = struct {
9 _reset: *const fn (*const SimplePointerProtocol, bool) callconv(.C) Status,10 _reset: *const fn (*const SimplePointerProtocol, bool) callconv(cc) Status,
10 _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status,11 _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(cc) Status,
11 wait_for_input: Event,12 wait_for_input: Event,
12 mode: *SimplePointerMode,13 mode: *SimplePointerMode,
1314
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+7-6
...@@ -3,15 +3,16 @@ const uefi = std.os.uefi;...@@ -3,15 +3,16 @@ const uefi = std.os.uefi;
3const Event = uefi.Event;3const Event = uefi.Event;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7/// Character input devices, e.g. Keyboard8/// Character input devices, e.g. Keyboard
8pub const SimpleTextInputExProtocol = extern struct {9pub const SimpleTextInputExProtocol = extern struct {
9 _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status,10 _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(cc) Status,
10 _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status,11 _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(cc) Status,
11 wait_for_key_ex: Event,12 wait_for_key_ex: Event,
12 _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status,13 _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(cc) Status,
13 _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status,14 _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(cc) usize, **anyopaque) callconv(cc) Status,
14 _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status,15 _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(cc) Status,
1516
16 /// Resets the input device hardware.17 /// Resets the input device hardware.
17 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {18 pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {
...@@ -29,7 +30,7 @@ pub const SimpleTextInputExProtocol = extern struct {...@@ -29,7 +30,7 @@ pub const SimpleTextInputExProtocol = extern struct {
29 }30 }
3031
31 /// Register a notification function for a particular keystroke for the input device.32 /// Register a notification function for a particular keystroke for the input device.
32 pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: *const fn (*const KeyData) callconv(.C) usize, handle: **anyopaque) Status {33 pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: *const fn (*const KeyData) callconv(cc) usize, handle: **anyopaque) Status {
33 return self._register_key_notify(self, key_data, notify, handle);34 return self._register_key_notify(self, key_data, notify, handle);
34 }35 }
3536
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+3-2
...@@ -4,11 +4,12 @@ const Event = uefi.Event;...@@ -4,11 +4,12 @@ const Event = uefi.Event;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const InputKey = uefi.protocols.InputKey;5const InputKey = uefi.protocols.InputKey;
6const Status = uefi.Status;6const Status = uefi.Status;
7const cc = uefi.cc;
78
8/// Character input devices, e.g. Keyboard9/// Character input devices, e.g. Keyboard
9pub const SimpleTextInputProtocol = extern struct {10pub const SimpleTextInputProtocol = extern struct {
10 _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status,11 _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(cc) Status,
11 _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status,12 _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(cc) Status,
12 wait_for_key: Event,13 wait_for_key: Event,
1314
14 /// Resets the input device hardware.15 /// Resets the input device hardware.
lib/std/os/uefi/protocols/simple_text_output_protocol.zig+10-9
...@@ -2,18 +2,19 @@ const std = @import("std");...@@ -2,18 +2,19 @@ const std = @import("std");
2const uefi = std.os.uefi;2const uefi = std.os.uefi;
3const Guid = uefi.Guid;3const Guid = uefi.Guid;
4const Status = uefi.Status;4const Status = uefi.Status;
5const cc = uefi.cc;
56
6/// Character output devices7/// Character output devices
7pub const SimpleTextOutputProtocol = extern struct {8pub const SimpleTextOutputProtocol = extern struct {
8 _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,9 _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(cc) Status,
9 _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,10 _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(cc) Status,
10 _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,11 _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(cc) Status,
11 _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status,12 _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(cc) Status,
12 _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,13 _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(cc) Status,
13 _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,14 _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(cc) Status,
14 _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(.C) Status,15 _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(cc) Status,
15 _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status,16 _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(cc) Status,
16 _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,17 _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(cc) Status,
17 mode: *SimpleTextOutputMode,18 mode: *SimpleTextOutputMode,
1819
19 /// Resets the text output device hardware.20 /// Resets the text output device hardware.
lib/std/os/uefi/protocols/udp6_protocol.zig+8-7
...@@ -8,15 +8,16 @@ const Ip6ModeData = uefi.protocols.Ip6ModeData;...@@ -8,15 +8,16 @@ const Ip6ModeData = uefi.protocols.Ip6ModeData;
8const Ip6Address = uefi.protocols.Ip6Address;8const Ip6Address = uefi.protocols.Ip6Address;
9const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;9const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
10const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;10const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
11const cc = uefi.cc;
1112
12pub const Udp6Protocol = extern struct {13pub const Udp6Protocol = extern struct {
13 _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,14 _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status,
14 _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status,15 _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(cc) Status,
15 _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,16 _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(cc) Status,
16 _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,17 _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(cc) Status,
17 _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,18 _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(cc) Status,
18 _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status,19 _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(cc) Status,
19 _poll: *const fn (*const Udp6Protocol) callconv(.C) Status,20 _poll: *const fn (*const Udp6Protocol) callconv(cc) Status,
2021
21 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {22 pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
22 return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);23 return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);
lib/std/os/uefi/protocols/udp6_service_binding_protocol.zig+3-2
...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;...@@ -3,10 +3,11 @@ const uefi = std.os.uefi;
3const Handle = uefi.Handle;3const Handle = uefi.Handle;
4const Guid = uefi.Guid;4const Guid = uefi.Guid;
5const Status = uefi.Status;5const Status = uefi.Status;
6const cc = uefi.cc;
67
7pub const Udp6ServiceBindingProtocol = extern struct {8pub const Udp6ServiceBindingProtocol = extern struct {
8 _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status,9 _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(cc) Status,
9 _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status,10 _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(cc) Status,
1011
11 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {12 pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {
12 return self._create_child(self, handle);13 return self._create_child(self, handle);
lib/std/os/uefi/tables/boot_services.zig+45-42
...@@ -6,6 +6,7 @@ const Handle = uefi.Handle;...@@ -6,6 +6,7 @@ const Handle = uefi.Handle;
6const Status = uefi.Status;6const Status = uefi.Status;
7const TableHeader = uefi.tables.TableHeader;7const TableHeader = uefi.tables.TableHeader;
8const DevicePathProtocol = uefi.protocols.DevicePathProtocol;8const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
9const cc = uefi.cc;
910
10/// Boot services are services provided by the system's firmware until the operating system takes11/// Boot services are services provided by the system's firmware until the operating system takes
11/// over control over the hardware by calling exitBootServices.12/// over control over the hardware by calling exitBootServices.
...@@ -22,138 +23,140 @@ pub const BootServices = extern struct {...@@ -22,138 +23,140 @@ pub const BootServices = extern struct {
22 hdr: TableHeader,23 hdr: TableHeader,
2324
24 /// Raises a task's priority level and returns its previous level.25 /// Raises a task's priority level and returns its previous level.
25 raiseTpl: *const fn (new_tpl: usize) callconv(.C) usize,26 raiseTpl: *const fn (new_tpl: usize) callconv(cc) usize,
2627
27 /// Restores a task's priority level to its previous value.28 /// Restores a task's priority level to its previous value.
28 restoreTpl: *const fn (old_tpl: usize) callconv(.C) void,29 restoreTpl: *const fn (old_tpl: usize) callconv(cc) void,
2930
30 /// Allocates memory pages from the system.31 /// Allocates memory pages from the system.
31 allocatePages: *const fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(.C) Status,32 allocatePages: *const fn (alloc_type: AllocateType, mem_type: MemoryType, pages: usize, memory: *[*]align(4096) u8) callconv(cc) Status,
3233
33 /// Frees memory pages.34 /// Frees memory pages.
34 freePages: *const fn (memory: [*]align(4096) u8, pages: usize) callconv(.C) Status,35 freePages: *const fn (memory: [*]align(4096) u8, pages: usize) callconv(cc) Status,
3536
36 /// Returns the current memory map.37 /// Returns the current memory map.
37 getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(.C) Status,38 getMemoryMap: *const fn (mmap_size: *usize, mmap: ?[*]MemoryDescriptor, mapKey: *usize, descriptor_size: *usize, descriptor_version: *u32) callconv(cc) Status,
3839
39 /// Allocates pool memory.40 /// Allocates pool memory.
40 allocatePool: *const fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(.C) Status,41 allocatePool: *const fn (pool_type: MemoryType, size: usize, buffer: *[*]align(8) u8) callconv(cc) Status,
4142
42 /// Returns pool memory to the system.43 /// Returns pool memory to the system.
43 freePool: *const fn (buffer: [*]align(8) u8) callconv(.C) Status,44 freePool: *const fn (buffer: [*]align(8) u8) callconv(cc) Status,
4445
45 /// Creates an event.46 /// Creates an event.
46 createEvent: *const fn (type: u32, notify_tpl: usize, notify_func: ?*const fn (Event, ?*anyopaque) callconv(.C) void, notifyCtx: ?*const anyopaque, event: *Event) callconv(.C) Status,47 createEvent: *const fn (type: u32, notify_tpl: usize, notify_func: ?*const fn (Event, ?*anyopaque) callconv(cc) void, notifyCtx: ?*const anyopaque, event: *Event) callconv(cc) Status,
4748
48 /// Sets the type of timer and the trigger time for a timer event.49 /// Sets the type of timer and the trigger time for a timer event.
49 setTimer: *const fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(.C) Status,50 setTimer: *const fn (event: Event, type: TimerDelay, triggerTime: u64) callconv(cc) Status,
5051
51 /// Stops execution until an event is signaled.52 /// Stops execution until an event is signaled.
52 waitForEvent: *const fn (event_len: usize, events: [*]const Event, index: *usize) callconv(.C) Status,53 waitForEvent: *const fn (event_len: usize, events: [*]const Event, index: *usize) callconv(cc) Status,
5354
54 /// Signals an event.55 /// Signals an event.
55 signalEvent: *const fn (event: Event) callconv(.C) Status,56 signalEvent: *const fn (event: Event) callconv(cc) Status,
5657
57 /// Closes an event.58 /// Closes an event.
58 closeEvent: *const fn (event: Event) callconv(.C) Status,59 closeEvent: *const fn (event: Event) callconv(cc) Status,
5960
60 /// Checks whether an event is in the signaled state.61 /// Checks whether an event is in the signaled state.
61 checkEvent: *const fn (event: Event) callconv(.C) Status,62 checkEvent: *const fn (event: Event) callconv(cc) Status,
6263
63 /// Installs a protocol interface on a device handle. If the handle does not exist, it is created64 /// Installs a protocol interface on a device handle. If the handle does not exist, it is created
64 /// and added to the list of handles in the system. installMultipleProtocolInterfaces()65 /// and added to the list of handles in the system. installMultipleProtocolInterfaces()
65 /// performs more error checking than installProtocolInterface(), so its use is recommended over this.66 /// performs more error checking than installProtocolInterface(), so its use is recommended over this.
66 installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(.C) Status,67 installProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface_type: EfiInterfaceType, interface: *anyopaque) callconv(cc) Status,
6768
68 /// Reinstalls a protocol interface on a device handle69 /// Reinstalls a protocol interface on a device handle
69 reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(.C) Status,70 reinstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, old_interface: *anyopaque, new_interface: *anyopaque) callconv(cc) Status,
7071
71 /// Removes a protocol interface from a device handle. Usage of72 /// Removes a protocol interface from a device handle. Usage of
72 /// uninstallMultipleProtocolInterfaces is recommended over this.73 /// uninstallMultipleProtocolInterfaces is recommended over this.
73 uninstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(.C) Status,74 uninstallProtocolInterface: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *anyopaque) callconv(cc) Status,
7475
75 /// Queries a handle to determine if it supports a specified protocol.76 /// Queries a handle to determine if it supports a specified protocol.
76 handleProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(.C) Status,77 handleProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque) callconv(cc) Status,
7778
78 reserved: *anyopaque,79 reserved: *anyopaque,
7980
80 /// Creates an event that is to be signaled whenever an interface is installed for a specified protocol.81 /// Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
81 registerProtocolNotify: *const fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(.C) Status,82 registerProtocolNotify: *const fn (protocol: *align(8) const Guid, event: Event, registration: **anyopaque) callconv(cc) Status,
8283
83 /// Returns an array of handles that support a specified protocol.84 /// Returns an array of handles that support a specified protocol.
84 locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(.C) Status,85 locateHandle: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, bufferSize: *usize, buffer: [*]Handle) callconv(cc) Status,
8586
86 /// Locates the handle to a device on the device path that supports the specified protocol87 /// Locates the handle to a device on the device path that supports the specified protocol
87 locateDevicePath: *const fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(.C) Status,88 locateDevicePath: *const fn (protocols: *align(8) const Guid, device_path: **const DevicePathProtocol, device: *?Handle) callconv(cc) Status,
8889
89 /// Adds, updates, or removes a configuration table entry from the EFI System Table.90 /// Adds, updates, or removes a configuration table entry from the EFI System Table.
90 installConfigurationTable: *const fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(.C) Status,91 installConfigurationTable: *const fn (guid: *align(8) const Guid, table: ?*anyopaque) callconv(cc) Status,
9192
92 /// Loads an EFI image into memory.93 /// Loads an EFI image into memory.
93 loadImage: *const fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(.C) Status,94 loadImage: *const fn (boot_policy: bool, parent_image_handle: Handle, device_path: ?*const DevicePathProtocol, source_buffer: ?[*]const u8, source_size: usize, imageHandle: *?Handle) callconv(cc) Status,
9495
95 /// Transfers control to a loaded image's entry point.96 /// Transfers control to a loaded image's entry point.
96 startImage: *const fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(.C) Status,97 startImage: *const fn (image_handle: Handle, exit_data_size: ?*usize, exit_data: ?*[*]u16) callconv(cc) Status,
9798
98 /// Terminates a loaded EFI image and returns control to boot services.99 /// Terminates a loaded EFI image and returns control to boot services.
99 exit: *const fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(.C) Status,100 exit: *const fn (image_handle: Handle, exit_status: Status, exit_data_size: usize, exit_data: ?*const anyopaque) callconv(cc) Status,
100101
101 /// Unloads an image.102 /// Unloads an image.
102 unloadImage: *const fn (image_handle: Handle) callconv(.C) Status,103 unloadImage: *const fn (image_handle: Handle) callconv(cc) Status,
103104
104 /// Terminates all boot services.105 /// Terminates all boot services.
105 exitBootServices: *const fn (image_handle: Handle, map_key: usize) callconv(.C) Status,106 exitBootServices: *const fn (image_handle: Handle, map_key: usize) callconv(cc) Status,
106107
107 /// Returns a monotonically increasing count for the platform.108 /// Returns a monotonically increasing count for the platform.
108 getNextMonotonicCount: *const fn (count: *u64) callconv(.C) Status,109 getNextMonotonicCount: *const fn (count: *u64) callconv(cc) Status,
109110
110 /// Induces a fine-grained stall.111 /// Induces a fine-grained stall.
111 stall: *const fn (microseconds: usize) callconv(.C) Status,112 stall: *const fn (microseconds: usize) callconv(cc) Status,
112113
113 /// Sets the system's watchdog timer.114 /// Sets the system's watchdog timer.
114 setWatchdogTimer: *const fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(.C) Status,115 setWatchdogTimer: *const fn (timeout: usize, watchdogCode: u64, data_size: usize, watchdog_data: ?[*]const u16) callconv(cc) Status,
115116
116 /// Connects one or more drives to a controller.117 /// Connects one or more drives to a controller.
117 connectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(.C) Status,118 connectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, remaining_device_path: ?*DevicePathProtocol, recursive: bool) callconv(cc) Status,
118119
119 // Disconnects one or more drivers from a controller120 // Disconnects one or more drivers from a controller
120 disconnectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(.C) Status,121 disconnectController: *const fn (controller_handle: Handle, driver_image_handle: ?Handle, child_handle: ?Handle) callconv(cc) Status,
121122
122 /// Queries a handle to determine if it supports a specified protocol.123 /// Queries a handle to determine if it supports a specified protocol.
123 openProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(.C) Status,124 openProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, interface: *?*anyopaque, agent_handle: ?Handle, controller_handle: ?Handle, attributes: OpenProtocolAttributes) callconv(cc) Status,
124125
125 /// Closes a protocol on a handle that was opened using openProtocol().126 /// Closes a protocol on a handle that was opened using openProtocol().
126 closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(.C) Status,127 closeProtocol: *const fn (handle: Handle, protocol: *align(8) const Guid, agentHandle: Handle, controller_handle: ?Handle) callconv(cc) Status,
127128
128 /// Retrieves the list of agents that currently have a protocol interface opened.129 /// Retrieves the list of agents that currently have a protocol interface opened.
129 openProtocolInformation: *const fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(.C) Status,130 openProtocolInformation: *const fn (handle: Handle, protocol: *align(8) const Guid, entry_buffer: *[*]ProtocolInformationEntry, entry_count: *usize) callconv(cc) Status,
130131
131 /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.132 /// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.
132 protocolsPerHandle: *const fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(.C) Status,133 protocolsPerHandle: *const fn (handle: Handle, protocol_buffer: *[*]*align(8) const Guid, protocol_buffer_count: *usize) callconv(cc) Status,
133134
134 /// Returns an array of handles that support the requested protocol in a buffer allocated from pool.135 /// Returns an array of handles that support the requested protocol in a buffer allocated from pool.
135 locateHandleBuffer: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(.C) Status,136 locateHandleBuffer: *const fn (search_type: LocateSearchType, protocol: ?*align(8) const Guid, search_key: ?*const anyopaque, num_handles: *usize, buffer: *[*]Handle) callconv(cc) Status,
136137
137 /// Returns the first protocol instance that matches the given protocol.138 /// Returns the first protocol instance that matches the given protocol.
138 locateProtocol: *const fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(.C) Status,139 locateProtocol: *const fn (protocol: *align(8) const Guid, registration: ?*const anyopaque, interface: *?*anyopaque) callconv(cc) Status,
139140
140 /// Installs one or more protocol interfaces into the boot services environment141 /// Installs one or more protocol interfaces into the boot services environment
142 // TODO: use callconv(cc) instead once that works
141 installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,143 installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
142144
143 /// Removes one or more protocol interfaces into the boot services environment145 /// Removes one or more protocol interfaces into the boot services environment
146 // TODO: use callconv(cc) instead once that works
144 uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,147 uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status,
145148
146 /// Computes and returns a 32-bit CRC for a data buffer.149 /// Computes and returns a 32-bit CRC for a data buffer.
147 calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(.C) Status,150 calculateCrc32: *const fn (data: [*]const u8, data_size: usize, *u32) callconv(cc) Status,
148151
149 /// Copies the contents of one buffer to another buffer152 /// Copies the contents of one buffer to another buffer
150 copyMem: *const fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(.C) void,153 copyMem: *const fn (dest: [*]u8, src: [*]const u8, len: usize) callconv(cc) void,
151154
152 /// Fills a buffer with a specified value155 /// Fills a buffer with a specified value
153 setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(.C) void,156 setMem: *const fn (buffer: [*]u8, size: usize, value: u8) callconv(cc) void,
154157
155 /// Creates an event in a group.158 /// Creates an event in a group.
156 createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(.C) Status,159 createEventEx: *const fn (type: u32, notify_tpl: usize, notify_func: EfiEventNotify, notify_ctx: *const anyopaque, event_group: *align(8) const Guid, event: *Event) callconv(cc) Status,
157160
158 /// Opens a protocol with a structure as the loaded image for a UEFI application161 /// Opens a protocol with a structure as the loaded image for a UEFI application
159 pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {162 pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol {
...@@ -191,7 +194,7 @@ pub const BootServices = extern struct {...@@ -191,7 +194,7 @@ pub const BootServices = extern struct {
191 pub const tpl_high_level: usize = 31;194 pub const tpl_high_level: usize = 31;
192};195};
193196
194pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(.C) void;197pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void;
195198
196pub const TimerDelay = enum(u32) {199pub const TimerDelay = enum(u32) {
197 TimerCancel,200 TimerCancel,
lib/std/os/uefi/tables/runtime_services.zig+15-14
...@@ -6,6 +6,7 @@ const Time = uefi.Time;...@@ -6,6 +6,7 @@ const Time = uefi.Time;
6const TimeCapabilities = uefi.TimeCapabilities;6const TimeCapabilities = uefi.TimeCapabilities;
7const Status = uefi.Status;7const Status = uefi.Status;
8const MemoryDescriptor = uefi.tables.MemoryDescriptor;8const MemoryDescriptor = uefi.tables.MemoryDescriptor;
9const cc = uefi.cc;
910
10/// Runtime services are provided by the firmware before and after exitBootServices has been called.11/// Runtime services are provided by the firmware before and after exitBootServices has been called.
11///12///
...@@ -19,50 +20,50 @@ pub const RuntimeServices = extern struct {...@@ -19,50 +20,50 @@ pub const RuntimeServices = extern struct {
19 hdr: TableHeader,20 hdr: TableHeader,
2021
21 /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.22 /// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.
22 getTime: *const fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(.C) Status,23 getTime: *const fn (time: *uefi.Time, capabilities: ?*TimeCapabilities) callconv(cc) Status,
2324
24 /// Sets the current local time and date information25 /// Sets the current local time and date information
25 setTime: *const fn (time: *uefi.Time) callconv(.C) Status,26 setTime: *const fn (time: *uefi.Time) callconv(cc) Status,
2627
27 /// Returns the current wakeup alarm clock setting28 /// Returns the current wakeup alarm clock setting
28 getWakeupTime: *const fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(.C) Status,29 getWakeupTime: *const fn (enabled: *bool, pending: *bool, time: *uefi.Time) callconv(cc) Status,
2930
30 /// Sets the system wakeup alarm clock time31 /// Sets the system wakeup alarm clock time
31 setWakeupTime: *const fn (enable: *bool, time: ?*uefi.Time) callconv(.C) Status,32 setWakeupTime: *const fn (enable: *bool, time: ?*uefi.Time) callconv(cc) Status,
3233
33 /// Changes the runtime addressing mode of EFI firmware from physical to virtual.34 /// Changes the runtime addressing mode of EFI firmware from physical to virtual.
34 setVirtualAddressMap: *const fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(.C) Status,35 setVirtualAddressMap: *const fn (mmap_size: usize, descriptor_size: usize, descriptor_version: u32, virtual_map: [*]MemoryDescriptor) callconv(cc) Status,
3536
36 /// Determines the new virtual address that is to be used on subsequent memory accesses.37 /// Determines the new virtual address that is to be used on subsequent memory accesses.
37 convertPointer: *const fn (debug_disposition: usize, address: **anyopaque) callconv(.C) Status,38 convertPointer: *const fn (debug_disposition: usize, address: **anyopaque) callconv(cc) Status,
3839
39 /// Returns the value of a variable.40 /// Returns the value of a variable.
40 getVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(.C) Status,41 getVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: ?*u32, data_size: *usize, data: ?*anyopaque) callconv(cc) Status,
4142
42 /// Enumerates the current variable names.43 /// Enumerates the current variable names.
43 getNextVariableName: *const fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(.C) Status,44 getNextVariableName: *const fn (var_name_size: *usize, var_name: [*:0]u16, vendor_guid: *align(8) Guid) callconv(cc) Status,
4445
45 /// Sets the value of a variable.46 /// Sets the value of a variable.
46 setVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(.C) Status,47 setVariable: *const fn (var_name: [*:0]const u16, vendor_guid: *align(8) const Guid, attributes: u32, data_size: usize, data: *anyopaque) callconv(cc) Status,
4748
48 /// Return the next high 32 bits of the platform's monotonic counter49 /// Return the next high 32 bits of the platform's monotonic counter
49 getNextHighMonotonicCount: *const fn (high_count: *u32) callconv(.C) Status,50 getNextHighMonotonicCount: *const fn (high_count: *u32) callconv(cc) Status,
5051
51 /// Resets the entire platform.52 /// Resets the entire platform.
52 resetSystem: *const fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(.C) noreturn,53 resetSystem: *const fn (reset_type: ResetType, reset_status: Status, data_size: usize, reset_data: ?*const anyopaque) callconv(cc) noreturn,
5354
54 /// Passes capsules to the firmware with both virtual and physical mapping.55 /// Passes capsules to the firmware with both virtual and physical mapping.
55 /// Depending on the intended consumption, the firmware may process the capsule immediately.56 /// Depending on the intended consumption, the firmware may process the capsule immediately.
56 /// If the payload should persist across a system reset, the reset value returned from57 /// If the payload should persist across a system reset, the reset value returned from
57 /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule58 /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule
58 /// to be processed by the firmware as part of the reset process.59 /// to be processed by the firmware as part of the reset process.
59 updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(.C) Status,60 updateCapsule: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, scatter_gather_list: EfiPhysicalAddress) callconv(cc) Status,
6061
61 /// Returns if the capsule can be supported via `updateCapsule`62 /// Returns if the capsule can be supported via `updateCapsule`
62 queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(.C) Status,63 queryCapsuleCapabilities: *const fn (capsule_header_array: **CapsuleHeader, capsule_count: usize, maximum_capsule_size: *usize, resetType: ResetType) callconv(cc) Status,
6364
64 /// Returns information about the EFI variables65 /// Returns information about the EFI variables
65 queryVariableInfo: *const fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(.C) Status,66 queryVariableInfo: *const fn (attributes: *u32, maximum_variable_storage_size: *u64, remaining_variable_storage_size: *u64, maximum_variable_size: *u64) callconv(cc) Status,
6667
67 pub const signature: u64 = 0x56524553544e5552;68 pub const signature: u64 = 0x56524553544e5552;
68};69};
src/Sema.zig+39-6
...@@ -6628,7 +6628,7 @@ fn checkCallArgumentCount(...@@ -6628,7 +6628,7 @@ fn checkCallArgumentCount(
6628 const fn_params_len = func_ty_info.param_types.len;6628 const fn_params_len = func_ty_info.param_types.len;
6629 const args_len = total_args - @intFromBool(member_fn);6629 const args_len = total_args - @intFromBool(member_fn);
6630 if (func_ty_info.is_var_args) {6630 if (func_ty_info.is_var_args) {
6631 assert(func_ty_info.cc == .C);6631 assert(callConvSupportsVarArgs(func_ty_info.cc));
6632 if (total_args >= fn_params_len) return func_ty;6632 if (total_args >= fn_params_len) return func_ty;
6633 } else if (fn_params_len == total_args) {6633 } else if (fn_params_len == total_args) {
6634 return func_ty;6634 return func_ty;
...@@ -8917,6 +8917,41 @@ fn handleExternLibName(...@@ -8917,6 +8917,41 @@ fn handleExternLibName(
8917 return sema.gpa.dupeZ(u8, lib_name);8917 return sema.gpa.dupeZ(u8, lib_name);
8918}8918}
89198919
8920/// These are calling conventions that are confirmed to work with variadic functions.
8921/// Any calling conventions not included here are either not yet verified to work with variadic
8922/// functions or there are no more other calling conventions that support variadic functions.
8923const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention{
8924 .C,
8925};
8926fn callConvSupportsVarArgs(cc: std.builtin.CallingConvention) bool {
8927 return for (calling_conventions_supporting_var_args) |supported_cc| {
8928 if (cc == supported_cc) return true;
8929 } else false;
8930}
8931fn checkCallConvSupportsVarArgs(sema: *Sema, block: *Block, src: LazySrcLoc, cc: std.builtin.CallingConvention) CompileError!void {
8932 const CallingConventionsSupportingVarArgsList = struct {
8933 pub fn format(_: @This(), comptime fmt: []const u8, options: std.fmt.FormatOptions, writer: anytype) !void {
8934 _ = fmt;
8935 _ = options;
8936 for (calling_conventions_supporting_var_args, 0..) |cc_inner, i| {
8937 if (i != 0)
8938 try writer.writeAll(", ");
8939 try writer.print("'.{s}'", .{@tagName(cc_inner)});
8940 }
8941 }
8942 };
8943
8944 if (!callConvSupportsVarArgs(cc)) {
8945 const msg = msg: {
8946 const msg = try sema.errMsg(block, src, "variadic function does not support '.{s}' calling convention", .{@tagName(cc)});
8947 errdefer msg.destroy(sema.gpa);
8948 try sema.errNote(block, src, msg, "supported calling conventions: {}", .{CallingConventionsSupportingVarArgsList{}});
8949 break :msg msg;
8950 };
8951 return sema.failWithOwnedErrorMsg(msg);
8952 }
8953}
8954
8920const FuncLinkSection = union(enum) {8955const FuncLinkSection = union(enum) {
8921 generic,8956 generic,
8922 default,8957 default,
...@@ -8963,9 +8998,7 @@ fn funcCommon(...@@ -8963,9 +8998,7 @@ fn funcCommon(
8963 if (is_generic) {8998 if (is_generic) {
8964 return sema.fail(block, func_src, "generic function cannot be variadic", .{});8999 return sema.fail(block, func_src, "generic function cannot be variadic", .{});
8965 }9000 }
8966 if (cc.? != .C) {9001 try sema.checkCallConvSupportsVarArgs(block, cc_src, cc.?);
8967 return sema.fail(block, cc_src, "variadic function must have 'C' calling convention", .{});
8968 }
8969 }9002 }
89709003
8971 var destroy_fn_on_error = false;9004 var destroy_fn_on_error = false;
...@@ -20327,8 +20360,8 @@ fn zirReify(...@@ -20327,8 +20360,8 @@ fn zirReify(
2032720360
20328 const is_var_args = is_var_args_val.toBool();20361 const is_var_args = is_var_args_val.toBool();
20329 const cc = mod.toEnum(std.builtin.CallingConvention, calling_convention_val);20362 const cc = mod.toEnum(std.builtin.CallingConvention, calling_convention_val);
20330 if (is_var_args and cc != .C) {20363 if (is_var_args) {
20331 return sema.fail(block, src, "varargs functions must have C calling convention", .{});20364 try sema.checkCallConvSupportsVarArgs(block, src, cc);
20332 }20365 }
2033320366
20334 const alignment = alignment: {20367 const alignment = alignment: {
test/cases/compile_errors/invalid_variadic_function.zig+8-1
...@@ -1,5 +1,6 @@...@@ -1,5 +1,6 @@
1fn foo(...) void {}1fn foo(...) void {}
2fn bar(a: anytype, ...) callconv(a) void {}2fn bar(a: anytype, ...) callconv(a) void {}
3inline fn foo2(...) void {}
34
4comptime {5comptime {
5 _ = foo;6 _ = foo;
...@@ -7,10 +8,16 @@ comptime {...@@ -7,10 +8,16 @@ comptime {
7comptime {8comptime {
8 _ = bar;9 _ = bar;
9}10}
11comptime {
12 _ = foo2;
13}
1014
11// error15// error
12// backend=stage216// backend=stage2
13// target=native17// target=native
14//18//
15// :1:1: error: variadic function must have 'C' calling convention19// :1:1: error: variadic function does not support '.Unspecified' calling convention
20// :1:1: note: supported calling conventions: '.C'
16// :2:1: error: generic function cannot be variadic21// :2:1: error: generic function cannot be variadic
22// :1:1: error: variadic function does not support '.Inline' calling convention
23// :1:1: note: supported calling conventions: '.C'
test/cases/compile_errors/reify_type.Fn_with_is_var_args_true_and_non-C_callconv.zig+2-1
...@@ -16,4 +16,5 @@ comptime {...@@ -16,4 +16,5 @@ comptime {
16// backend=stage216// backend=stage2
17// target=native17// target=native
18//18//
19// :1:13: error: varargs functions must have C calling convention19// :1:13: error: variadic function does not support '.Unspecified' calling convention
20// :1:13: note: supported calling conventions: '.C'