| author | |
| committer | |
| log | 2b8c1f0d4619565255b9faff2d24bc2360012552 |
| tree | babdd081bafa95518c8ab9a21385aaa364081601 |
| parent | 3a30f0fa505e25c98772f9faffe5490b92773708 |
| parent | 026c63d8fe5caa30d003230b5514d8a3e274f82c |
| signature |
std.os.uefi: use std.os.uefi.cc instead of .C as calling convention28 files changed, 232 insertions(+), 159 deletions(-)
lib/std/os/uefi.zig+6| ... | ... | @@ -23,6 +23,12 @@ pub var system_table: *tables.SystemTable = undefined; |
| 23 | 23 | /// A handle to an event structure. |
| 24 | 24 | pub const Event = *opaque {}; |
| 25 | 25 | |
| 26 | /// The calling convention used for all external functions part of the UEFI API. | |
| 27 | pub const cc = switch (@import("builtin").target.cpu.arch) { | |
| 28 | .x86_64 => .Win64, | |
| 29 | else => .C, | |
| 30 | }; | |
| 31 | ||
| 26 | 32 | pub const MacAddress = extern struct { |
| 27 | 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 | 3 | const Event = uefi.Event; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | /// Protocol for touchscreens |
| 8 | 9 | pub const AbsolutePointerProtocol = extern struct { |
| 9 | _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status, | |
| 10 | _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status, | |
| 10 | _reset: *const fn (*const AbsolutePointerProtocol, bool) callconv(cc) Status, | |
| 11 | _get_state: *const fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(cc) Status, | |
| 11 | 12 | wait_for_input: Event, |
| 12 | 13 | mode: *AbsolutePointerMode, |
| 13 | 14 |
lib/std/os/uefi/protocols/block_io_protocol.zig+5-4| ... | ... | @@ -1,6 +1,7 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const uefi = std.os.uefi; |
| 3 | 3 | const Status = uefi.Status; |
| 4 | const cc = uefi.cc; | |
| 4 | 5 | |
| 5 | 6 | pub const EfiBlockMedia = extern struct { |
| 6 | 7 | /// The current media ID. If the media changes, this value is changed. |
| ... | ... | @@ -44,10 +45,10 @@ pub const BlockIoProtocol = extern struct { |
| 44 | 45 | revision: u64, |
| 45 | 46 | media: *EfiBlockMedia, |
| 46 | 47 | |
| 47 | _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(.C) Status, | |
| 48 | _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status, | |
| 49 | _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(.C) Status, | |
| 50 | _flush_blocks: *const fn (*BlockIoProtocol) callconv(.C) Status, | |
| 48 | _reset: *const fn (*BlockIoProtocol, extended_verification: bool) callconv(cc) Status, | |
| 49 | _read_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status, | |
| 50 | _write_blocks: *const fn (*BlockIoProtocol, media_id: u32, lba: u64, buffer_size: usize, buf: [*]u8) callconv(cc) Status, | |
| 51 | _flush_blocks: *const fn (*BlockIoProtocol) callconv(cc) Status, | |
| 51 | 52 | |
| 52 | 53 | /// Resets the block device hardware. |
| 53 | 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 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Handle = uefi.Handle; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | /// Override EDID information |
| 8 | 9 | pub 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, | |
| 10 | 11 | |
| 11 | 12 | /// Returns policy information and potentially a replacement EDID for the specified video output device. |
| 12 | 13 | pub fn getEdid( |
lib/std/os/uefi/protocols/file_protocol.zig+11-10| ... | ... | @@ -4,19 +4,20 @@ const io = std.io; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Time = uefi.Time; |
| 6 | 6 | const Status = uefi.Status; |
| 7 | const cc = uefi.cc; | |
| 7 | 8 | |
| 8 | 9 | pub const FileProtocol = extern struct { |
| 9 | 10 | revision: u64, |
| 10 | _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status, | |
| 11 | _close: *const fn (*const FileProtocol) callconv(.C) Status, | |
| 12 | _delete: *const fn (*const FileProtocol) callconv(.C) Status, | |
| 13 | _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status, | |
| 14 | _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status, | |
| 15 | _get_position: *const fn (*const FileProtocol, *u64) callconv(.C) Status, | |
| 16 | _set_position: *const fn (*const FileProtocol, u64) callconv(.C) Status, | |
| 17 | _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status, | |
| 18 | _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status, | |
| 19 | _flush: *const fn (*const FileProtocol) callconv(.C) Status, | |
| 11 | _open: *const fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(cc) Status, | |
| 12 | _close: *const fn (*const FileProtocol) callconv(cc) Status, | |
| 13 | _delete: *const fn (*const FileProtocol) callconv(cc) Status, | |
| 14 | _read: *const fn (*const FileProtocol, *usize, [*]u8) callconv(cc) Status, | |
| 15 | _write: *const fn (*const FileProtocol, *usize, [*]const u8) callconv(cc) Status, | |
| 16 | _get_position: *const fn (*const FileProtocol, *u64) callconv(cc) Status, | |
| 17 | _set_position: *const fn (*const FileProtocol, u64) callconv(cc) Status, | |
| 18 | _get_info: *const fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(cc) Status, | |
| 19 | _set_info: *const fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(cc) Status, | |
| 20 | _flush: *const fn (*const FileProtocol) callconv(cc) Status, | |
| 20 | 21 | |
| 21 | 22 | pub const SeekError = error{SeekError}; |
| 22 | 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 | 2 | const uefi = std.os.uefi; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Status = uefi.Status; |
| 5 | const cc = uefi.cc; | |
| 5 | 6 | |
| 6 | 7 | /// Graphics output |
| 7 | 8 | pub const GraphicsOutputProtocol = extern struct { |
| 8 | _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status, | |
| 9 | _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status, | |
| 10 | _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status, | |
| 9 | _query_mode: *const fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(cc) Status, | |
| 10 | _set_mode: *const fn (*const GraphicsOutputProtocol, u32) callconv(cc) Status, | |
| 11 | _blt: *const fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(cc) Status, | |
| 11 | 12 | mode: *GraphicsOutputProtocolMode, |
| 12 | 13 | |
| 13 | 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 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Status = uefi.Status; |
| 5 | 5 | const hii = uefi.protocols.hii; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | /// Database manager for HII-related data structures. |
| 8 | 9 | pub const HIIDatabaseProtocol = extern struct { |
| 9 | 10 | _new_package_list: Status, // TODO |
| 10 | _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status, | |
| 11 | _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status, | |
| 12 | _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status, | |
| 13 | _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status, | |
| 11 | _remove_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(cc) Status, | |
| 12 | _update_package_list: *const fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(cc) Status, | |
| 13 | _list_package_lists: *const fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(cc) Status, | |
| 14 | _export_package_lists: *const fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(cc) Status, | |
| 14 | 15 | _register_package_notify: Status, // TODO |
| 15 | 16 | _unregister_package_notify: Status, // TODO |
| 16 | 17 | _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 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Status = uefi.Status; |
| 5 | 5 | const hii = uefi.protocols.hii; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | /// Display a popup window |
| 8 | 9 | pub const HIIPopupProtocol = extern struct { |
| 9 | 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, | |
| 11 | 12 | |
| 12 | 13 | /// Displays a popup window. |
| 13 | 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 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Event = uefi.Event; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | pub const Ip6ConfigProtocol = extern struct { |
| 8 | _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status, | |
| 9 | _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status, | |
| 10 | _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status, | |
| 11 | _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status, | |
| 9 | _set_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(cc) Status, | |
| 10 | _get_data: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(cc) Status, | |
| 11 | _register_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(cc) Status, | |
| 12 | _unregister_data_notify: *const fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(cc) Status, | |
| 12 | 13 | |
| 13 | 14 | pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status { |
| 14 | 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 | 6 | const MacAddress = uefi.protocols.MacAddress; |
| 7 | 7 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; |
| 8 | 8 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 9 | const cc = uefi.cc; | |
| 9 | 10 | |
| 10 | 11 | pub const Ip6Protocol = extern struct { |
| 11 | _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, | |
| 12 | _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status, | |
| 13 | _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status, | |
| 14 | _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status, | |
| 15 | _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status, | |
| 16 | _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status, | |
| 17 | _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status, | |
| 18 | _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status, | |
| 19 | _poll: *const fn (*const Ip6Protocol) callconv(.C) Status, | |
| 12 | _get_mode_data: *const fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 13 | _configure: *const fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(cc) Status, | |
| 14 | _groups: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(cc) Status, | |
| 15 | _routes: *const fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(cc) Status, | |
| 16 | _neighbors: *const fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(cc) Status, | |
| 17 | _transmit: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(cc) Status, | |
| 18 | _receive: *const fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(cc) Status, | |
| 19 | _cancel: *const fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(cc) Status, | |
| 20 | _poll: *const fn (*const Ip6Protocol) callconv(cc) Status, | |
| 20 | 21 | |
| 21 | 22 | /// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver. |
| 22 | 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 | 3 | const Handle = uefi.Handle; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | pub const Ip6ServiceBindingProtocol = extern struct { |
| 8 | _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status, | |
| 9 | _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status, | |
| 9 | _create_child: *const fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const Ip6ServiceBindingProtocol, Handle) callconv(cc) Status, | |
| 10 | 11 | |
| 11 | 12 | pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status { |
| 12 | 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 | const SystemTable = uefi.tables.SystemTable; |
| 7 | 7 | const MemoryType = uefi.tables.MemoryType; |
| 8 | 8 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| 9 | const cc = uefi.cc; | |
| 9 | 10 | |
| 10 | 11 | pub const LoadedImageProtocol = extern struct { |
| 11 | 12 | revision: u32, |
| ... | ... | @@ -20,7 +21,7 @@ pub const LoadedImageProtocol = extern struct { |
| 20 | 21 | image_size: u64, |
| 21 | 22 | image_code_type: MemoryType, |
| 22 | 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, | |
| 24 | 25 | |
| 25 | 26 | /// Unloads an image from memory. |
| 26 | 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 | 6 | const Time = uefi.Time; |
| 7 | 7 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 8 | 8 | const MacAddress = uefi.protocols.MacAddress; |
| 9 | const cc = uefi.cc; | |
| 9 | 10 | |
| 10 | 11 | pub const ManagedNetworkProtocol = extern struct { |
| 11 | _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, | |
| 12 | _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status, | |
| 13 | _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status, | |
| 14 | _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status, | |
| 15 | _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status, | |
| 16 | _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status, | |
| 17 | _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status, | |
| 18 | _poll: *const fn (*const ManagedNetworkProtocol) callconv(.C) Status, | |
| 12 | _get_mode_data: *const fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 13 | _configure: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(cc) Status, | |
| 14 | _mcast_ip_to_mac: *const fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(cc) Status, | |
| 15 | _groups: *const fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(cc) Status, | |
| 16 | _transmit: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(cc) Status, | |
| 17 | _receive: *const fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(cc) Status, | |
| 18 | _cancel: *const fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(cc) Status, | |
| 19 | _poll: *const fn (*const ManagedNetworkProtocol) callconv(cc) Status, | |
| 19 | 20 | |
| 20 | 21 | /// Returns the operational parameters for the current MNP child driver. |
| 21 | 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 | 3 | const Handle = uefi.Handle; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | pub const ManagedNetworkServiceBindingProtocol = extern struct { |
| 8 | _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status, | |
| 9 | _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status, | |
| 9 | _create_child: *const fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(cc) Status, | |
| 10 | 11 | |
| 11 | 12 | pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status { |
| 12 | 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 | 2 | const uefi = std.os.uefi; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Status = uefi.Status; |
| 5 | const cc = uefi.cc; | |
| 5 | 6 | |
| 6 | 7 | /// Random Number Generator protocol |
| 7 | 8 | pub const RNGProtocol = extern struct { |
| 8 | _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status, | |
| 9 | _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status, | |
| 9 | _get_info: *const fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(cc) Status, | |
| 10 | _get_rng: *const fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(cc) Status, | |
| 10 | 11 | |
| 11 | 12 | /// Returns information about the random number generation implementation. |
| 12 | 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 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const FileProtocol = uefi.protocols.FileProtocol; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | pub const SimpleFileSystemProtocol = extern struct { |
| 8 | 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, | |
| 10 | 11 | |
| 11 | 12 | pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status { |
| 12 | 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 | 3 | const Event = uefi.Event; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | pub const SimpleNetworkProtocol = extern struct { |
| 8 | 9 | revision: u64, |
| 9 | _start: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status, | |
| 10 | _stop: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status, | |
| 11 | _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status, | |
| 12 | _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status, | |
| 13 | _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(.C) Status, | |
| 14 | _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status, | |
| 15 | _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status, | |
| 16 | _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status, | |
| 17 | _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status, | |
| 18 | _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status, | |
| 19 | _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status, | |
| 20 | _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status, | |
| 21 | _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status, | |
| 10 | _start: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status, | |
| 11 | _stop: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status, | |
| 12 | _initialize: *const fn (*const SimpleNetworkProtocol, usize, usize) callconv(cc) Status, | |
| 13 | _reset: *const fn (*const SimpleNetworkProtocol, bool) callconv(cc) Status, | |
| 14 | _shutdown: *const fn (*const SimpleNetworkProtocol) callconv(cc) Status, | |
| 15 | _receive_filters: *const fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(cc) Status, | |
| 16 | _station_address: *const fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(cc) Status, | |
| 17 | _statistics: *const fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(cc) Status, | |
| 18 | _mcast_ip_to_mac: *const fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(cc) Status, | |
| 19 | _nvdata: *const fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(cc) Status, | |
| 20 | _get_status: *const fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(cc) Status, | |
| 21 | _transmit: *const fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(cc) Status, | |
| 22 | _receive: *const fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(cc) Status, | |
| 22 | 23 | wait_for_packet: Event, |
| 23 | 24 | mode: *SimpleNetworkMode, |
| 24 | 25 |
lib/std/os/uefi/protocols/simple_pointer_protocol.zig+3-2| ... | ... | @@ -3,11 +3,12 @@ const uefi = std.os.uefi; |
| 3 | 3 | const Event = uefi.Event; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | /// Protocol for mice |
| 8 | 9 | pub const SimplePointerProtocol = struct { |
| 9 | _reset: *const fn (*const SimplePointerProtocol, bool) callconv(.C) Status, | |
| 10 | _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status, | |
| 10 | _reset: *const fn (*const SimplePointerProtocol, bool) callconv(cc) Status, | |
| 11 | _get_state: *const fn (*const SimplePointerProtocol, *SimplePointerState) callconv(cc) Status, | |
| 11 | 12 | wait_for_input: Event, |
| 12 | 13 | mode: *SimplePointerMode, |
| 13 | 14 |
lib/std/os/uefi/protocols/simple_text_input_ex_protocol.zig+7-6| ... | ... | @@ -3,15 +3,16 @@ const uefi = std.os.uefi; |
| 3 | 3 | const Event = uefi.Event; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | /// Character input devices, e.g. Keyboard |
| 8 | 9 | pub const SimpleTextInputExProtocol = extern struct { |
| 9 | _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status, | |
| 10 | _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status, | |
| 10 | _reset: *const fn (*const SimpleTextInputExProtocol, bool) callconv(cc) Status, | |
| 11 | _read_key_stroke_ex: *const fn (*const SimpleTextInputExProtocol, *KeyData) callconv(cc) Status, | |
| 11 | 12 | wait_for_key_ex: Event, |
| 12 | _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status, | |
| 13 | _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status, | |
| 14 | _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status, | |
| 13 | _set_state: *const fn (*const SimpleTextInputExProtocol, *const u8) callconv(cc) Status, | |
| 14 | _register_key_notify: *const fn (*const SimpleTextInputExProtocol, *const KeyData, *const fn (*const KeyData) callconv(cc) usize, **anyopaque) callconv(cc) Status, | |
| 15 | _unregister_key_notify: *const fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(cc) Status, | |
| 15 | 16 | |
| 16 | 17 | /// Resets the input device hardware. |
| 17 | 18 | pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status { |
| ... | ... | @@ -29,7 +30,7 @@ pub const SimpleTextInputExProtocol = extern struct { |
| 29 | 30 | } |
| 30 | 31 | |
| 31 | 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 | 34 | return self._register_key_notify(self, key_data, notify, handle); |
| 34 | 35 | } |
| 35 | 36 |
lib/std/os/uefi/protocols/simple_text_input_protocol.zig+3-2| ... | ... | @@ -4,11 +4,12 @@ const Event = uefi.Event; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const InputKey = uefi.protocols.InputKey; |
| 6 | 6 | const Status = uefi.Status; |
| 7 | const cc = uefi.cc; | |
| 7 | 8 | |
| 8 | 9 | /// Character input devices, e.g. Keyboard |
| 9 | 10 | pub const SimpleTextInputProtocol = extern struct { |
| 10 | _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status, | |
| 11 | _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status, | |
| 11 | _reset: *const fn (*const SimpleTextInputProtocol, bool) callconv(cc) Status, | |
| 12 | _read_key_stroke: *const fn (*const SimpleTextInputProtocol, *InputKey) callconv(cc) Status, | |
| 12 | 13 | wait_for_key: Event, |
| 13 | 14 | |
| 14 | 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 | 2 | const uefi = std.os.uefi; |
| 3 | 3 | const Guid = uefi.Guid; |
| 4 | 4 | const Status = uefi.Status; |
| 5 | const cc = uefi.cc; | |
| 5 | 6 | |
| 6 | 7 | /// Character output devices |
| 7 | 8 | pub const SimpleTextOutputProtocol = extern struct { |
| 8 | _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status, | |
| 9 | _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status, | |
| 10 | _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status, | |
| 11 | _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status, | |
| 12 | _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status, | |
| 13 | _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status, | |
| 14 | _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(.C) Status, | |
| 15 | _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status, | |
| 16 | _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status, | |
| 9 | _reset: *const fn (*const SimpleTextOutputProtocol, bool) callconv(cc) Status, | |
| 10 | _output_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(cc) Status, | |
| 11 | _test_string: *const fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(cc) Status, | |
| 12 | _query_mode: *const fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(cc) Status, | |
| 13 | _set_mode: *const fn (*const SimpleTextOutputProtocol, usize) callconv(cc) Status, | |
| 14 | _set_attribute: *const fn (*const SimpleTextOutputProtocol, usize) callconv(cc) Status, | |
| 15 | _clear_screen: *const fn (*const SimpleTextOutputProtocol) callconv(cc) Status, | |
| 16 | _set_cursor_position: *const fn (*const SimpleTextOutputProtocol, usize, usize) callconv(cc) Status, | |
| 17 | _enable_cursor: *const fn (*const SimpleTextOutputProtocol, bool) callconv(cc) Status, | |
| 17 | 18 | mode: *SimpleTextOutputMode, |
| 18 | 19 | |
| 19 | 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 | 8 | const Ip6Address = uefi.protocols.Ip6Address; |
| 9 | 9 | const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData; |
| 10 | 10 | const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode; |
| 11 | const cc = uefi.cc; | |
| 11 | 12 | |
| 12 | 13 | pub const Udp6Protocol = extern struct { |
| 13 | _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status, | |
| 14 | _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status, | |
| 15 | _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status, | |
| 16 | _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status, | |
| 17 | _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status, | |
| 18 | _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status, | |
| 19 | _poll: *const fn (*const Udp6Protocol) callconv(.C) Status, | |
| 14 | _get_mode_data: *const fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(cc) Status, | |
| 15 | _configure: *const fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(cc) Status, | |
| 16 | _groups: *const fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(cc) Status, | |
| 17 | _transmit: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(cc) Status, | |
| 18 | _receive: *const fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(cc) Status, | |
| 19 | _cancel: *const fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(cc) Status, | |
| 20 | _poll: *const fn (*const Udp6Protocol) callconv(cc) Status, | |
| 20 | 21 | |
| 21 | 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 | 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 | 3 | const Handle = uefi.Handle; |
| 4 | 4 | const Guid = uefi.Guid; |
| 5 | 5 | const Status = uefi.Status; |
| 6 | const cc = uefi.cc; | |
| 6 | 7 | |
| 7 | 8 | pub const Udp6ServiceBindingProtocol = extern struct { |
| 8 | _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status, | |
| 9 | _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status, | |
| 9 | _create_child: *const fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(cc) Status, | |
| 10 | _destroy_child: *const fn (*const Udp6ServiceBindingProtocol, Handle) callconv(cc) Status, | |
| 10 | 11 | |
| 11 | 12 | pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status { |
| 12 | 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 | const Status = uefi.Status; |
| 7 | 7 | const TableHeader = uefi.tables.TableHeader; |
| 8 | 8 | const DevicePathProtocol = uefi.protocols.DevicePathProtocol; |
| 9 | const cc = uefi.cc; | |
| 9 | 10 | |
| 10 | 11 | /// Boot services are services provided by the system's firmware until the operating system takes |
| 11 | 12 | /// over control over the hardware by calling exitBootServices. |
| ... | ... | @@ -22,138 +23,140 @@ pub const BootServices = extern struct { |
| 22 | 23 | hdr: TableHeader, |
| 23 | 24 | |
| 24 | 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, | |
| 26 | 27 | |
| 27 | 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, | |
| 29 | 30 | |
| 30 | 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, | |
| 32 | 33 | |
| 33 | 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, | |
| 35 | 36 | |
| 36 | 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, | |
| 38 | 39 | |
| 39 | 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, | |
| 41 | 42 | |
| 42 | 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, | |
| 44 | 45 | |
| 45 | 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, | |
| 47 | 48 | |
| 48 | 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, | |
| 50 | 51 | |
| 51 | 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, | |
| 53 | 54 | |
| 54 | 55 | /// Signals an event. |
| 55 | signalEvent: *const fn (event: Event) callconv(.C) Status, | |
| 56 | signalEvent: *const fn (event: Event) callconv(cc) Status, | |
| 56 | 57 | |
| 57 | 58 | /// Closes an event. |
| 58 | closeEvent: *const fn (event: Event) callconv(.C) Status, | |
| 59 | closeEvent: *const fn (event: Event) callconv(cc) Status, | |
| 59 | 60 | |
| 60 | 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, | |
| 62 | 63 | |
| 63 | 64 | /// Installs a protocol interface on a device handle. If the handle does not exist, it is created |
| 64 | 65 | /// and added to the list of handles in the system. installMultipleProtocolInterfaces() |
| 65 | 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, | |
| 67 | 68 | |
| 68 | 69 | /// 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, | |
| 70 | 71 | |
| 71 | 72 | /// Removes a protocol interface from a device handle. Usage of |
| 72 | 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, | |
| 74 | 75 | |
| 75 | 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, | |
| 77 | 78 | |
| 78 | 79 | reserved: *anyopaque, |
| 79 | 80 | |
| 80 | 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, | |
| 82 | 83 | |
| 83 | 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, | |
| 85 | 86 | |
| 86 | 87 | /// 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, | |
| 88 | 89 | |
| 89 | 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, | |
| 91 | 92 | |
| 92 | 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, | |
| 94 | 95 | |
| 95 | 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, | |
| 97 | 98 | |
| 98 | 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, | |
| 100 | 101 | |
| 101 | 102 | /// Unloads an image. |
| 102 | unloadImage: *const fn (image_handle: Handle) callconv(.C) Status, | |
| 103 | unloadImage: *const fn (image_handle: Handle) callconv(cc) Status, | |
| 103 | 104 | |
| 104 | 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, | |
| 106 | 107 | |
| 107 | 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, | |
| 109 | 110 | |
| 110 | 111 | /// Induces a fine-grained stall. |
| 111 | stall: *const fn (microseconds: usize) callconv(.C) Status, | |
| 112 | stall: *const fn (microseconds: usize) callconv(cc) Status, | |
| 112 | 113 | |
| 113 | 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, | |
| 115 | 116 | |
| 116 | 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, | |
| 118 | 119 | |
| 119 | 120 | // 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, | |
| 121 | 122 | |
| 122 | 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, | |
| 124 | 125 | |
| 125 | 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, | |
| 127 | 128 | |
| 128 | 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, | |
| 130 | 131 | |
| 131 | 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, | |
| 133 | 134 | |
| 134 | 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, | |
| 136 | 137 | |
| 137 | 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, | |
| 139 | 140 | |
| 140 | 141 | /// Installs one or more protocol interfaces into the boot services environment |
| 142 | // TODO: use callconv(cc) instead once that works | |
| 141 | 143 | installMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status, |
| 142 | 144 | |
| 143 | 145 | /// Removes one or more protocol interfaces into the boot services environment |
| 146 | // TODO: use callconv(cc) instead once that works | |
| 144 | 147 | uninstallMultipleProtocolInterfaces: *const fn (handle: *Handle, ...) callconv(.C) Status, |
| 145 | 148 | |
| 146 | 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, | |
| 148 | 151 | |
| 149 | 152 | /// 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, | |
| 151 | 154 | |
| 152 | 155 | /// 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, | |
| 154 | 157 | |
| 155 | 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, | |
| 157 | 160 | |
| 158 | 161 | /// Opens a protocol with a structure as the loaded image for a UEFI application |
| 159 | 162 | pub fn openProtocolSt(self: *BootServices, comptime protocol: type, handle: Handle) !*protocol { |
| ... | ... | @@ -191,7 +194,7 @@ pub const BootServices = extern struct { |
| 191 | 194 | pub const tpl_high_level: usize = 31; |
| 192 | 195 | }; |
| 193 | 196 | |
| 194 | pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(.C) void; | |
| 197 | pub const EfiEventNotify = *const fn (event: Event, ctx: *anyopaque) callconv(cc) void; | |
| 195 | 198 | |
| 196 | 199 | pub const TimerDelay = enum(u32) { |
| 197 | 200 | TimerCancel, |
lib/std/os/uefi/tables/runtime_services.zig+15-14| ... | ... | @@ -6,6 +6,7 @@ const Time = uefi.Time; |
| 6 | 6 | const TimeCapabilities = uefi.TimeCapabilities; |
| 7 | 7 | const Status = uefi.Status; |
| 8 | 8 | const MemoryDescriptor = uefi.tables.MemoryDescriptor; |
| 9 | const cc = uefi.cc; | |
| 9 | 10 | |
| 10 | 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 | 20 | hdr: TableHeader, |
| 20 | 21 | |
| 21 | 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, | |
| 23 | 24 | |
| 24 | 25 | /// 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, | |
| 26 | 27 | |
| 27 | 28 | /// 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, | |
| 29 | 30 | |
| 30 | 31 | /// 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, | |
| 32 | 33 | |
| 33 | 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, | |
| 35 | 36 | |
| 36 | 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, | |
| 38 | 39 | |
| 39 | 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, | |
| 41 | 42 | |
| 42 | 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, | |
| 44 | 45 | |
| 45 | 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, | |
| 47 | 48 | |
| 48 | 49 | /// 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, | |
| 50 | 51 | |
| 51 | 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, | |
| 53 | 54 | |
| 54 | 55 | /// Passes capsules to the firmware with both virtual and physical mapping. |
| 55 | 56 | /// Depending on the intended consumption, the firmware may process the capsule immediately. |
| 56 | 57 | /// If the payload should persist across a system reset, the reset value returned from |
| 57 | 58 | /// `queryCapsuleCapabilities` must be passed into resetSystem and will cause the capsule |
| 58 | 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, | |
| 60 | 61 | |
| 61 | 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, | |
| 63 | 64 | |
| 64 | 65 | /// 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, | |
| 66 | 67 | |
| 67 | 68 | pub const signature: u64 = 0x56524553544e5552; |
| 68 | 69 | }; |
src/Sema.zig+39-6| ... | ... | @@ -6628,7 +6628,7 @@ fn checkCallArgumentCount( |
| 6628 | 6628 | const fn_params_len = func_ty_info.param_types.len; |
| 6629 | 6629 | const args_len = total_args - @intFromBool(member_fn); |
| 6630 | 6630 | if (func_ty_info.is_var_args) { |
| 6631 | assert(func_ty_info.cc == .C); | |
| 6631 | assert(callConvSupportsVarArgs(func_ty_info.cc)); | |
| 6632 | 6632 | if (total_args >= fn_params_len) return func_ty; |
| 6633 | 6633 | } else if (fn_params_len == total_args) { |
| 6634 | 6634 | return func_ty; |
| ... | ... | @@ -8917,6 +8917,41 @@ fn handleExternLibName( |
| 8917 | 8917 | return sema.gpa.dupeZ(u8, lib_name); |
| 8918 | 8918 | } |
| 8919 | 8919 | |
| 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. | |
| 8923 | const calling_conventions_supporting_var_args = [_]std.builtin.CallingConvention{ | |
| 8924 | .C, | |
| 8925 | }; | |
| 8926 | fn 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 | } | |
| 8931 | fn 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 | ||
| 8920 | 8955 | const FuncLinkSection = union(enum) { |
| 8921 | 8956 | generic, |
| 8922 | 8957 | default, |
| ... | ... | @@ -8963,9 +8998,7 @@ fn funcCommon( |
| 8963 | 8998 | if (is_generic) { |
| 8964 | 8999 | return sema.fail(block, func_src, "generic function cannot be variadic", .{}); |
| 8965 | 9000 | } |
| 8966 | if (cc.? != .C) { | |
| 8967 | return sema.fail(block, cc_src, "variadic function must have 'C' calling convention", .{}); | |
| 8968 | } | |
| 9001 | try sema.checkCallConvSupportsVarArgs(block, cc_src, cc.?); | |
| 8969 | 9002 | } |
| 8970 | 9003 | |
| 8971 | 9004 | var destroy_fn_on_error = false; |
| ... | ... | @@ -20327,8 +20360,8 @@ fn zirReify( |
| 20327 | 20360 | |
| 20328 | 20361 | const is_var_args = is_var_args_val.toBool(); |
| 20329 | 20362 | const cc = mod.toEnum(std.builtin.CallingConvention, calling_convention_val); |
| 20330 | if (is_var_args and cc != .C) { | |
| 20331 | return sema.fail(block, src, "varargs functions must have C calling convention", .{}); | |
| 20363 | if (is_var_args) { | |
| 20364 | try sema.checkCallConvSupportsVarArgs(block, src, cc); | |
| 20332 | 20365 | } |
| 20333 | 20366 | |
| 20334 | 20367 | const alignment = alignment: { |
test/cases/compile_errors/invalid_variadic_function.zig+8-1| ... | ... | @@ -1,5 +1,6 @@ |
| 1 | 1 | fn foo(...) void {} |
| 2 | 2 | fn bar(a: anytype, ...) callconv(a) void {} |
| 3 | inline fn foo2(...) void {} | |
| 3 | 4 | |
| 4 | 5 | comptime { |
| 5 | 6 | _ = foo; |
| ... | ... | @@ -7,10 +8,16 @@ comptime { |
| 7 | 8 | comptime { |
| 8 | 9 | _ = bar; |
| 9 | 10 | } |
| 11 | comptime { | |
| 12 | _ = foo2; | |
| 13 | } | |
| 10 | 14 | |
| 11 | 15 | // error |
| 12 | 16 | // backend=stage2 |
| 13 | 17 | // target=native |
| 14 | 18 | // |
| 15 | // :1:1: error: variadic function must have 'C' calling convention | |
| 19 | // :1:1: error: variadic function does not support '.Unspecified' calling convention | |
| 20 | // :1:1: note: supported calling conventions: '.C' | |
| 16 | 21 | // :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 | 16 | // backend=stage2 |
| 17 | 17 | // target=native |
| 18 | 18 | // |
| 19 | // :1:13: error: varargs functions must have C calling convention | |
| 19 | // :1:13: error: variadic function does not support '.Unspecified' calling convention | |
| 20 | // :1:13: note: supported calling conventions: '.C' |