Unnamed: 0
int64 0
0
| repo_id
stringlengths 5
186
| file_path
stringlengths 15
223
| content
stringlengths 1
32.8M
⌀ |
---|---|---|---|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi.zig | const std = @import("../std.zig");
/// A protocol is an interface identified by a GUID.
pub const protocols = @import("uefi/protocols.zig");
/// Status codes returned by EFI interfaces
pub const Status = @import("uefi/status.zig").Status;
pub const tables = @import("uefi/tables.zig");
/// The EFI image's handle that is passed to its entry point.
pub var handle: Handle = undefined;
/// A pointer to the EFI System Table that is passed to the EFI image's entry point.
pub var system_table: *tables.SystemTable = undefined;
/// A handle to an event structure.
pub const Event = *opaque {};
/// GUIDs must be align(8)
pub const Guid = extern struct {
time_low: u32,
time_mid: u16,
time_high_and_version: u16,
clock_seq_high_and_reserved: u8,
clock_seq_low: u8,
node: [6]u8,
/// Format GUID into hexadecimal lowercase xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format
pub fn format(
self: @This(),
comptime f: []const u8,
options: std.fmt.FormatOptions,
writer: anytype,
) !void {
_ = options;
if (f.len == 0) {
return std.fmt.format(writer, "{x:0>8}-{x:0>4}-{x:0>4}-{x:0>2}{x:0>2}-{x:0>12}", .{
self.time_low,
self.time_mid,
self.time_high_and_version,
self.clock_seq_high_and_reserved,
self.clock_seq_low,
self.node,
});
} else {
@compileError("Unknown format character: '" ++ f ++ "'");
}
}
pub fn eql(a: std.os.uefi.Guid, b: std.os.uefi.Guid) bool {
return a.time_low == b.time_low and
a.time_mid == b.time_mid and
a.time_high_and_version == b.time_high_and_version and
a.clock_seq_high_and_reserved == b.clock_seq_high_and_reserved and
a.clock_seq_low == b.clock_seq_low and
std.mem.eql(u8, &a.node, &b.node);
}
};
/// An EFI Handle represents a collection of related interfaces.
pub const Handle = *opaque {};
/// This structure represents time information.
pub const Time = extern struct {
/// 1900 - 9999
year: u16,
/// 1 - 12
month: u8,
/// 1 - 31
day: u8,
/// 0 - 23
hour: u8,
/// 0 - 59
minute: u8,
/// 0 - 59
second: u8,
_pad1: u8,
/// 0 - 999999999
nanosecond: u32,
/// The time's offset in minutes from UTC.
/// Allowed values are -1440 to 1440 or unspecified_timezone
timezone: i16,
daylight: packed struct {
_pad1: u6,
/// If true, the time has been adjusted for daylight savings time.
in_daylight: bool,
/// If true, the time is affected by daylight savings time.
adjust_daylight: bool,
},
_pad2: u8,
/// Time is to be interpreted as local time
pub const unspecified_timezone: i16 = 0x7ff;
};
/// Capabilities of the clock device
pub const TimeCapabilities = extern struct {
/// Resolution in Hz
resolution: u32,
/// Accuracy in an error rate of 1e-6 parts per million.
accuracy: u32,
/// If true, a time set operation clears the device's time below the resolution level.
sets_to_zero: bool,
};
/// File Handle as specified in the EFI Shell Spec
pub const FileHandle = *opaque {};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux.zig | //! This file provides the system interface functions for Linux matching those
//! that are provided by libc, whether or not libc is linked. The following
//! abstractions are made:
//! * Work around kernel bugs and limitations. For example, see sendmmsg.
//! * Implement all the syscalls in the same way that libc functions will
//! provide `rename` when only the `renameat` syscall exists.
//! * Does not support POSIX thread cancellation.
const std = @import("../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
const elf = std.elf;
const vdso = @import("linux/vdso.zig");
const dl = @import("../dynamic_library.zig");
const native_arch = builtin.cpu.arch;
const native_endian = native_arch.endian();
const is_mips = native_arch.isMIPS();
const is_ppc = native_arch.isPPC();
const is_ppc64 = native_arch.isPPC64();
const is_sparc = native_arch.isSPARC();
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
test {
if (builtin.os.tag == .linux) {
_ = @import("linux/test.zig");
}
}
const syscall_bits = switch (native_arch) {
.thumb => @import("linux/thumb.zig"),
else => arch_bits,
};
const arch_bits = switch (native_arch) {
.i386 => @import("linux/i386.zig"),
.x86_64 => @import("linux/x86_64.zig"),
.aarch64 => @import("linux/arm64.zig"),
.arm, .thumb => @import("linux/arm-eabi.zig"),
.riscv64 => @import("linux/riscv64.zig"),
.sparcv9 => @import("linux/sparc64.zig"),
.mips, .mipsel => @import("linux/mips.zig"),
.powerpc => @import("linux/powerpc.zig"),
.powerpc64, .powerpc64le => @import("linux/powerpc64.zig"),
else => struct {},
};
pub const syscall0 = syscall_bits.syscall0;
pub const syscall1 = syscall_bits.syscall1;
pub const syscall2 = syscall_bits.syscall2;
pub const syscall3 = syscall_bits.syscall3;
pub const syscall4 = syscall_bits.syscall4;
pub const syscall5 = syscall_bits.syscall5;
pub const syscall6 = syscall_bits.syscall6;
pub const syscall7 = syscall_bits.syscall7;
pub const restore = syscall_bits.restore;
pub const restore_rt = syscall_bits.restore_rt;
pub const socketcall = syscall_bits.socketcall;
pub const syscall_pipe = syscall_bits.syscall_pipe;
pub const syscall_fork = syscall_bits.syscall_fork;
pub const ARCH = arch_bits.ARCH;
pub const Elf_Symndx = arch_bits.Elf_Symndx;
pub const F = arch_bits.F;
pub const Flock = arch_bits.Flock;
pub const HWCAP = arch_bits.HWCAP;
pub const LOCK = arch_bits.LOCK;
pub const MMAP2_UNIT = arch_bits.MMAP2_UNIT;
pub const REG = arch_bits.REG;
pub const SC = arch_bits.SC;
pub const SYS = arch_bits.SYS;
pub const Stat = arch_bits.Stat;
pub const VDSO = arch_bits.VDSO;
pub const blkcnt_t = arch_bits.blkcnt_t;
pub const blksize_t = arch_bits.blksize_t;
pub const clone = arch_bits.clone;
pub const dev_t = arch_bits.dev_t;
pub const ino_t = arch_bits.ino_t;
pub const mcontext_t = arch_bits.mcontext_t;
pub const mode_t = arch_bits.mode_t;
pub const msghdr = arch_bits.msghdr;
pub const msghdr_const = arch_bits.msghdr_const;
pub const nlink_t = arch_bits.nlink_t;
pub const off_t = arch_bits.off_t;
pub const time_t = arch_bits.time_t;
pub const timeval = arch_bits.timeval;
pub const timezone = arch_bits.timezone;
pub const ucontext_t = arch_bits.ucontext_t;
pub const user_desc = arch_bits.user_desc;
pub const tls = @import("linux/tls.zig");
pub const pie = @import("linux/start_pie.zig");
pub const BPF = @import("linux/bpf.zig");
pub const IOCTL = @import("linux/ioctl.zig");
pub const MAP = struct {
pub usingnamespace arch_bits.MAP;
/// Share changes
pub const SHARED = 0x01;
/// Changes are private
pub const PRIVATE = 0x02;
/// share + validate extension flags
pub const SHARED_VALIDATE = 0x03;
/// Mask for type of mapping
pub const TYPE = 0x0f;
/// Interpret addr exactly
pub const FIXED = 0x10;
/// don't use a file
pub const ANONYMOUS = if (is_mips) 0x800 else 0x20;
// MAP_ 0x0100 - 0x4000 flags are per architecture
/// populate (prefault) pagetables
pub const POPULATE = if (is_mips) 0x10000 else 0x8000;
/// do not block on IO
pub const NONBLOCK = if (is_mips) 0x20000 else 0x10000;
/// give out an address that is best suited for process/thread stacks
pub const STACK = if (is_mips) 0x40000 else 0x20000;
/// create a huge page mapping
pub const HUGETLB = if (is_mips) 0x80000 else 0x40000;
/// perform synchronous page faults for the mapping
pub const SYNC = 0x80000;
/// MAP_FIXED which doesn't unmap underlying mapping
pub const FIXED_NOREPLACE = 0x100000;
/// For anonymous mmap, memory could be uninitialized
pub const UNINITIALIZED = 0x4000000;
};
pub const O = struct {
pub usingnamespace arch_bits.O;
pub const RDONLY = 0o0;
pub const WRONLY = 0o1;
pub const RDWR = 0o2;
};
pub usingnamespace @import("linux/io_uring.zig");
/// Set by startup code, used by `getauxval`.
pub var elf_aux_maybe: ?[*]std.elf.Auxv = null;
/// See `std.elf` for the constants.
pub fn getauxval(index: usize) usize {
const auxv = elf_aux_maybe orelse return 0;
var i: usize = 0;
while (auxv[i].a_type != std.elf.AT_NULL) : (i += 1) {
if (auxv[i].a_type == index)
return auxv[i].a_un.a_val;
}
return 0;
}
// Some architectures (and some syscalls) require 64bit parameters to be passed
// in a even-aligned register pair.
const require_aligned_register_pair =
builtin.cpu.arch.isPPC() or
builtin.cpu.arch.isMIPS() or
builtin.cpu.arch.isARM() or
builtin.cpu.arch.isThumb();
// Split a 64bit value into a {LSB,MSB} pair.
// The LE/BE variants specify the endianness to assume.
fn splitValueLE64(val: i64) [2]u32 {
const u = @as(u64, @bitCast(val));
return [2]u32{
@as(u32, @truncate(u)),
@as(u32, @truncate(u >> 32)),
};
}
fn splitValueBE64(val: i64) [2]u32 {
const u = @as(u64, @bitCast(val));
return [2]u32{
@as(u32, @truncate(u >> 32)),
@as(u32, @truncate(u)),
};
}
fn splitValue64(val: i64) [2]u32 {
const u = @as(u64, @bitCast(val));
switch (native_endian) {
.Little => return [2]u32{
@as(u32, @truncate(u)),
@as(u32, @truncate(u >> 32)),
},
.Big => return [2]u32{
@as(u32, @truncate(u >> 32)),
@as(u32, @truncate(u)),
},
}
}
/// Get the errno from a syscall return value, or 0 for no error.
pub fn getErrno(r: usize) E {
const signed_r = @as(isize, @bitCast(r));
const int = if (signed_r > -4096 and signed_r < 0) -signed_r else 0;
return @as(E, @enumFromInt(int));
}
pub fn dup(old: i32) usize {
return syscall1(.dup, @as(usize, @bitCast(@as(isize, old))));
}
pub fn dup2(old: i32, new: i32) usize {
if (@hasField(SYS, "dup2")) {
return syscall2(.dup2, @as(usize, @bitCast(@as(isize, old))), @as(usize, @bitCast(@as(isize, new))));
} else {
if (old == new) {
if (std.debug.runtime_safety) {
const rc = syscall2(.fcntl, @as(usize, @bitCast(@as(isize, old))), F.GETFD);
if (@as(isize, @bitCast(rc)) < 0) return rc;
}
return @as(usize, @intCast(old));
} else {
return syscall3(.dup3, @as(usize, @bitCast(@as(isize, old))), @as(usize, @bitCast(@as(isize, new))), 0);
}
}
}
pub fn dup3(old: i32, new: i32, flags: u32) usize {
return syscall3(.dup3, @as(usize, @bitCast(@as(isize, old))), @as(usize, @bitCast(@as(isize, new))), flags);
}
pub fn chdir(path: [*:0]const u8) usize {
return syscall1(.chdir, @intFromPtr(path));
}
pub fn fchdir(fd: fd_t) usize {
return syscall1(.fchdir, @as(usize, @bitCast(@as(isize, fd))));
}
pub fn chroot(path: [*:0]const u8) usize {
return syscall1(.chroot, @intFromPtr(path));
}
pub fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) usize {
return syscall3(.execve, @intFromPtr(path), @intFromPtr(argv), @intFromPtr(envp));
}
pub fn fork() usize {
if (comptime native_arch.isSPARC()) {
return syscall_fork();
} else if (@hasField(SYS, "fork")) {
return syscall0(.fork);
} else {
return syscall2(.clone, SIG.CHLD, 0);
}
}
/// This must be inline, and inline call the syscall function, because if the
/// child does a return it will clobber the parent's stack.
/// It is advised to avoid this function and use clone instead, because
/// the compiler is not aware of how vfork affects control flow and you may
/// see different results in optimized builds.
pub inline fn vfork() usize {
return @call(.{ .modifier = .always_inline }, syscall0, .{.vfork});
}
pub fn futimens(fd: i32, times: *const [2]timespec) usize {
return utimensat(fd, null, times, 0);
}
pub fn utimensat(dirfd: i32, path: ?[*:0]const u8, times: *const [2]timespec, flags: u32) usize {
return syscall4(.utimensat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), @intFromPtr(times), flags);
}
pub fn fallocate(fd: i32, mode: i32, offset: i64, length: i64) usize {
if (usize_bits < 64) {
const offset_halves = splitValue64(offset);
const length_halves = splitValue64(length);
return syscall6(
.fallocate,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @bitCast(@as(isize, mode))),
offset_halves[0],
offset_halves[1],
length_halves[0],
length_halves[1],
);
} else {
return syscall4(
.fallocate,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @bitCast(@as(isize, mode))),
@as(u64, @bitCast(offset)),
@as(u64, @bitCast(length)),
);
}
}
pub fn futex_wait(uaddr: *const i32, futex_op: u32, val: i32, timeout: ?*const timespec) usize {
return syscall4(.futex, @intFromPtr(uaddr), futex_op, @as(u32, @bitCast(val)), @intFromPtr(timeout));
}
pub fn futex_wake(uaddr: *const i32, futex_op: u32, val: i32) usize {
return syscall3(.futex, @intFromPtr(uaddr), futex_op, @as(u32, @bitCast(val)));
}
pub fn getcwd(buf: [*]u8, size: usize) usize {
return syscall2(.getcwd, @intFromPtr(buf), size);
}
pub fn getdents(fd: i32, dirp: [*]u8, len: usize) usize {
return syscall3(
.getdents,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(dirp),
std.math.min(len, maxInt(c_int)),
);
}
pub fn getdents64(fd: i32, dirp: [*]u8, len: usize) usize {
return syscall3(
.getdents64,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(dirp),
std.math.min(len, maxInt(c_int)),
);
}
pub fn inotify_init1(flags: u32) usize {
return syscall1(.inotify_init1, flags);
}
pub fn inotify_add_watch(fd: i32, pathname: [*:0]const u8, mask: u32) usize {
return syscall3(.inotify_add_watch, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(pathname), mask);
}
pub fn inotify_rm_watch(fd: i32, wd: i32) usize {
return syscall2(.inotify_rm_watch, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, wd))));
}
pub fn readlink(noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize {
if (@hasField(SYS, "readlink")) {
return syscall3(.readlink, @intFromPtr(path), @intFromPtr(buf_ptr), buf_len);
} else {
return syscall4(.readlinkat, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(path), @intFromPtr(buf_ptr), buf_len);
}
}
pub fn readlinkat(dirfd: i32, noalias path: [*:0]const u8, noalias buf_ptr: [*]u8, buf_len: usize) usize {
return syscall4(.readlinkat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), @intFromPtr(buf_ptr), buf_len);
}
pub fn mkdir(path: [*:0]const u8, mode: u32) usize {
if (@hasField(SYS, "mkdir")) {
return syscall2(.mkdir, @intFromPtr(path), mode);
} else {
return syscall3(.mkdirat, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(path), mode);
}
}
pub fn mkdirat(dirfd: i32, path: [*:0]const u8, mode: u32) usize {
return syscall3(.mkdirat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), mode);
}
pub fn mknod(path: [*:0]const u8, mode: u32, dev: u32) usize {
if (@hasField(SYS, "mknod")) {
return syscall3(.mknod, @intFromPtr(path), mode, dev);
} else {
return mknodat(AT.FDCWD, path, mode, dev);
}
}
pub fn mknodat(dirfd: i32, path: [*:0]const u8, mode: u32, dev: u32) usize {
return syscall4(.mknodat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), mode, dev);
}
pub fn mount(special: [*:0]const u8, dir: [*:0]const u8, fstype: [*:0]const u8, flags: u32, data: usize) usize {
return syscall5(.mount, @intFromPtr(special), @intFromPtr(dir), @intFromPtr(fstype), flags, data);
}
pub fn umount(special: [*:0]const u8) usize {
return syscall2(.umount2, @intFromPtr(special), 0);
}
pub fn umount2(special: [*:0]const u8, flags: u32) usize {
return syscall2(.umount2, @intFromPtr(special), flags);
}
pub fn mmap(address: ?[*]u8, length: usize, prot: usize, flags: u32, fd: i32, offset: i64) usize {
if (@hasField(SYS, "mmap2")) {
// Make sure the offset is also specified in multiples of page size
if ((offset & (MMAP2_UNIT - 1)) != 0)
return @as(usize, @bitCast(-@as(isize, @intFromEnum(E.INVAL))));
return syscall6(
.mmap2,
@intFromPtr(address),
length,
prot,
flags,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @truncate(@as(u64, @bitCast(offset)) / MMAP2_UNIT)),
);
} else {
return syscall6(
.mmap,
@intFromPtr(address),
length,
prot,
flags,
@as(usize, @bitCast(@as(isize, fd))),
@as(u64, @bitCast(offset)),
);
}
}
pub fn mprotect(address: [*]const u8, length: usize, protection: usize) usize {
return syscall3(.mprotect, @intFromPtr(address), length, protection);
}
pub fn munmap(address: [*]const u8, length: usize) usize {
return syscall2(.munmap, @intFromPtr(address), length);
}
pub fn poll(fds: [*]pollfd, n: nfds_t, timeout: i32) usize {
if (@hasField(SYS, "poll")) {
return syscall3(.poll, @intFromPtr(fds), n, @as(u32, @bitCast(timeout)));
} else {
return syscall5(
.ppoll,
@intFromPtr(fds),
n,
@intFromPtr(if (timeout >= 0)
×pec{
.tv_sec = @divTrunc(timeout, 1000),
.tv_nsec = @rem(timeout, 1000) * 1000000,
}
else
null),
0,
NSIG / 8,
);
}
}
pub fn ppoll(fds: [*]pollfd, n: nfds_t, timeout: ?*timespec, sigmask: ?*const sigset_t) usize {
return syscall5(.ppoll, @intFromPtr(fds), n, @intFromPtr(timeout), @intFromPtr(sigmask), NSIG / 8);
}
pub fn read(fd: i32, buf: [*]u8, count: usize) usize {
return syscall3(.read, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), count);
}
pub fn preadv(fd: i32, iov: [*]const iovec, count: usize, offset: i64) usize {
const offset_halves = splitValueLE64(offset);
return syscall5(
.preadv,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(iov),
count,
offset_halves[0],
offset_halves[1],
);
}
pub fn preadv2(fd: i32, iov: [*]const iovec, count: usize, offset: i64, flags: kernel_rwf) usize {
const offset_halves = splitValue64(offset);
return syscall6(
.preadv2,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(iov),
count,
offset_halves[0],
offset_halves[1],
flags,
);
}
pub fn readv(fd: i32, iov: [*]const iovec, count: usize) usize {
return syscall3(.readv, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(iov), count);
}
pub fn writev(fd: i32, iov: [*]const iovec_const, count: usize) usize {
return syscall3(.writev, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(iov), count);
}
pub fn pwritev(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64) usize {
const offset_halves = splitValueLE64(offset);
return syscall5(
.pwritev,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(iov),
count,
offset_halves[0],
offset_halves[1],
);
}
pub fn pwritev2(fd: i32, iov: [*]const iovec_const, count: usize, offset: i64, flags: kernel_rwf) usize {
const offset_halves = splitValue64(offset);
return syscall6(
.pwritev2,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(iov),
count,
offset_halves[0],
offset_halves[1],
flags,
);
}
pub fn rmdir(path: [*:0]const u8) usize {
if (@hasField(SYS, "rmdir")) {
return syscall1(.rmdir, @intFromPtr(path));
} else {
return syscall3(.unlinkat, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(path), AT.REMOVEDIR);
}
}
pub fn symlink(existing: [*:0]const u8, new: [*:0]const u8) usize {
if (@hasField(SYS, "symlink")) {
return syscall2(.symlink, @intFromPtr(existing), @intFromPtr(new));
} else {
return syscall3(.symlinkat, @intFromPtr(existing), @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(new));
}
}
pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) usize {
return syscall3(.symlinkat, @intFromPtr(existing), @as(usize, @bitCast(@as(isize, newfd))), @intFromPtr(newpath));
}
pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: i64) usize {
if (@hasField(SYS, "pread64") and usize_bits < 64) {
const offset_halves = splitValue64(offset);
if (require_aligned_register_pair) {
return syscall6(
.pread64,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(buf),
count,
0,
offset_halves[0],
offset_halves[1],
);
} else {
return syscall5(
.pread64,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(buf),
count,
offset_halves[0],
offset_halves[1],
);
}
} else {
// Some architectures (eg. 64bit SPARC) pread is called pread64.
const syscall_number = if (!@hasField(SYS, "pread") and @hasField(SYS, "pread64"))
.pread64
else
.pread;
return syscall4(
syscall_number,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(buf),
count,
@as(u64, @bitCast(offset)),
);
}
}
pub fn access(path: [*:0]const u8, mode: u32) usize {
if (@hasField(SYS, "access")) {
return syscall2(.access, @intFromPtr(path), mode);
} else {
return syscall4(.faccessat, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(path), mode, 0);
}
}
pub fn faccessat(dirfd: i32, path: [*:0]const u8, mode: u32, flags: u32) usize {
return syscall4(.faccessat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), mode, flags);
}
pub fn pipe(fd: *[2]i32) usize {
if (comptime (native_arch.isMIPS() or native_arch.isSPARC())) {
return syscall_pipe(fd);
} else if (@hasField(SYS, "pipe")) {
return syscall1(.pipe, @intFromPtr(fd));
} else {
return syscall2(.pipe2, @intFromPtr(fd), 0);
}
}
pub fn pipe2(fd: *[2]i32, flags: u32) usize {
return syscall2(.pipe2, @intFromPtr(fd), flags);
}
pub fn write(fd: i32, buf: [*]const u8, count: usize) usize {
return syscall3(.write, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), count);
}
pub fn ftruncate(fd: i32, length: i64) usize {
if (@hasField(SYS, "ftruncate64") and usize_bits < 64) {
const length_halves = splitValue64(length);
if (require_aligned_register_pair) {
return syscall4(
.ftruncate64,
@as(usize, @bitCast(@as(isize, fd))),
0,
length_halves[0],
length_halves[1],
);
} else {
return syscall3(
.ftruncate64,
@as(usize, @bitCast(@as(isize, fd))),
length_halves[0],
length_halves[1],
);
}
} else {
return syscall2(
.ftruncate,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @bitCast(length)),
);
}
}
pub fn pwrite(fd: i32, buf: [*]const u8, count: usize, offset: i64) usize {
if (@hasField(SYS, "pwrite64") and usize_bits < 64) {
const offset_halves = splitValue64(offset);
if (require_aligned_register_pair) {
return syscall6(
.pwrite64,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(buf),
count,
0,
offset_halves[0],
offset_halves[1],
);
} else {
return syscall5(
.pwrite64,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(buf),
count,
offset_halves[0],
offset_halves[1],
);
}
} else {
// Some architectures (eg. 64bit SPARC) pwrite is called pwrite64.
const syscall_number = if (!@hasField(SYS, "pwrite") and @hasField(SYS, "pwrite64"))
.pwrite64
else
.pwrite;
return syscall4(
syscall_number,
@as(usize, @bitCast(@as(isize, fd))),
@intFromPtr(buf),
count,
@as(u64, @bitCast(offset)),
);
}
}
pub fn rename(old: [*:0]const u8, new: [*:0]const u8) usize {
if (@hasField(SYS, "rename")) {
return syscall2(.rename, @intFromPtr(old), @intFromPtr(new));
} else if (@hasField(SYS, "renameat")) {
return syscall4(.renameat, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(old), @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(new));
} else {
return syscall5(.renameat2, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(old), @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(new), 0);
}
}
pub fn renameat(oldfd: i32, oldpath: [*]const u8, newfd: i32, newpath: [*]const u8) usize {
if (@hasField(SYS, "renameat")) {
return syscall4(
.renameat,
@as(usize, @bitCast(@as(isize, oldfd))),
@intFromPtr(oldpath),
@as(usize, @bitCast(@as(isize, newfd))),
@intFromPtr(newpath),
);
} else {
return syscall5(
.renameat2,
@as(usize, @bitCast(@as(isize, oldfd))),
@intFromPtr(oldpath),
@as(usize, @bitCast(@as(isize, newfd))),
@intFromPtr(newpath),
0,
);
}
}
pub fn renameat2(oldfd: i32, oldpath: [*:0]const u8, newfd: i32, newpath: [*:0]const u8, flags: u32) usize {
return syscall5(
.renameat2,
@as(usize, @bitCast(@as(isize, oldfd))),
@intFromPtr(oldpath),
@as(usize, @bitCast(@as(isize, newfd))),
@intFromPtr(newpath),
flags,
);
}
pub fn open(path: [*:0]const u8, flags: u32, perm: mode_t) usize {
if (@hasField(SYS, "open")) {
return syscall3(.open, @intFromPtr(path), flags, perm);
} else {
return syscall4(
.openat,
@as(usize, @bitCast(@as(isize, AT.FDCWD))),
@intFromPtr(path),
flags,
perm,
);
}
}
pub fn create(path: [*:0]const u8, perm: mode_t) usize {
return syscall2(.creat, @intFromPtr(path), perm);
}
pub fn openat(dirfd: i32, path: [*:0]const u8, flags: u32, mode: mode_t) usize {
// dirfd could be negative, for example AT.FDCWD is -100
return syscall4(.openat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), flags, mode);
}
/// See also `clone` (from the arch-specific include)
pub fn clone5(flags: usize, child_stack_ptr: usize, parent_tid: *i32, child_tid: *i32, newtls: usize) usize {
return syscall5(.clone, flags, child_stack_ptr, @intFromPtr(parent_tid), @intFromPtr(child_tid), newtls);
}
/// See also `clone` (from the arch-specific include)
pub fn clone2(flags: u32, child_stack_ptr: usize) usize {
return syscall2(.clone, flags, child_stack_ptr);
}
pub fn close(fd: i32) usize {
return syscall1(.close, @as(usize, @bitCast(@as(isize, fd))));
}
/// Can only be called on 32 bit systems. For 64 bit see `lseek`.
pub fn llseek(fd: i32, offset: u64, result: ?*u64, whence: usize) usize {
// NOTE: The offset parameter splitting is independent from the target
// endianness.
return syscall5(
._llseek,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @truncate(offset >> 32)),
@as(usize, @truncate(offset)),
@intFromPtr(result),
whence,
);
}
/// Can only be called on 64 bit systems. For 32 bit see `llseek`.
pub fn lseek(fd: i32, offset: i64, whence: usize) usize {
return syscall3(.lseek, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(offset)), whence);
}
pub fn exit(status: i32) noreturn {
_ = syscall1(.exit, @as(usize, @bitCast(@as(isize, status))));
unreachable;
}
pub fn exit_group(status: i32) noreturn {
_ = syscall1(.exit_group, @as(usize, @bitCast(@as(isize, status))));
unreachable;
}
pub fn getrandom(buf: [*]u8, count: usize, flags: u32) usize {
return syscall3(.getrandom, @intFromPtr(buf), count, flags);
}
pub fn kill(pid: pid_t, sig: i32) usize {
return syscall2(.kill, @as(usize, @bitCast(@as(isize, pid))), @as(usize, @bitCast(@as(isize, sig))));
}
pub fn tkill(tid: pid_t, sig: i32) usize {
return syscall2(.tkill, @as(usize, @bitCast(@as(isize, tid))), @as(usize, @bitCast(@as(isize, sig))));
}
pub fn tgkill(tgid: pid_t, tid: pid_t, sig: i32) usize {
return syscall3(.tgkill, @as(usize, @bitCast(@as(isize, tgid))), @as(usize, @bitCast(@as(isize, tid))), @as(usize, @bitCast(@as(isize, sig))));
}
pub fn link(oldpath: [*:0]const u8, newpath: [*:0]const u8, flags: i32) usize {
if (@hasField(SYS, "link")) {
return syscall3(
.link,
@intFromPtr(oldpath),
@intFromPtr(newpath),
@as(usize, @bitCast(@as(isize, flags))),
);
} else {
return syscall5(
.linkat,
@as(usize, @bitCast(@as(isize, AT.FDCWD))),
@intFromPtr(oldpath),
@as(usize, @bitCast(@as(isize, AT.FDCWD))),
@intFromPtr(newpath),
@as(usize, @bitCast(@as(isize, flags))),
);
}
}
pub fn linkat(oldfd: fd_t, oldpath: [*:0]const u8, newfd: fd_t, newpath: [*:0]const u8, flags: i32) usize {
return syscall5(
.linkat,
@as(usize, @bitCast(@as(isize, oldfd))),
@intFromPtr(oldpath),
@as(usize, @bitCast(@as(isize, newfd))),
@intFromPtr(newpath),
@as(usize, @bitCast(@as(isize, flags))),
);
}
pub fn unlink(path: [*:0]const u8) usize {
if (@hasField(SYS, "unlink")) {
return syscall1(.unlink, @intFromPtr(path));
} else {
return syscall3(.unlinkat, @as(usize, @bitCast(@as(isize, AT.FDCWD))), @intFromPtr(path), 0);
}
}
pub fn unlinkat(dirfd: i32, path: [*:0]const u8, flags: u32) usize {
return syscall3(.unlinkat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), flags);
}
pub fn waitpid(pid: pid_t, status: *u32, flags: u32) usize {
return syscall4(.wait4, @as(usize, @bitCast(@as(isize, pid))), @intFromPtr(status), flags, 0);
}
pub fn waitid(id_type: P, id: i32, infop: *siginfo_t, flags: u32) usize {
return syscall5(.waitid, @intFromEnum(id_type), @as(usize, @bitCast(@as(isize, id))), @intFromPtr(infop), flags, 0);
}
pub fn fcntl(fd: fd_t, cmd: i32, arg: usize) usize {
return syscall3(.fcntl, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, cmd))), arg);
}
pub fn flock(fd: fd_t, operation: i32) usize {
return syscall2(.flock, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, operation))));
}
var vdso_clock_gettime = @as(?*const anyopaque, @ptrCast(init_vdso_clock_gettime));
// We must follow the C calling convention when we call into the VDSO
const vdso_clock_gettime_ty = fn (i32, *timespec) callconv(.C) usize;
pub fn clock_gettime(clk_id: i32, tp: *timespec) usize {
if (@hasDecl(VDSO, "CGT_SYM")) {
const ptr = @atomicLoad(?*const anyopaque, &vdso_clock_gettime, .Unordered);
if (ptr) |fn_ptr| {
const f = @as(vdso_clock_gettime_ty, @ptrCast(fn_ptr));
const rc = f(clk_id, tp);
switch (rc) {
0, @as(usize, @bitCast(-@as(isize, @intFromEnum(E.INVAL)))) => return rc,
else => {},
}
}
}
return syscall2(.clock_gettime, @as(usize, @bitCast(@as(isize, clk_id))), @intFromPtr(tp));
}
fn init_vdso_clock_gettime(clk: i32, ts: *timespec) callconv(.C) usize {
const ptr = @as(?*const anyopaque, @ptrFromInt(vdso.lookup(VDSO.CGT_VER, VDSO.CGT_SYM)));
// Note that we may not have a VDSO at all, update the stub address anyway
// so that clock_gettime will fall back on the good old (and slow) syscall
@atomicStore(?*const anyopaque, &vdso_clock_gettime, ptr, .Monotonic);
// Call into the VDSO if available
if (ptr) |fn_ptr| {
const f = @as(vdso_clock_gettime_ty, @ptrCast(fn_ptr));
return f(clk, ts);
}
return @as(usize, @bitCast(-@as(isize, @intFromEnum(E.NOSYS))));
}
pub fn clock_getres(clk_id: i32, tp: *timespec) usize {
return syscall2(.clock_getres, @as(usize, @bitCast(@as(isize, clk_id))), @intFromPtr(tp));
}
pub fn clock_settime(clk_id: i32, tp: *const timespec) usize {
return syscall2(.clock_settime, @as(usize, @bitCast(@as(isize, clk_id))), @intFromPtr(tp));
}
pub fn gettimeofday(tv: *timeval, tz: *timezone) usize {
return syscall2(.gettimeofday, @intFromPtr(tv), @intFromPtr(tz));
}
pub fn settimeofday(tv: *const timeval, tz: *const timezone) usize {
return syscall2(.settimeofday, @intFromPtr(tv), @intFromPtr(tz));
}
pub fn nanosleep(req: *const timespec, rem: ?*timespec) usize {
return syscall2(.nanosleep, @intFromPtr(req), @intFromPtr(rem));
}
pub fn setuid(uid: uid_t) usize {
if (@hasField(SYS, "setuid32")) {
return syscall1(.setuid32, uid);
} else {
return syscall1(.setuid, uid);
}
}
pub fn setgid(gid: gid_t) usize {
if (@hasField(SYS, "setgid32")) {
return syscall1(.setgid32, gid);
} else {
return syscall1(.setgid, gid);
}
}
pub fn setreuid(ruid: uid_t, euid: uid_t) usize {
if (@hasField(SYS, "setreuid32")) {
return syscall2(.setreuid32, ruid, euid);
} else {
return syscall2(.setreuid, ruid, euid);
}
}
pub fn setregid(rgid: gid_t, egid: gid_t) usize {
if (@hasField(SYS, "setregid32")) {
return syscall2(.setregid32, rgid, egid);
} else {
return syscall2(.setregid, rgid, egid);
}
}
pub fn getuid() uid_t {
if (@hasField(SYS, "getuid32")) {
return @as(uid_t, @intCast(syscall0(.getuid32)));
} else {
return @as(uid_t, @intCast(syscall0(.getuid)));
}
}
pub fn getgid() gid_t {
if (@hasField(SYS, "getgid32")) {
return @as(gid_t, @intCast(syscall0(.getgid32)));
} else {
return @as(gid_t, @intCast(syscall0(.getgid)));
}
}
pub fn geteuid() uid_t {
if (@hasField(SYS, "geteuid32")) {
return @as(uid_t, @intCast(syscall0(.geteuid32)));
} else {
return @as(uid_t, @intCast(syscall0(.geteuid)));
}
}
pub fn getegid() gid_t {
if (@hasField(SYS, "getegid32")) {
return @as(gid_t, @intCast(syscall0(.getegid32)));
} else {
return @as(gid_t, @intCast(syscall0(.getegid)));
}
}
pub fn seteuid(euid: uid_t) usize {
// We use setresuid here instead of setreuid to ensure that the saved uid
// is not changed. This is what musl and recent glibc versions do as well.
//
// The setresuid(2) man page says that if -1 is passed the corresponding
// id will not be changed. Since uid_t is unsigned, this wraps around to the
// max value in C.
comptime assert(@typeInfo(uid_t) == .Int and @typeInfo(uid_t).Int.signedness == .unsigned);
return setresuid(std.math.maxInt(uid_t), euid, std.math.maxInt(uid_t));
}
pub fn setegid(egid: gid_t) usize {
// We use setresgid here instead of setregid to ensure that the saved uid
// is not changed. This is what musl and recent glibc versions do as well.
//
// The setresgid(2) man page says that if -1 is passed the corresponding
// id will not be changed. Since gid_t is unsigned, this wraps around to the
// max value in C.
comptime assert(@typeInfo(uid_t) == .Int and @typeInfo(uid_t).Int.signedness == .unsigned);
return setresgid(std.math.maxInt(gid_t), egid, std.math.maxInt(gid_t));
}
pub fn getresuid(ruid: *uid_t, euid: *uid_t, suid: *uid_t) usize {
if (@hasField(SYS, "getresuid32")) {
return syscall3(.getresuid32, @intFromPtr(ruid), @intFromPtr(euid), @intFromPtr(suid));
} else {
return syscall3(.getresuid, @intFromPtr(ruid), @intFromPtr(euid), @intFromPtr(suid));
}
}
pub fn getresgid(rgid: *gid_t, egid: *gid_t, sgid: *gid_t) usize {
if (@hasField(SYS, "getresgid32")) {
return syscall3(.getresgid32, @intFromPtr(rgid), @intFromPtr(egid), @intFromPtr(sgid));
} else {
return syscall3(.getresgid, @intFromPtr(rgid), @intFromPtr(egid), @intFromPtr(sgid));
}
}
pub fn setresuid(ruid: uid_t, euid: uid_t, suid: uid_t) usize {
if (@hasField(SYS, "setresuid32")) {
return syscall3(.setresuid32, ruid, euid, suid);
} else {
return syscall3(.setresuid, ruid, euid, suid);
}
}
pub fn setresgid(rgid: gid_t, egid: gid_t, sgid: gid_t) usize {
if (@hasField(SYS, "setresgid32")) {
return syscall3(.setresgid32, rgid, egid, sgid);
} else {
return syscall3(.setresgid, rgid, egid, sgid);
}
}
pub fn getgroups(size: usize, list: *gid_t) usize {
if (@hasField(SYS, "getgroups32")) {
return syscall2(.getgroups32, size, @intFromPtr(list));
} else {
return syscall2(.getgroups, size, @intFromPtr(list));
}
}
pub fn setgroups(size: usize, list: *const gid_t) usize {
if (@hasField(SYS, "setgroups32")) {
return syscall2(.setgroups32, size, @intFromPtr(list));
} else {
return syscall2(.setgroups, size, @intFromPtr(list));
}
}
pub fn getpid() pid_t {
return @as(pid_t, @bitCast(@as(u32, @truncate(syscall0(.getpid)))));
}
pub fn gettid() pid_t {
return @as(pid_t, @bitCast(@as(u32, @truncate(syscall0(.gettid)))));
}
pub fn sigprocmask(flags: u32, noalias set: ?*const sigset_t, noalias oldset: ?*sigset_t) usize {
return syscall4(.rt_sigprocmask, flags, @intFromPtr(set), @intFromPtr(oldset), NSIG / 8);
}
pub fn sigaction(sig: u6, noalias act: ?*const Sigaction, noalias oact: ?*Sigaction) usize {
assert(sig >= 1);
assert(sig != SIG.KILL);
assert(sig != SIG.STOP);
var ksa: k_sigaction = undefined;
var oldksa: k_sigaction = undefined;
const mask_size = @sizeOf(@TypeOf(ksa.mask));
if (act) |new| {
const restorer_fn = if ((new.flags & SA.SIGINFO) != 0) restore_rt else restore;
ksa = k_sigaction{
.handler = new.handler.handler,
.flags = new.flags | SA.RESTORER,
.mask = undefined,
.restorer = @as(fn () callconv(.C) void, @ptrCast(restorer_fn)),
};
@memcpy(@as([*]u8, @ptrCast(&ksa.mask))[0..mask_size], @as([*]const u8, @ptrCast(&new.mask)));
}
const ksa_arg = if (act != null) @intFromPtr(&ksa) else 0;
const oldksa_arg = if (oact != null) @intFromPtr(&oldksa) else 0;
const result = switch (native_arch) {
// The sparc version of rt_sigaction needs the restorer function to be passed as an argument too.
.sparc, .sparcv9 => syscall5(.rt_sigaction, sig, ksa_arg, oldksa_arg, @intFromPtr(ksa.restorer), mask_size),
else => syscall4(.rt_sigaction, sig, ksa_arg, oldksa_arg, mask_size),
};
if (getErrno(result) != .SUCCESS) return result;
if (oact) |old| {
old.handler.handler = oldksa.handler;
old.flags = @as(c_uint, @truncate(oldksa.flags));
@memcpy(@as([*]u8, @ptrCast(&old.mask))[0..mask_size], @as([*]const u8, @ptrCast(&oldksa.mask)));
}
return 0;
}
const usize_bits = @typeInfo(usize).Int.bits;
pub fn sigaddset(set: *sigset_t, sig: u6) void {
const s = sig - 1;
// shift in musl: s&8*sizeof *set->__bits-1
const shift = @as(u5, @intCast(s & (usize_bits - 1)));
const val = @as(u32, @intCast(1)) << shift;
(set.*)[@as(usize, @intCast(s)) / usize_bits] |= val;
}
pub fn sigismember(set: *const sigset_t, sig: u6) bool {
const s = sig - 1;
return ((set.*)[@as(usize, @intCast(s)) / usize_bits] & (@as(usize, @intCast(1)) << (s & (usize_bits - 1)))) != 0;
}
pub fn getsockname(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.getsockname, &[3]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len) });
}
return syscall3(.getsockname, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len));
}
pub fn getpeername(fd: i32, noalias addr: *sockaddr, noalias len: *socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.getpeername, &[3]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len) });
}
return syscall3(.getpeername, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len));
}
pub fn socket(domain: u32, socket_type: u32, protocol: u32) usize {
if (native_arch == .i386) {
return socketcall(SC.socket, &[3]usize{ domain, socket_type, protocol });
}
return syscall3(.socket, domain, socket_type, protocol);
}
pub fn setsockopt(fd: i32, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.setsockopt, &[5]usize{ @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @as(usize, @intCast(optlen)) });
}
return syscall5(.setsockopt, @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @as(usize, @intCast(optlen)));
}
pub fn getsockopt(fd: i32, level: u32, optname: u32, noalias optval: [*]u8, noalias optlen: *socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.getsockopt, &[5]usize{ @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @intFromPtr(optlen) });
}
return syscall5(.getsockopt, @as(usize, @bitCast(@as(isize, fd))), level, optname, @intFromPtr(optval), @intFromPtr(optlen));
}
pub fn sendmsg(fd: i32, msg: *const std.x.os.Socket.Message, flags: c_int) usize {
if (native_arch == .i386) {
return socketcall(SC.sendmsg, &[3]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(msg), @as(usize, @bitCast(@as(isize, flags))) });
}
return syscall3(.sendmsg, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(msg), @as(usize, @bitCast(@as(isize, flags))));
}
pub fn sendmmsg(fd: i32, msgvec: [*]mmsghdr_const, vlen: u32, flags: u32) usize {
if (@typeInfo(usize).Int.bits > @typeInfo(@TypeOf(mmsghdr(undefined).msg_len)).Int.bits) {
// workaround kernel brokenness:
// if adding up all iov_len overflows a i32 then split into multiple calls
// see https://www.openwall.com/lists/musl/2014/06/07/5
const kvlen = if (vlen > IOV_MAX) IOV_MAX else vlen; // matches kernel
var next_unsent: usize = 0;
for (msgvec[0..kvlen], 0..) |*msg, i| {
var size: i32 = 0;
const msg_iovlen = @as(usize, @intCast(msg.msg_hdr.msg_iovlen)); // kernel side this is treated as unsigned
for (msg.msg_hdr.msg_iov[0..msg_iovlen]) |iov| {
if (iov.iov_len > std.math.maxInt(i32) or @addWithOverflow(size, @as(i32, @intCast(iov.iov_len)))[1] != 0) {
// batch-send all messages up to the current message
if (next_unsent < i) {
const batch_size = i - next_unsent;
const r = syscall4(.sendmmsg, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(&msgvec[next_unsent]), batch_size, flags);
if (getErrno(r) != 0) return next_unsent;
if (r < batch_size) return next_unsent + r;
}
// send current message as own packet
const r = sendmsg(fd, &msg.msg_hdr, flags);
if (getErrno(r) != 0) return r;
// Linux limits the total bytes sent by sendmsg to INT_MAX, so this cast is safe.
msg.msg_len = @as(u32, @intCast(r));
next_unsent = i + 1;
break;
}
}
}
if (next_unsent < kvlen or next_unsent == 0) { // want to make sure at least one syscall occurs (e.g. to trigger MSG.EOR)
const batch_size = kvlen - next_unsent;
const r = syscall4(.sendmmsg, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(&msgvec[next_unsent]), batch_size, flags);
if (getErrno(r) != 0) return r;
return next_unsent + r;
}
return kvlen;
}
return syscall4(.sendmmsg, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(msgvec), vlen, flags);
}
pub fn connect(fd: i32, addr: *const anyopaque, len: socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.connect, &[3]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), len });
}
return syscall3(.connect, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), len);
}
pub fn recvmsg(fd: i32, msg: *std.x.os.Socket.Message, flags: c_int) usize {
if (native_arch == .i386) {
return socketcall(SC.recvmsg, &[3]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(msg), @as(usize, @bitCast(@as(isize, flags))) });
}
return syscall3(.recvmsg, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(msg), @as(usize, @bitCast(@as(isize, flags))));
}
pub fn recvfrom(fd: i32, noalias buf: [*]u8, len: usize, flags: u32, noalias addr: ?*sockaddr, noalias alen: ?*socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.recvfrom, &[6]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), len, flags, @intFromPtr(addr), @intFromPtr(alen) });
}
return syscall6(.recvfrom, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), len, flags, @intFromPtr(addr), @intFromPtr(alen));
}
pub fn shutdown(fd: i32, how: i32) usize {
if (native_arch == .i386) {
return socketcall(SC.shutdown, &[2]usize{ @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, how))) });
}
return syscall2(.shutdown, @as(usize, @bitCast(@as(isize, fd))), @as(usize, @bitCast(@as(isize, how))));
}
pub fn bind(fd: i32, addr: *const sockaddr, len: socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.bind, &[3]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @as(usize, @intCast(len)) });
}
return syscall3(.bind, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @as(usize, @intCast(len)));
}
pub fn listen(fd: i32, backlog: u32) usize {
if (native_arch == .i386) {
return socketcall(SC.listen, &[2]usize{ @as(usize, @bitCast(@as(isize, fd))), backlog });
}
return syscall2(.listen, @as(usize, @bitCast(@as(isize, fd))), backlog);
}
pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const sockaddr, alen: socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.sendto, &[6]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), len, flags, @intFromPtr(addr), @as(usize, @intCast(alen)) });
}
return syscall6(.sendto, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(buf), len, flags, @intFromPtr(addr), @as(usize, @intCast(alen)));
}
pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize {
if (@hasField(SYS, "sendfile64")) {
return syscall4(
.sendfile64,
@as(usize, @bitCast(@as(isize, outfd))),
@as(usize, @bitCast(@as(isize, infd))),
@intFromPtr(offset),
count,
);
} else {
return syscall4(
.sendfile,
@as(usize, @bitCast(@as(isize, outfd))),
@as(usize, @bitCast(@as(isize, infd))),
@intFromPtr(offset),
count,
);
}
}
pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) usize {
if (native_arch == .i386) {
return socketcall(SC.socketpair, &[4]usize{ @as(usize, @intCast(domain)), @as(usize, @intCast(socket_type)), @as(usize, @intCast(protocol)), @intFromPtr(&fd[0]) });
}
return syscall4(.socketpair, @as(usize, @intCast(domain)), @as(usize, @intCast(socket_type)), @as(usize, @intCast(protocol)), @intFromPtr(&fd[0]));
}
pub fn accept(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t) usize {
if (native_arch == .i386) {
return socketcall(SC.accept, &[4]usize{ fd, addr, len, 0 });
}
return accept4(fd, addr, len, 0);
}
pub fn accept4(fd: i32, noalias addr: ?*sockaddr, noalias len: ?*socklen_t, flags: u32) usize {
if (native_arch == .i386) {
return socketcall(SC.accept4, &[4]usize{ @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len), flags });
}
return syscall4(.accept4, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(addr), @intFromPtr(len), flags);
}
pub fn fstat(fd: i32, stat_buf: *Stat) usize {
if (@hasField(SYS, "fstat64")) {
return syscall2(.fstat64, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(stat_buf));
} else {
return syscall2(.fstat, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(stat_buf));
}
}
pub fn stat(pathname: [*:0]const u8, statbuf: *Stat) usize {
if (@hasField(SYS, "stat64")) {
return syscall2(.stat64, @intFromPtr(pathname), @intFromPtr(statbuf));
} else {
return syscall2(.stat, @intFromPtr(pathname), @intFromPtr(statbuf));
}
}
pub fn lstat(pathname: [*:0]const u8, statbuf: *Stat) usize {
if (@hasField(SYS, "lstat64")) {
return syscall2(.lstat64, @intFromPtr(pathname), @intFromPtr(statbuf));
} else {
return syscall2(.lstat, @intFromPtr(pathname), @intFromPtr(statbuf));
}
}
pub fn fstatat(dirfd: i32, path: [*:0]const u8, stat_buf: *Stat, flags: u32) usize {
if (@hasField(SYS, "fstatat64")) {
return syscall4(.fstatat64, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), @intFromPtr(stat_buf), flags);
} else {
return syscall4(.fstatat, @as(usize, @bitCast(@as(isize, dirfd))), @intFromPtr(path), @intFromPtr(stat_buf), flags);
}
}
pub fn statx(dirfd: i32, path: [*]const u8, flags: u32, mask: u32, statx_buf: *Statx) usize {
if (@hasField(SYS, "statx")) {
return syscall5(
.statx,
@as(usize, @bitCast(@as(isize, dirfd))),
@intFromPtr(path),
flags,
mask,
@intFromPtr(statx_buf),
);
}
return @as(usize, @bitCast(-@as(isize, @intFromEnum(E.NOSYS))));
}
pub fn listxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize {
return syscall3(.listxattr, @intFromPtr(path), @intFromPtr(list), size);
}
pub fn llistxattr(path: [*:0]const u8, list: [*]u8, size: usize) usize {
return syscall3(.llistxattr, @intFromPtr(path), @intFromPtr(list), size);
}
pub fn flistxattr(fd: usize, list: [*]u8, size: usize) usize {
return syscall3(.flistxattr, fd, @intFromPtr(list), size);
}
pub fn getxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize {
return syscall4(.getxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size);
}
pub fn lgetxattr(path: [*:0]const u8, name: [*:0]const u8, value: [*]u8, size: usize) usize {
return syscall4(.lgetxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size);
}
pub fn fgetxattr(fd: usize, name: [*:0]const u8, value: [*]u8, size: usize) usize {
return syscall4(.lgetxattr, fd, @intFromPtr(name), @intFromPtr(value), size);
}
pub fn setxattr(path: [*:0]const u8, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize {
return syscall5(.setxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size, flags);
}
pub fn lsetxattr(path: [*:0]const u8, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize {
return syscall5(.lsetxattr, @intFromPtr(path), @intFromPtr(name), @intFromPtr(value), size, flags);
}
pub fn fsetxattr(fd: usize, name: [*:0]const u8, value: *const void, size: usize, flags: usize) usize {
return syscall5(.fsetxattr, fd, @intFromPtr(name), @intFromPtr(value), size, flags);
}
pub fn removexattr(path: [*:0]const u8, name: [*:0]const u8) usize {
return syscall2(.removexattr, @intFromPtr(path), @intFromPtr(name));
}
pub fn lremovexattr(path: [*:0]const u8, name: [*:0]const u8) usize {
return syscall2(.lremovexattr, @intFromPtr(path), @intFromPtr(name));
}
pub fn fremovexattr(fd: usize, name: [*:0]const u8) usize {
return syscall2(.fremovexattr, fd, @intFromPtr(name));
}
pub fn sched_yield() usize {
return syscall0(.sched_yield);
}
pub fn sched_getaffinity(pid: pid_t, size: usize, set: *cpu_set_t) usize {
const rc = syscall3(.sched_getaffinity, @as(usize, @bitCast(@as(isize, pid))), size, @intFromPtr(set));
if (@as(isize, @bitCast(rc)) < 0) return rc;
if (rc < size) @memset(@as([*]u8, @ptrCast(set))[rc..size], 0);
return 0;
}
pub fn epoll_create() usize {
return epoll_create1(0);
}
pub fn epoll_create1(flags: usize) usize {
return syscall1(.epoll_create1, flags);
}
pub fn epoll_ctl(epoll_fd: i32, op: u32, fd: i32, ev: ?*epoll_event) usize {
return syscall4(.epoll_ctl, @as(usize, @bitCast(@as(isize, epoll_fd))), @as(usize, @intCast(op)), @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(ev));
}
pub fn epoll_wait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32) usize {
return epoll_pwait(epoll_fd, events, maxevents, timeout, null);
}
pub fn epoll_pwait(epoll_fd: i32, events: [*]epoll_event, maxevents: u32, timeout: i32, sigmask: ?*const sigset_t) usize {
return syscall6(
.epoll_pwait,
@as(usize, @bitCast(@as(isize, epoll_fd))),
@intFromPtr(events),
@as(usize, @intCast(maxevents)),
@as(usize, @bitCast(@as(isize, timeout))),
@intFromPtr(sigmask),
@sizeOf(sigset_t),
);
}
pub fn eventfd(count: u32, flags: u32) usize {
return syscall2(.eventfd2, count, flags);
}
pub fn timerfd_create(clockid: i32, flags: u32) usize {
return syscall2(.timerfd_create, @as(usize, @bitCast(@as(isize, clockid))), flags);
}
pub const itimerspec = extern struct {
it_interval: timespec,
it_value: timespec,
};
pub fn timerfd_gettime(fd: i32, curr_value: *itimerspec) usize {
return syscall2(.timerfd_gettime, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(curr_value));
}
pub fn timerfd_settime(fd: i32, flags: u32, new_value: *const itimerspec, old_value: ?*itimerspec) usize {
return syscall4(.timerfd_settime, @as(usize, @bitCast(@as(isize, fd))), flags, @intFromPtr(new_value), @intFromPtr(old_value));
}
pub fn unshare(flags: usize) usize {
return syscall1(.unshare, flags);
}
pub fn capget(hdrp: *cap_user_header_t, datap: *cap_user_data_t) usize {
return syscall2(.capget, @intFromPtr(hdrp), @intFromPtr(datap));
}
pub fn capset(hdrp: *cap_user_header_t, datap: *const cap_user_data_t) usize {
return syscall2(.capset, @intFromPtr(hdrp), @intFromPtr(datap));
}
pub fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) usize {
return syscall2(.sigaltstack, @intFromPtr(ss), @intFromPtr(old_ss));
}
pub fn uname(uts: *utsname) usize {
return syscall1(.uname, @intFromPtr(uts));
}
pub fn io_uring_setup(entries: u32, p: *io_uring_params) usize {
return syscall2(.io_uring_setup, entries, @intFromPtr(p));
}
pub fn io_uring_enter(fd: i32, to_submit: u32, min_complete: u32, flags: u32, sig: ?*sigset_t) usize {
return syscall6(.io_uring_enter, @as(usize, @bitCast(@as(isize, fd))), to_submit, min_complete, flags, @intFromPtr(sig), NSIG / 8);
}
pub fn io_uring_register(fd: i32, opcode: IORING_REGISTER, arg: ?*const anyopaque, nr_args: u32) usize {
return syscall4(.io_uring_register, @as(usize, @bitCast(@as(isize, fd))), @intFromEnum(opcode), @intFromPtr(arg), nr_args);
}
pub fn memfd_create(name: [*:0]const u8, flags: u32) usize {
return syscall2(.memfd_create, @intFromPtr(name), flags);
}
pub fn getrusage(who: i32, usage: *rusage) usize {
return syscall2(.getrusage, @as(usize, @bitCast(@as(isize, who))), @intFromPtr(usage));
}
pub fn tcgetattr(fd: fd_t, termios_p: *termios) usize {
return syscall3(.ioctl, @as(usize, @bitCast(@as(isize, fd))), T.CGETS, @intFromPtr(termios_p));
}
pub fn tcsetattr(fd: fd_t, optional_action: TCSA, termios_p: *const termios) usize {
return syscall3(.ioctl, @as(usize, @bitCast(@as(isize, fd))), T.CSETS + @intFromEnum(optional_action), @intFromPtr(termios_p));
}
pub fn ioctl(fd: fd_t, request: u32, arg: usize) usize {
return syscall3(.ioctl, @as(usize, @bitCast(@as(isize, fd))), request, arg);
}
pub fn signalfd(fd: fd_t, mask: *const sigset_t, flags: u32) usize {
return syscall4(.signalfd4, @as(usize, @bitCast(@as(isize, fd))), @intFromPtr(mask), NSIG / 8, flags);
}
pub fn copy_file_range(fd_in: fd_t, off_in: ?*i64, fd_out: fd_t, off_out: ?*i64, len: usize, flags: u32) usize {
return syscall6(
.copy_file_range,
@as(usize, @bitCast(@as(isize, fd_in))),
@intFromPtr(off_in),
@as(usize, @bitCast(@as(isize, fd_out))),
@intFromPtr(off_out),
len,
flags,
);
}
pub fn bpf(cmd: BPF.Cmd, attr: *BPF.Attr, size: u32) usize {
return syscall3(.bpf, @intFromEnum(cmd), @intFromPtr(attr), size);
}
pub fn sync() void {
_ = syscall0(.sync);
}
pub fn syncfs(fd: fd_t) usize {
return syscall1(.syncfs, @as(usize, @bitCast(@as(isize, fd))));
}
pub fn fsync(fd: fd_t) usize {
return syscall1(.fsync, @as(usize, @bitCast(@as(isize, fd))));
}
pub fn fdatasync(fd: fd_t) usize {
return syscall1(.fdatasync, @as(usize, @bitCast(@as(isize, fd))));
}
pub fn prctl(option: i32, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return syscall5(.prctl, @as(usize, @bitCast(@as(isize, option))), arg2, arg3, arg4, arg5);
}
pub fn getrlimit(resource: rlimit_resource, rlim: *rlimit) usize {
// use prlimit64 to have 64 bit limits on 32 bit platforms
return prlimit(0, resource, null, rlim);
}
pub fn setrlimit(resource: rlimit_resource, rlim: *const rlimit) usize {
// use prlimit64 to have 64 bit limits on 32 bit platforms
return prlimit(0, resource, rlim, null);
}
pub fn prlimit(pid: pid_t, resource: rlimit_resource, new_limit: ?*const rlimit, old_limit: ?*rlimit) usize {
return syscall4(
.prlimit64,
@as(usize, @bitCast(@as(isize, pid))),
@as(usize, @bitCast(@as(isize, @intFromEnum(resource)))),
@intFromPtr(new_limit),
@intFromPtr(old_limit),
);
}
pub fn madvise(address: [*]u8, len: usize, advice: u32) usize {
return syscall3(.madvise, @intFromPtr(address), len, advice);
}
pub fn pidfd_open(pid: pid_t, flags: u32) usize {
return syscall2(.pidfd_open, @as(usize, @bitCast(@as(isize, pid))), flags);
}
pub fn pidfd_getfd(pidfd: fd_t, targetfd: fd_t, flags: u32) usize {
return syscall3(
.pidfd_getfd,
@as(usize, @bitCast(@as(isize, pidfd))),
@as(usize, @bitCast(@as(isize, targetfd))),
flags,
);
}
pub fn pidfd_send_signal(pidfd: fd_t, sig: i32, info: ?*siginfo_t, flags: u32) usize {
return syscall4(
.pidfd_send_signal,
@as(usize, @bitCast(@as(isize, pidfd))),
@as(usize, @bitCast(@as(isize, sig))),
@intFromPtr(info),
flags,
);
}
pub fn process_vm_readv(pid: pid_t, local: [*]const iovec, local_count: usize, remote: [*]const iovec, remote_count: usize, flags: usize) usize {
return syscall6(
.process_vm_readv,
@as(usize, @bitCast(@as(isize, pid))),
@intFromPtr(local),
local_count,
@intFromPtr(remote),
remote_count,
flags,
);
}
pub fn process_vm_writev(pid: pid_t, local: [*]const iovec, local_count: usize, remote: [*]const iovec, remote_count: usize, flags: usize) usize {
return syscall6(
.process_vm_writev,
@as(usize, @bitCast(@as(isize, pid))),
@intFromPtr(local),
local_count,
@intFromPtr(remote),
remote_count,
flags,
);
}
pub fn fadvise(fd: fd_t, offset: i64, len: i64, advice: usize) usize {
if (comptime builtin.cpu.arch.isMIPS()) {
// MIPS requires a 7 argument syscall
const offset_halves = splitValue64(offset);
const length_halves = splitValue64(len);
return syscall7(
.fadvise64,
@as(usize, @bitCast(@as(isize, fd))),
0,
offset_halves[0],
offset_halves[1],
length_halves[0],
length_halves[1],
advice,
);
} else if (comptime builtin.cpu.arch.isARM()) {
// ARM reorders the arguments
const offset_halves = splitValue64(offset);
const length_halves = splitValue64(len);
return syscall6(
.fadvise64_64,
@as(usize, @bitCast(@as(isize, fd))),
advice,
offset_halves[0],
offset_halves[1],
length_halves[0],
length_halves[1],
);
} else if (@hasField(SYS, "fadvise64_64") and usize_bits != 64) {
// The extra usize check is needed to avoid SPARC64 because it provides both
// fadvise64 and fadvise64_64 but the latter behaves differently than other platforms.
const offset_halves = splitValue64(offset);
const length_halves = splitValue64(len);
return syscall6(
.fadvise64_64,
@as(usize, @bitCast(@as(isize, fd))),
offset_halves[0],
offset_halves[1],
length_halves[0],
length_halves[1],
advice,
);
} else {
return syscall4(
.fadvise64,
@as(usize, @bitCast(@as(isize, fd))),
@as(usize, @bitCast(offset)),
@as(usize, @bitCast(len)),
advice,
);
}
}
pub const E = switch (native_arch) {
.mips, .mipsel => @import("linux/errno/mips.zig").E,
.sparc, .sparcel, .sparcv9 => @import("linux/errno/sparc.zig").E,
else => @import("linux/errno/generic.zig").E,
};
pub const pid_t = i32;
pub const fd_t = i32;
pub const uid_t = u32;
pub const gid_t = u32;
pub const clock_t = isize;
pub const NAME_MAX = 255;
pub const PATH_MAX = 4096;
pub const IOV_MAX = 1024;
/// Largest hardware address length
/// e.g. a mac address is a type of hardware address
pub const MAX_ADDR_LEN = 32;
pub const STDIN_FILENO = 0;
pub const STDOUT_FILENO = 1;
pub const STDERR_FILENO = 2;
pub const AT = struct {
/// Special value used to indicate openat should use the current working directory
pub const FDCWD = -100;
/// Do not follow symbolic links
pub const SYMLINK_NOFOLLOW = 0x100;
/// Remove directory instead of unlinking file
pub const REMOVEDIR = 0x200;
/// Follow symbolic links.
pub const SYMLINK_FOLLOW = 0x400;
/// Suppress terminal automount traversal
pub const NO_AUTOMOUNT = 0x800;
/// Allow empty relative pathname
pub const EMPTY_PATH = 0x1000;
/// Type of synchronisation required from statx()
pub const STATX_SYNC_TYPE = 0x6000;
/// - Do whatever stat() does
pub const STATX_SYNC_AS_STAT = 0x0000;
/// - Force the attributes to be sync'd with the server
pub const STATX_FORCE_SYNC = 0x2000;
/// - Don't sync attributes with the server
pub const STATX_DONT_SYNC = 0x4000;
/// Apply to the entire subtree
pub const RECURSIVE = 0x8000;
};
pub const FALLOC = struct {
/// Default is extend size
pub const FL_KEEP_SIZE = 0x01;
/// De-allocates range
pub const FL_PUNCH_HOLE = 0x02;
/// Reserved codepoint
pub const FL_NO_HIDE_STALE = 0x04;
/// Removes a range of a file without leaving a hole in the file
pub const FL_COLLAPSE_RANGE = 0x08;
/// Converts a range of file to zeros preferably without issuing data IO
pub const FL_ZERO_RANGE = 0x10;
/// Inserts space within the file size without overwriting any existing data
pub const FL_INSERT_RANGE = 0x20;
/// Unshares shared blocks within the file size without overwriting any existing data
pub const FL_UNSHARE_RANGE = 0x40;
};
pub const FUTEX = struct {
pub const WAIT = 0;
pub const WAKE = 1;
pub const FD = 2;
pub const REQUEUE = 3;
pub const CMP_REQUEUE = 4;
pub const WAKE_OP = 5;
pub const LOCK_PI = 6;
pub const UNLOCK_PI = 7;
pub const TRYLOCK_PI = 8;
pub const WAIT_BITSET = 9;
pub const WAKE_BITSET = 10;
pub const WAIT_REQUEUE_PI = 11;
pub const CMP_REQUEUE_PI = 12;
pub const PRIVATE_FLAG = 128;
pub const CLOCK_REALTIME = 256;
};
pub const PROT = struct {
/// page can not be accessed
pub const NONE = 0x0;
/// page can be read
pub const READ = 0x1;
/// page can be written
pub const WRITE = 0x2;
/// page can be executed
pub const EXEC = 0x4;
/// page may be used for atomic ops
pub const SEM = switch (native_arch) {
// TODO: also xtensa
.mips, .mipsel, .mips64, .mips64el => 0x10,
else => 0x8,
};
/// mprotect flag: extend change to start of growsdown vma
pub const GROWSDOWN = 0x01000000;
/// mprotect flag: extend change to end of growsup vma
pub const GROWSUP = 0x02000000;
};
pub const FD_CLOEXEC = 1;
pub const F_OK = 0;
pub const X_OK = 1;
pub const W_OK = 2;
pub const R_OK = 4;
pub const W = struct {
pub const NOHANG = 1;
pub const UNTRACED = 2;
pub const STOPPED = 2;
pub const EXITED = 4;
pub const CONTINUED = 8;
pub const NOWAIT = 0x1000000;
pub fn EXITSTATUS(s: u32) u8 {
return @as(u8, @intCast((s & 0xff00) >> 8));
}
pub fn TERMSIG(s: u32) u32 {
return s & 0x7f;
}
pub fn STOPSIG(s: u32) u32 {
return EXITSTATUS(s);
}
pub fn IFEXITED(s: u32) bool {
return TERMSIG(s) == 0;
}
pub fn IFSTOPPED(s: u32) bool {
return @as(u16, @truncate(((s & 0xffff) *% 0x10001) >> 8)) > 0x7f00;
}
pub fn IFSIGNALED(s: u32) bool {
return (s & 0xffff) -% 1 < 0xff;
}
};
// waitid id types
pub const P = enum(c_uint) {
ALL = 0,
PID = 1,
PGID = 2,
PIDFD = 3,
_,
};
pub const SA = if (is_mips) struct {
pub const NOCLDSTOP = 1;
pub const NOCLDWAIT = 0x10000;
pub const SIGINFO = 8;
pub const RESTART = 0x10000000;
pub const RESETHAND = 0x80000000;
pub const ONSTACK = 0x08000000;
pub const NODEFER = 0x40000000;
pub const RESTORER = 0x04000000;
} else if (is_sparc) struct {
pub const NOCLDSTOP = 0x8;
pub const NOCLDWAIT = 0x100;
pub const SIGINFO = 0x200;
pub const RESTART = 0x2;
pub const RESETHAND = 0x4;
pub const ONSTACK = 0x1;
pub const NODEFER = 0x20;
pub const RESTORER = 0x04000000;
} else struct {
pub const NOCLDSTOP = 1;
pub const NOCLDWAIT = 2;
pub const SIGINFO = 4;
pub const RESTART = 0x10000000;
pub const RESETHAND = 0x80000000;
pub const ONSTACK = 0x08000000;
pub const NODEFER = 0x40000000;
pub const RESTORER = 0x04000000;
};
pub const SIG = if (is_mips) struct {
pub const BLOCK = 1;
pub const UNBLOCK = 2;
pub const SETMASK = 3;
pub const HUP = 1;
pub const INT = 2;
pub const QUIT = 3;
pub const ILL = 4;
pub const TRAP = 5;
pub const ABRT = 6;
pub const IOT = ABRT;
pub const BUS = 7;
pub const FPE = 8;
pub const KILL = 9;
pub const USR1 = 10;
pub const SEGV = 11;
pub const USR2 = 12;
pub const PIPE = 13;
pub const ALRM = 14;
pub const TERM = 15;
pub const STKFLT = 16;
pub const CHLD = 17;
pub const CONT = 18;
pub const STOP = 19;
pub const TSTP = 20;
pub const TTIN = 21;
pub const TTOU = 22;
pub const URG = 23;
pub const XCPU = 24;
pub const XFSZ = 25;
pub const VTALRM = 26;
pub const PROF = 27;
pub const WINCH = 28;
pub const IO = 29;
pub const POLL = 29;
pub const PWR = 30;
pub const SYS = 31;
pub const UNUSED = SIG.SYS;
pub const ERR = @as(?Sigaction.sigaction_fn, @ptrFromInt(maxInt(usize)));
pub const DFL = @as(?Sigaction.sigaction_fn, @ptrFromInt(0));
pub const IGN = @as(?Sigaction.sigaction_fn, @ptrFromInt(1));
} else if (is_sparc) struct {
pub const BLOCK = 1;
pub const UNBLOCK = 2;
pub const SETMASK = 4;
pub const HUP = 1;
pub const INT = 2;
pub const QUIT = 3;
pub const ILL = 4;
pub const TRAP = 5;
pub const ABRT = 6;
pub const EMT = 7;
pub const FPE = 8;
pub const KILL = 9;
pub const BUS = 10;
pub const SEGV = 11;
pub const SYS = 12;
pub const PIPE = 13;
pub const ALRM = 14;
pub const TERM = 15;
pub const URG = 16;
pub const STOP = 17;
pub const TSTP = 18;
pub const CONT = 19;
pub const CHLD = 20;
pub const TTIN = 21;
pub const TTOU = 22;
pub const POLL = 23;
pub const XCPU = 24;
pub const XFSZ = 25;
pub const VTALRM = 26;
pub const PROF = 27;
pub const WINCH = 28;
pub const LOST = 29;
pub const USR1 = 30;
pub const USR2 = 31;
pub const IOT = ABRT;
pub const CLD = CHLD;
pub const PWR = LOST;
pub const IO = SIG.POLL;
pub const ERR = @as(?Sigaction.sigaction_fn, @ptrFromInt(maxInt(usize)));
pub const DFL = @as(?Sigaction.sigaction_fn, @ptrFromInt(0));
pub const IGN = @as(?Sigaction.sigaction_fn, @ptrFromInt(1));
} else struct {
pub const BLOCK = 0;
pub const UNBLOCK = 1;
pub const SETMASK = 2;
pub const HUP = 1;
pub const INT = 2;
pub const QUIT = 3;
pub const ILL = 4;
pub const TRAP = 5;
pub const ABRT = 6;
pub const IOT = ABRT;
pub const BUS = 7;
pub const FPE = 8;
pub const KILL = 9;
pub const USR1 = 10;
pub const SEGV = 11;
pub const USR2 = 12;
pub const PIPE = 13;
pub const ALRM = 14;
pub const TERM = 15;
pub const STKFLT = 16;
pub const CHLD = 17;
pub const CONT = 18;
pub const STOP = 19;
pub const TSTP = 20;
pub const TTIN = 21;
pub const TTOU = 22;
pub const URG = 23;
pub const XCPU = 24;
pub const XFSZ = 25;
pub const VTALRM = 26;
pub const PROF = 27;
pub const WINCH = 28;
pub const IO = 29;
pub const POLL = 29;
pub const PWR = 30;
pub const SYS = 31;
pub const UNUSED = SIG.SYS;
pub const ERR = @as(?Sigaction.sigaction_fn, @ptrFromInt(maxInt(usize)));
pub const DFL = @as(?Sigaction.sigaction_fn, @ptrFromInt(0));
pub const IGN = @as(?Sigaction.sigaction_fn, @ptrFromInt(1));
};
pub const kernel_rwf = u32;
pub const RWF = struct {
/// high priority request, poll if possible
pub const HIPRI: kernel_rwf = 0x00000001;
/// per-IO O.DSYNC
pub const DSYNC: kernel_rwf = 0x00000002;
/// per-IO O.SYNC
pub const SYNC: kernel_rwf = 0x00000004;
/// per-IO, return -EAGAIN if operation would block
pub const NOWAIT: kernel_rwf = 0x00000008;
/// per-IO O.APPEND
pub const APPEND: kernel_rwf = 0x00000010;
};
pub const SEEK = struct {
pub const SET = 0;
pub const CUR = 1;
pub const END = 2;
};
pub const SHUT = struct {
pub const RD = 0;
pub const WR = 1;
pub const RDWR = 2;
};
pub const SOCK = struct {
pub const STREAM = if (is_mips) 2 else 1;
pub const DGRAM = if (is_mips) 1 else 2;
pub const RAW = 3;
pub const RDM = 4;
pub const SEQPACKET = 5;
pub const DCCP = 6;
pub const PACKET = 10;
pub const CLOEXEC = 0o2000000;
pub const NONBLOCK = if (is_mips) 0o200 else 0o4000;
};
pub const TCP = struct {
/// Turn off Nagle's algorithm
pub const NODELAY = 1;
/// Limit MSS
pub const MAXSEG = 2;
/// Never send partially complete segments.
pub const CORK = 3;
/// Start keeplives after this period, in seconds
pub const KEEPIDLE = 4;
/// Interval between keepalives
pub const KEEPINTVL = 5;
/// Number of keepalives before death
pub const KEEPCNT = 6;
/// Number of SYN retransmits
pub const SYNCNT = 7;
/// Life time of orphaned FIN-WAIT-2 state
pub const LINGER2 = 8;
/// Wake up listener only when data arrive
pub const DEFER_ACCEPT = 9;
/// Bound advertised window
pub const WINDOW_CLAMP = 10;
/// Information about this connection.
pub const INFO = 11;
/// Block/reenable quick acks
pub const QUICKACK = 12;
/// Congestion control algorithm
pub const CONGESTION = 13;
/// TCP MD5 Signature (RFC2385)
pub const MD5SIG = 14;
/// Use linear timeouts for thin streams
pub const THIN_LINEAR_TIMEOUTS = 16;
/// Fast retrans. after 1 dupack
pub const THIN_DUPACK = 17;
/// How long for loss retry before timeout
pub const USER_TIMEOUT = 18;
/// TCP sock is under repair right now
pub const REPAIR = 19;
pub const REPAIR_QUEUE = 20;
pub const QUEUE_SEQ = 21;
pub const REPAIR_OPTIONS = 22;
/// Enable FastOpen on listeners
pub const FASTOPEN = 23;
pub const TIMESTAMP = 24;
/// limit number of unsent bytes in write queue
pub const NOTSENT_LOWAT = 25;
/// Get Congestion Control (optional) info
pub const CC_INFO = 26;
/// Record SYN headers for new connections
pub const SAVE_SYN = 27;
/// Get SYN headers recorded for connection
pub const SAVED_SYN = 28;
/// Get/set window parameters
pub const REPAIR_WINDOW = 29;
/// Attempt FastOpen with connect
pub const FASTOPEN_CONNECT = 30;
/// Attach a ULP to a TCP connection
pub const ULP = 31;
/// TCP MD5 Signature with extensions
pub const MD5SIG_EXT = 32;
/// Set the key for Fast Open (cookie)
pub const FASTOPEN_KEY = 33;
/// Enable TFO without a TFO cookie
pub const FASTOPEN_NO_COOKIE = 34;
pub const ZEROCOPY_RECEIVE = 35;
/// Notify bytes available to read as a cmsg on read
pub const INQ = 36;
pub const CM_INQ = INQ;
/// delay outgoing packets by XX usec
pub const TX_DELAY = 37;
pub const REPAIR_ON = 1;
pub const REPAIR_OFF = 0;
/// Turn off without window probes
pub const REPAIR_OFF_NO_WP = -1;
};
pub const PF = struct {
pub const UNSPEC = 0;
pub const LOCAL = 1;
pub const UNIX = LOCAL;
pub const FILE = LOCAL;
pub const INET = 2;
pub const AX25 = 3;
pub const IPX = 4;
pub const APPLETALK = 5;
pub const NETROM = 6;
pub const BRIDGE = 7;
pub const ATMPVC = 8;
pub const X25 = 9;
pub const INET6 = 10;
pub const ROSE = 11;
pub const DECnet = 12;
pub const NETBEUI = 13;
pub const SECURITY = 14;
pub const KEY = 15;
pub const NETLINK = 16;
pub const ROUTE = PF.NETLINK;
pub const PACKET = 17;
pub const ASH = 18;
pub const ECONET = 19;
pub const ATMSVC = 20;
pub const RDS = 21;
pub const SNA = 22;
pub const IRDA = 23;
pub const PPPOX = 24;
pub const WANPIPE = 25;
pub const LLC = 26;
pub const IB = 27;
pub const MPLS = 28;
pub const CAN = 29;
pub const TIPC = 30;
pub const BLUETOOTH = 31;
pub const IUCV = 32;
pub const RXRPC = 33;
pub const ISDN = 34;
pub const PHONET = 35;
pub const IEEE802154 = 36;
pub const CAIF = 37;
pub const ALG = 38;
pub const NFC = 39;
pub const VSOCK = 40;
pub const KCM = 41;
pub const QIPCRTR = 42;
pub const SMC = 43;
pub const XDP = 44;
pub const MAX = 45;
};
pub const AF = struct {
pub const UNSPEC = PF.UNSPEC;
pub const LOCAL = PF.LOCAL;
pub const UNIX = AF.LOCAL;
pub const FILE = AF.LOCAL;
pub const INET = PF.INET;
pub const AX25 = PF.AX25;
pub const IPX = PF.IPX;
pub const APPLETALK = PF.APPLETALK;
pub const NETROM = PF.NETROM;
pub const BRIDGE = PF.BRIDGE;
pub const ATMPVC = PF.ATMPVC;
pub const X25 = PF.X25;
pub const INET6 = PF.INET6;
pub const ROSE = PF.ROSE;
pub const DECnet = PF.DECnet;
pub const NETBEUI = PF.NETBEUI;
pub const SECURITY = PF.SECURITY;
pub const KEY = PF.KEY;
pub const NETLINK = PF.NETLINK;
pub const ROUTE = PF.ROUTE;
pub const PACKET = PF.PACKET;
pub const ASH = PF.ASH;
pub const ECONET = PF.ECONET;
pub const ATMSVC = PF.ATMSVC;
pub const RDS = PF.RDS;
pub const SNA = PF.SNA;
pub const IRDA = PF.IRDA;
pub const PPPOX = PF.PPPOX;
pub const WANPIPE = PF.WANPIPE;
pub const LLC = PF.LLC;
pub const IB = PF.IB;
pub const MPLS = PF.MPLS;
pub const CAN = PF.CAN;
pub const TIPC = PF.TIPC;
pub const BLUETOOTH = PF.BLUETOOTH;
pub const IUCV = PF.IUCV;
pub const RXRPC = PF.RXRPC;
pub const ISDN = PF.ISDN;
pub const PHONET = PF.PHONET;
pub const IEEE802154 = PF.IEEE802154;
pub const CAIF = PF.CAIF;
pub const ALG = PF.ALG;
pub const NFC = PF.NFC;
pub const VSOCK = PF.VSOCK;
pub const KCM = PF.KCM;
pub const QIPCRTR = PF.QIPCRTR;
pub const SMC = PF.SMC;
pub const XDP = PF.XDP;
pub const MAX = PF.MAX;
};
pub const SO = struct {
pub usingnamespace if (is_mips) struct {
pub const DEBUG = 1;
pub const REUSEADDR = 0x0004;
pub const KEEPALIVE = 0x0008;
pub const DONTROUTE = 0x0010;
pub const BROADCAST = 0x0020;
pub const LINGER = 0x0080;
pub const OOBINLINE = 0x0100;
pub const REUSEPORT = 0x0200;
pub const SNDBUF = 0x1001;
pub const RCVBUF = 0x1002;
pub const SNDLOWAT = 0x1003;
pub const RCVLOWAT = 0x1004;
pub const RCVTIMEO = 0x1006;
pub const SNDTIMEO = 0x1005;
pub const ERROR = 0x1007;
pub const TYPE = 0x1008;
pub const ACCEPTCONN = 0x1009;
pub const PROTOCOL = 0x1028;
pub const DOMAIN = 0x1029;
pub const NO_CHECK = 11;
pub const PRIORITY = 12;
pub const BSDCOMPAT = 14;
pub const PASSCRED = 17;
pub const PEERCRED = 18;
pub const PEERSEC = 30;
pub const SNDBUFFORCE = 31;
pub const RCVBUFFORCE = 33;
} else if (is_ppc or is_ppc64) struct {
pub const DEBUG = 1;
pub const REUSEADDR = 2;
pub const TYPE = 3;
pub const ERROR = 4;
pub const DONTROUTE = 5;
pub const BROADCAST = 6;
pub const SNDBUF = 7;
pub const RCVBUF = 8;
pub const KEEPALIVE = 9;
pub const OOBINLINE = 10;
pub const NO_CHECK = 11;
pub const PRIORITY = 12;
pub const LINGER = 13;
pub const BSDCOMPAT = 14;
pub const REUSEPORT = 15;
pub const RCVLOWAT = 16;
pub const SNDLOWAT = 17;
pub const RCVTIMEO = 18;
pub const SNDTIMEO = 19;
pub const PASSCRED = 20;
pub const PEERCRED = 21;
pub const ACCEPTCONN = 30;
pub const PEERSEC = 31;
pub const SNDBUFFORCE = 32;
pub const RCVBUFFORCE = 33;
pub const PROTOCOL = 38;
pub const DOMAIN = 39;
} else struct {
pub const DEBUG = 1;
pub const REUSEADDR = 2;
pub const TYPE = 3;
pub const ERROR = 4;
pub const DONTROUTE = 5;
pub const BROADCAST = 6;
pub const SNDBUF = 7;
pub const RCVBUF = 8;
pub const KEEPALIVE = 9;
pub const OOBINLINE = 10;
pub const NO_CHECK = 11;
pub const PRIORITY = 12;
pub const LINGER = 13;
pub const BSDCOMPAT = 14;
pub const REUSEPORT = 15;
pub const PASSCRED = 16;
pub const PEERCRED = 17;
pub const RCVLOWAT = 18;
pub const SNDLOWAT = 19;
pub const RCVTIMEO = 20;
pub const SNDTIMEO = 21;
pub const ACCEPTCONN = 30;
pub const PEERSEC = 31;
pub const SNDBUFFORCE = 32;
pub const RCVBUFFORCE = 33;
pub const PROTOCOL = 38;
pub const DOMAIN = 39;
};
pub const SECURITY_AUTHENTICATION = 22;
pub const SECURITY_ENCRYPTION_TRANSPORT = 23;
pub const SECURITY_ENCRYPTION_NETWORK = 24;
pub const BINDTODEVICE = 25;
pub const ATTACH_FILTER = 26;
pub const DETACH_FILTER = 27;
pub const GET_FILTER = ATTACH_FILTER;
pub const PEERNAME = 28;
pub const TIMESTAMP_OLD = 29;
pub const PASSSEC = 34;
pub const TIMESTAMPNS_OLD = 35;
pub const MARK = 36;
pub const TIMESTAMPING_OLD = 37;
pub const RXQ_OVFL = 40;
pub const WIFI_STATUS = 41;
pub const PEEK_OFF = 42;
pub const NOFCS = 43;
pub const LOCK_FILTER = 44;
pub const SELECT_ERR_QUEUE = 45;
pub const BUSY_POLL = 46;
pub const MAX_PACING_RATE = 47;
pub const BPF_EXTENSIONS = 48;
pub const INCOMING_CPU = 49;
pub const ATTACH_BPF = 50;
pub const DETACH_BPF = DETACH_FILTER;
pub const ATTACH_REUSEPORT_CBPF = 51;
pub const ATTACH_REUSEPORT_EBPF = 52;
pub const CNX_ADVICE = 53;
pub const MEMINFO = 55;
pub const INCOMING_NAPI_ID = 56;
pub const COOKIE = 57;
pub const PEERGROUPS = 59;
pub const ZEROCOPY = 60;
pub const TXTIME = 61;
pub const BINDTOIFINDEX = 62;
pub const TIMESTAMP_NEW = 63;
pub const TIMESTAMPNS_NEW = 64;
pub const TIMESTAMPING_NEW = 65;
pub const RCVTIMEO_NEW = 66;
pub const SNDTIMEO_NEW = 67;
pub const DETACH_REUSEPORT_BPF = 68;
};
pub const SCM = struct {
pub const WIFI_STATUS = SO.WIFI_STATUS;
pub const TIMESTAMPING_OPT_STATS = 54;
pub const TIMESTAMPING_PKTINFO = 58;
pub const TXTIME = SO.TXTIME;
};
pub const SOL = struct {
pub const SOCKET = if (is_mips) 65535 else 1;
pub const IP = 0;
pub const IPV6 = 41;
pub const ICMPV6 = 58;
pub const RAW = 255;
pub const DECNET = 261;
pub const X25 = 262;
pub const PACKET = 263;
pub const ATM = 264;
pub const AAL = 265;
pub const IRDA = 266;
pub const NETBEUI = 267;
pub const LLC = 268;
pub const DCCP = 269;
pub const NETLINK = 270;
pub const TIPC = 271;
pub const RXRPC = 272;
pub const PPPOL2TP = 273;
pub const BLUETOOTH = 274;
pub const PNPIPE = 275;
pub const RDS = 276;
pub const IUCV = 277;
pub const CAIF = 278;
pub const ALG = 279;
pub const NFC = 280;
pub const KCM = 281;
pub const TLS = 282;
pub const XDP = 283;
};
pub const SOMAXCONN = 128;
pub const IP = struct {
pub const TOS = 1;
pub const TTL = 2;
pub const HDRINCL = 3;
pub const OPTIONS = 4;
pub const ROUTER_ALERT = 5;
pub const RECVOPTS = 6;
pub const RETOPTS = 7;
pub const PKTINFO = 8;
pub const PKTOPTIONS = 9;
pub const PMTUDISC = 10;
pub const MTU_DISCOVER = 10;
pub const RECVERR = 11;
pub const RECVTTL = 12;
pub const RECVTOS = 13;
pub const MTU = 14;
pub const FREEBIND = 15;
pub const IPSEC_POLICY = 16;
pub const XFRM_POLICY = 17;
pub const PASSSEC = 18;
pub const TRANSPARENT = 19;
pub const ORIGDSTADDR = 20;
pub const RECVORIGDSTADDR = IP.ORIGDSTADDR;
pub const MINTTL = 21;
pub const NODEFRAG = 22;
pub const CHECKSUM = 23;
pub const BIND_ADDRESS_NO_PORT = 24;
pub const RECVFRAGSIZE = 25;
pub const MULTICAST_IF = 32;
pub const MULTICAST_TTL = 33;
pub const MULTICAST_LOOP = 34;
pub const ADD_MEMBERSHIP = 35;
pub const DROP_MEMBERSHIP = 36;
pub const UNBLOCK_SOURCE = 37;
pub const BLOCK_SOURCE = 38;
pub const ADD_SOURCE_MEMBERSHIP = 39;
pub const DROP_SOURCE_MEMBERSHIP = 40;
pub const MSFILTER = 41;
pub const MULTICAST_ALL = 49;
pub const UNICAST_IF = 50;
pub const RECVRETOPTS = IP.RETOPTS;
pub const PMTUDISC_DONT = 0;
pub const PMTUDISC_WANT = 1;
pub const PMTUDISC_DO = 2;
pub const PMTUDISC_PROBE = 3;
pub const PMTUDISC_INTERFACE = 4;
pub const PMTUDISC_OMIT = 5;
pub const DEFAULT_MULTICAST_TTL = 1;
pub const DEFAULT_MULTICAST_LOOP = 1;
pub const MAX_MEMBERSHIPS = 20;
};
/// IPv6 socket options
pub const IPV6 = struct {
pub const ADDRFORM = 1;
pub const @"2292PKTINFO" = 2;
pub const @"2292HOPOPTS" = 3;
pub const @"2292DSTOPTS" = 4;
pub const @"2292RTHDR" = 5;
pub const @"2292PKTOPTIONS" = 6;
pub const CHECKSUM = 7;
pub const @"2292HOPLIMIT" = 8;
pub const NEXTHOP = 9;
pub const AUTHHDR = 10;
pub const FLOWINFO = 11;
pub const UNICAST_HOPS = 16;
pub const MULTICAST_IF = 17;
pub const MULTICAST_HOPS = 18;
pub const MULTICAST_LOOP = 19;
pub const ADD_MEMBERSHIP = 20;
pub const DROP_MEMBERSHIP = 21;
pub const ROUTER_ALERT = 22;
pub const MTU_DISCOVER = 23;
pub const MTU = 24;
pub const RECVERR = 25;
pub const V6ONLY = 26;
pub const JOIN_ANYCAST = 27;
pub const LEAVE_ANYCAST = 28;
// IPV6.MTU_DISCOVER values
pub const PMTUDISC_DONT = 0;
pub const PMTUDISC_WANT = 1;
pub const PMTUDISC_DO = 2;
pub const PMTUDISC_PROBE = 3;
pub const PMTUDISC_INTERFACE = 4;
pub const PMTUDISC_OMIT = 5;
// Flowlabel
pub const FLOWLABEL_MGR = 32;
pub const FLOWINFO_SEND = 33;
pub const IPSEC_POLICY = 34;
pub const XFRM_POLICY = 35;
pub const HDRINCL = 36;
// Advanced API (RFC3542) (1)
pub const RECVPKTINFO = 49;
pub const PKTINFO = 50;
pub const RECVHOPLIMIT = 51;
pub const HOPLIMIT = 52;
pub const RECVHOPOPTS = 53;
pub const HOPOPTS = 54;
pub const RTHDRDSTOPTS = 55;
pub const RECVRTHDR = 56;
pub const RTHDR = 57;
pub const RECVDSTOPTS = 58;
pub const DSTOPTS = 59;
pub const RECVPATHMTU = 60;
pub const PATHMTU = 61;
pub const DONTFRAG = 62;
// Advanced API (RFC3542) (2)
pub const RECVTCLASS = 66;
pub const TCLASS = 67;
pub const AUTOFLOWLABEL = 70;
// RFC5014: Source address selection
pub const ADDR_PREFERENCES = 72;
pub const PREFER_SRC_TMP = 0x0001;
pub const PREFER_SRC_PUBLIC = 0x0002;
pub const PREFER_SRC_PUBTMP_DEFAULT = 0x0100;
pub const PREFER_SRC_COA = 0x0004;
pub const PREFER_SRC_HOME = 0x0400;
pub const PREFER_SRC_CGA = 0x0008;
pub const PREFER_SRC_NONCGA = 0x0800;
// RFC5082: Generalized Ttl Security Mechanism
pub const MINHOPCOUNT = 73;
pub const ORIGDSTADDR = 74;
pub const RECVORIGDSTADDR = IPV6.ORIGDSTADDR;
pub const TRANSPARENT = 75;
pub const UNICAST_IF = 76;
pub const RECVFRAGSIZE = 77;
pub const FREEBIND = 78;
};
pub const MSG = struct {
pub const OOB = 0x0001;
pub const PEEK = 0x0002;
pub const DONTROUTE = 0x0004;
pub const CTRUNC = 0x0008;
pub const PROXY = 0x0010;
pub const TRUNC = 0x0020;
pub const DONTWAIT = 0x0040;
pub const EOR = 0x0080;
pub const WAITALL = 0x0100;
pub const FIN = 0x0200;
pub const SYN = 0x0400;
pub const CONFIRM = 0x0800;
pub const RST = 0x1000;
pub const ERRQUEUE = 0x2000;
pub const NOSIGNAL = 0x4000;
pub const MORE = 0x8000;
pub const WAITFORONE = 0x10000;
pub const BATCH = 0x40000;
pub const ZEROCOPY = 0x4000000;
pub const FASTOPEN = 0x20000000;
pub const CMSG_CLOEXEC = 0x40000000;
};
pub const DT = struct {
pub const UNKNOWN = 0;
pub const FIFO = 1;
pub const CHR = 2;
pub const DIR = 4;
pub const BLK = 6;
pub const REG = 8;
pub const LNK = 10;
pub const SOCK = 12;
pub const WHT = 14;
};
pub const T = struct {
pub const CGETS = if (is_mips) 0x540D else 0x5401;
pub const CSETS = 0x5402;
pub const CSETSW = 0x5403;
pub const CSETSF = 0x5404;
pub const CGETA = 0x5405;
pub const CSETA = 0x5406;
pub const CSETAW = 0x5407;
pub const CSETAF = 0x5408;
pub const CSBRK = 0x5409;
pub const CXONC = 0x540A;
pub const CFLSH = 0x540B;
pub const IOCEXCL = 0x540C;
pub const IOCNXCL = 0x540D;
pub const IOCSCTTY = 0x540E;
pub const IOCGPGRP = 0x540F;
pub const IOCSPGRP = 0x5410;
pub const IOCOUTQ = if (is_mips) 0x7472 else 0x5411;
pub const IOCSTI = 0x5412;
pub const IOCGWINSZ = if (is_mips or is_ppc64) 0x40087468 else 0x5413;
pub const IOCSWINSZ = if (is_mips or is_ppc64) 0x80087467 else 0x5414;
pub const IOCMGET = 0x5415;
pub const IOCMBIS = 0x5416;
pub const IOCMBIC = 0x5417;
pub const IOCMSET = 0x5418;
pub const IOCGSOFTCAR = 0x5419;
pub const IOCSSOFTCAR = 0x541A;
pub const FIONREAD = if (is_mips) 0x467F else 0x541B;
pub const IOCINQ = FIONREAD;
pub const IOCLINUX = 0x541C;
pub const IOCCONS = 0x541D;
pub const IOCGSERIAL = 0x541E;
pub const IOCSSERIAL = 0x541F;
pub const IOCPKT = 0x5420;
pub const FIONBIO = 0x5421;
pub const IOCNOTTY = 0x5422;
pub const IOCSETD = 0x5423;
pub const IOCGETD = 0x5424;
pub const CSBRKP = 0x5425;
pub const IOCSBRK = 0x5427;
pub const IOCCBRK = 0x5428;
pub const IOCGSID = 0x5429;
pub const IOCGRS485 = 0x542E;
pub const IOCSRS485 = 0x542F;
pub const IOCGPTN = IOCTL.IOR('T', 0x30, c_uint);
pub const IOCSPTLCK = IOCTL.IOW('T', 0x31, c_int);
pub const IOCGDEV = IOCTL.IOR('T', 0x32, c_uint);
pub const CGETX = 0x5432;
pub const CSETX = 0x5433;
pub const CSETXF = 0x5434;
pub const CSETXW = 0x5435;
pub const IOCSIG = IOCTL.IOW('T', 0x36, c_int);
pub const IOCVHANGUP = 0x5437;
pub const IOCGPKT = IOCTL.IOR('T', 0x38, c_int);
pub const IOCGPTLCK = IOCTL.IOR('T', 0x39, c_int);
pub const IOCGEXCL = IOCTL.IOR('T', 0x40, c_int);
};
pub const EPOLL = struct {
pub const CLOEXEC = O.CLOEXEC;
pub const CTL_ADD = 1;
pub const CTL_DEL = 2;
pub const CTL_MOD = 3;
pub const IN = 0x001;
pub const PRI = 0x002;
pub const OUT = 0x004;
pub const RDNORM = 0x040;
pub const RDBAND = 0x080;
pub const WRNORM = if (is_mips) 0x004 else 0x100;
pub const WRBAND = if (is_mips) 0x100 else 0x200;
pub const MSG = 0x400;
pub const ERR = 0x008;
pub const HUP = 0x010;
pub const RDHUP = 0x2000;
pub const EXCLUSIVE = (@as(u32, 1) << 28);
pub const WAKEUP = (@as(u32, 1) << 29);
pub const ONESHOT = (@as(u32, 1) << 30);
pub const ET = (@as(u32, 1) << 31);
};
pub const CLOCK = struct {
pub const REALTIME = 0;
pub const MONOTONIC = 1;
pub const PROCESS_CPUTIME_ID = 2;
pub const THREAD_CPUTIME_ID = 3;
pub const MONOTONIC_RAW = 4;
pub const REALTIME_COARSE = 5;
pub const MONOTONIC_COARSE = 6;
pub const BOOTTIME = 7;
pub const REALTIME_ALARM = 8;
pub const BOOTTIME_ALARM = 9;
pub const SGI_CYCLE = 10;
pub const TAI = 11;
};
pub const CSIGNAL = 0x000000ff;
pub const CLONE = struct {
pub const VM = 0x00000100;
pub const FS = 0x00000200;
pub const FILES = 0x00000400;
pub const SIGHAND = 0x00000800;
pub const PIDFD = 0x00001000;
pub const PTRACE = 0x00002000;
pub const VFORK = 0x00004000;
pub const PARENT = 0x00008000;
pub const THREAD = 0x00010000;
pub const NEWNS = 0x00020000;
pub const SYSVSEM = 0x00040000;
pub const SETTLS = 0x00080000;
pub const PARENT_SETTID = 0x00100000;
pub const CHILD_CLEARTID = 0x00200000;
pub const DETACHED = 0x00400000;
pub const UNTRACED = 0x00800000;
pub const CHILD_SETTID = 0x01000000;
pub const NEWCGROUP = 0x02000000;
pub const NEWUTS = 0x04000000;
pub const NEWIPC = 0x08000000;
pub const NEWUSER = 0x10000000;
pub const NEWPID = 0x20000000;
pub const NEWNET = 0x40000000;
pub const IO = 0x80000000;
// Flags for the clone3() syscall.
/// Clear any signal handler and reset to SIG_DFL.
pub const CLEAR_SIGHAND = 0x100000000;
/// Clone into a specific cgroup given the right permissions.
pub const INTO_CGROUP = 0x200000000;
// cloning flags intersect with CSIGNAL so can be used with unshare and clone3 syscalls only.
/// New time namespace
pub const NEWTIME = 0x00000080;
};
pub const EFD = struct {
pub const SEMAPHORE = 1;
pub const CLOEXEC = O.CLOEXEC;
pub const NONBLOCK = O.NONBLOCK;
};
pub const MS = struct {
pub const RDONLY = 1;
pub const NOSUID = 2;
pub const NODEV = 4;
pub const NOEXEC = 8;
pub const SYNCHRONOUS = 16;
pub const REMOUNT = 32;
pub const MANDLOCK = 64;
pub const DIRSYNC = 128;
pub const NOATIME = 1024;
pub const NODIRATIME = 2048;
pub const BIND = 4096;
pub const MOVE = 8192;
pub const REC = 16384;
pub const SILENT = 32768;
pub const POSIXACL = (1 << 16);
pub const UNBINDABLE = (1 << 17);
pub const PRIVATE = (1 << 18);
pub const SLAVE = (1 << 19);
pub const SHARED = (1 << 20);
pub const RELATIME = (1 << 21);
pub const KERNMOUNT = (1 << 22);
pub const I_VERSION = (1 << 23);
pub const STRICTATIME = (1 << 24);
pub const LAZYTIME = (1 << 25);
pub const NOREMOTELOCK = (1 << 27);
pub const NOSEC = (1 << 28);
pub const BORN = (1 << 29);
pub const ACTIVE = (1 << 30);
pub const NOUSER = (1 << 31);
pub const RMT_MASK = (RDONLY | SYNCHRONOUS | MANDLOCK | I_VERSION | LAZYTIME);
pub const MGC_VAL = 0xc0ed0000;
pub const MGC_MSK = 0xffff0000;
};
pub const MNT = struct {
pub const FORCE = 1;
pub const DETACH = 2;
pub const EXPIRE = 4;
};
pub const UMOUNT_NOFOLLOW = 8;
pub const IN = struct {
pub const CLOEXEC = O.CLOEXEC;
pub const NONBLOCK = O.NONBLOCK;
pub const ACCESS = 0x00000001;
pub const MODIFY = 0x00000002;
pub const ATTRIB = 0x00000004;
pub const CLOSE_WRITE = 0x00000008;
pub const CLOSE_NOWRITE = 0x00000010;
pub const CLOSE = CLOSE_WRITE | CLOSE_NOWRITE;
pub const OPEN = 0x00000020;
pub const MOVED_FROM = 0x00000040;
pub const MOVED_TO = 0x00000080;
pub const MOVE = MOVED_FROM | MOVED_TO;
pub const CREATE = 0x00000100;
pub const DELETE = 0x00000200;
pub const DELETE_SELF = 0x00000400;
pub const MOVE_SELF = 0x00000800;
pub const ALL_EVENTS = 0x00000fff;
pub const UNMOUNT = 0x00002000;
pub const Q_OVERFLOW = 0x00004000;
pub const IGNORED = 0x00008000;
pub const ONLYDIR = 0x01000000;
pub const DONT_FOLLOW = 0x02000000;
pub const EXCL_UNLINK = 0x04000000;
pub const MASK_ADD = 0x20000000;
pub const ISDIR = 0x40000000;
pub const ONESHOT = 0x80000000;
};
pub const S = struct {
pub const IFMT = 0o170000;
pub const IFDIR = 0o040000;
pub const IFCHR = 0o020000;
pub const IFBLK = 0o060000;
pub const IFREG = 0o100000;
pub const IFIFO = 0o010000;
pub const IFLNK = 0o120000;
pub const IFSOCK = 0o140000;
pub const ISUID = 0o4000;
pub const ISGID = 0o2000;
pub const ISVTX = 0o1000;
pub const IRUSR = 0o400;
pub const IWUSR = 0o200;
pub const IXUSR = 0o100;
pub const IRWXU = 0o700;
pub const IRGRP = 0o040;
pub const IWGRP = 0o020;
pub const IXGRP = 0o010;
pub const IRWXG = 0o070;
pub const IROTH = 0o004;
pub const IWOTH = 0o002;
pub const IXOTH = 0o001;
pub const IRWXO = 0o007;
pub fn ISREG(m: u32) bool {
return m & IFMT == IFREG;
}
pub fn ISDIR(m: u32) bool {
return m & IFMT == IFDIR;
}
pub fn ISCHR(m: u32) bool {
return m & IFMT == IFCHR;
}
pub fn ISBLK(m: u32) bool {
return m & IFMT == IFBLK;
}
pub fn ISFIFO(m: u32) bool {
return m & IFMT == IFIFO;
}
pub fn ISLNK(m: u32) bool {
return m & IFMT == IFLNK;
}
pub fn ISSOCK(m: u32) bool {
return m & IFMT == IFSOCK;
}
};
pub const UTIME = struct {
pub const NOW = 0x3fffffff;
pub const OMIT = 0x3ffffffe;
};
pub const TFD = struct {
pub const NONBLOCK = O.NONBLOCK;
pub const CLOEXEC = O.CLOEXEC;
pub const TIMER_ABSTIME = 1;
pub const TIMER_CANCEL_ON_SET = (1 << 1);
};
pub const winsize = extern struct {
ws_row: u16,
ws_col: u16,
ws_xpixel: u16,
ws_ypixel: u16,
};
/// NSIG is the total number of signals defined.
/// As signal numbers are sequential, NSIG is one greater than the largest defined signal number.
pub const NSIG = if (is_mips) 128 else 65;
pub const sigset_t = [1024 / 32]u32;
pub const all_mask: sigset_t = [_]u32{0xffffffff} ** sigset_t.len;
pub const app_mask: sigset_t = [2]u32{ 0xfffffffc, 0x7fffffff } ++ [_]u32{0xffffffff} ** 30;
pub const k_sigaction = switch (native_arch) {
.mips, .mipsel => extern struct {
flags: c_uint,
handler: ?fn (c_int) callconv(.C) void,
mask: [4]c_ulong,
restorer: fn () callconv(.C) void,
},
.mips64, .mips64el => extern struct {
flags: c_uint,
handler: ?fn (c_int) callconv(.C) void,
mask: [2]c_ulong,
restorer: fn () callconv(.C) void,
},
else => extern struct {
handler: ?fn (c_int) callconv(.C) void,
flags: c_ulong,
restorer: fn () callconv(.C) void,
mask: [2]c_uint,
},
};
/// Renamed from `sigaction` to `Sigaction` to avoid conflict with the syscall.
pub const Sigaction = extern struct {
pub const handler_fn = fn (c_int) callconv(.C) void;
pub const sigaction_fn = fn (c_int, *const siginfo_t, ?*const anyopaque) callconv(.C) void;
handler: extern union {
handler: ?handler_fn,
sigaction: ?sigaction_fn,
},
mask: sigset_t,
flags: c_uint,
restorer: ?fn () callconv(.C) void = null,
};
pub const empty_sigset = [_]u32{0} ** @typeInfo(sigset_t).Array.len;
pub const SFD = struct {
pub const CLOEXEC = O.CLOEXEC;
pub const NONBLOCK = O.NONBLOCK;
};
pub const signalfd_siginfo = extern struct {
signo: u32,
errno: i32,
code: i32,
pid: u32,
uid: uid_t,
fd: i32,
tid: u32,
band: u32,
overrun: u32,
trapno: u32,
status: i32,
int: i32,
ptr: u64,
utime: u64,
stime: u64,
addr: u64,
addr_lsb: u16,
__pad2: u16,
syscall: i32,
call_addr: u64,
native_arch: u32,
__pad: [28]u8,
};
pub const in_port_t = u16;
pub const sa_family_t = u16;
pub const socklen_t = u32;
pub const sockaddr = extern struct {
family: sa_family_t,
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
/// IPv4 socket address
pub const in = extern struct {
family: sa_family_t = AF.INET,
port: in_port_t,
addr: u32,
zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 },
};
/// IPv6 socket address
pub const in6 = extern struct {
family: sa_family_t = AF.INET6,
port: in_port_t,
flowinfo: u32,
addr: [16]u8,
scope_id: u32,
};
/// UNIX domain socket address
pub const un = extern struct {
family: sa_family_t = AF.UNIX,
path: [108]u8,
};
/// Netlink socket address
pub const nl = extern struct {
family: sa_family_t = AF.NETLINK,
__pad1: c_ushort = 0,
/// port ID
pid: u32,
/// multicast groups mask
groups: u32,
};
pub const xdp = extern struct {
family: u16 = AF.XDP,
flags: u16,
ifindex: u32,
queue_id: u32,
shared_umem_fd: u32,
};
};
pub const mmsghdr = extern struct {
msg_hdr: msghdr,
msg_len: u32,
};
pub const mmsghdr_const = extern struct {
msg_hdr: msghdr_const,
msg_len: u32,
};
pub const epoll_data = extern union {
ptr: usize,
fd: i32,
u32: u32,
u64: u64,
};
// On x86_64 the structure is packed so that it matches the definition of its
// 32bit counterpart
pub const epoll_event = switch (native_arch) {
.x86_64 => packed struct {
events: u32,
data: epoll_data,
},
else => extern struct {
events: u32,
data: epoll_data,
},
};
pub const VFS_CAP_REVISION_MASK = 0xFF000000;
pub const VFS_CAP_REVISION_SHIFT = 24;
pub const VFS_CAP_FLAGS_MASK = ~VFS_CAP_REVISION_MASK;
pub const VFS_CAP_FLAGS_EFFECTIVE = 0x000001;
pub const VFS_CAP_REVISION_1 = 0x01000000;
pub const VFS_CAP_U32_1 = 1;
pub const XATTR_CAPS_SZ_1 = @sizeOf(u32) * (1 + 2 * VFS_CAP_U32_1);
pub const VFS_CAP_REVISION_2 = 0x02000000;
pub const VFS_CAP_U32_2 = 2;
pub const XATTR_CAPS_SZ_2 = @sizeOf(u32) * (1 + 2 * VFS_CAP_U32_2);
pub const XATTR_CAPS_SZ = XATTR_CAPS_SZ_2;
pub const VFS_CAP_U32 = VFS_CAP_U32_2;
pub const VFS_CAP_REVISION = VFS_CAP_REVISION_2;
pub const vfs_cap_data = extern struct {
//all of these are mandated as little endian
//when on disk.
const Data = struct {
permitted: u32,
inheritable: u32,
};
magic_etc: u32,
data: [VFS_CAP_U32]Data,
};
pub const CAP = struct {
pub const CHOWN = 0;
pub const DAC_OVERRIDE = 1;
pub const DAC_READ_SEARCH = 2;
pub const FOWNER = 3;
pub const FSETID = 4;
pub const KILL = 5;
pub const SETGID = 6;
pub const SETUID = 7;
pub const SETPCAP = 8;
pub const LINUX_IMMUTABLE = 9;
pub const NET_BIND_SERVICE = 10;
pub const NET_BROADCAST = 11;
pub const NET_ADMIN = 12;
pub const NET_RAW = 13;
pub const IPC_LOCK = 14;
pub const IPC_OWNER = 15;
pub const SYS_MODULE = 16;
pub const SYS_RAWIO = 17;
pub const SYS_CHROOT = 18;
pub const SYS_PTRACE = 19;
pub const SYS_PACCT = 20;
pub const SYS_ADMIN = 21;
pub const SYS_BOOT = 22;
pub const SYS_NICE = 23;
pub const SYS_RESOURCE = 24;
pub const SYS_TIME = 25;
pub const SYS_TTY_CONFIG = 26;
pub const MKNOD = 27;
pub const LEASE = 28;
pub const AUDIT_WRITE = 29;
pub const AUDIT_CONTROL = 30;
pub const SETFCAP = 31;
pub const MAC_OVERRIDE = 32;
pub const MAC_ADMIN = 33;
pub const SYSLOG = 34;
pub const WAKE_ALARM = 35;
pub const BLOCK_SUSPEND = 36;
pub const AUDIT_READ = 37;
pub const LAST_CAP = AUDIT_READ;
pub fn valid(x: u8) bool {
return x >= 0 and x <= LAST_CAP;
}
pub fn TO_MASK(cap: u8) u32 {
return @as(u32, 1) << @as(u5, @intCast(cap & 31));
}
pub fn TO_INDEX(cap: u8) u8 {
return cap >> 5;
}
};
pub const cap_t = extern struct {
hdrp: *cap_user_header_t,
datap: *cap_user_data_t,
};
pub const cap_user_header_t = extern struct {
version: u32,
pid: usize,
};
pub const cap_user_data_t = extern struct {
effective: u32,
permitted: u32,
inheritable: u32,
};
pub const inotify_event = extern struct {
wd: i32,
mask: u32,
cookie: u32,
len: u32,
//name: [?]u8,
};
pub const dirent64 = extern struct {
d_ino: u64,
d_off: u64,
d_reclen: u16,
d_type: u8,
d_name: u8, // field address is the address of first byte of name https://github.com/ziglang/zig/issues/173
pub fn reclen(self: dirent64) u16 {
return self.d_reclen;
}
};
pub const dl_phdr_info = extern struct {
dlpi_addr: usize,
dlpi_name: ?[*:0]const u8,
dlpi_phdr: [*]std.elf.Phdr,
dlpi_phnum: u16,
};
pub const CPU_SETSIZE = 128;
pub const cpu_set_t = [CPU_SETSIZE / @sizeOf(usize)]usize;
pub const cpu_count_t = std.meta.Int(.unsigned, std.math.log2(CPU_SETSIZE * 8));
pub fn CPU_COUNT(set: cpu_set_t) cpu_count_t {
var sum: cpu_count_t = 0;
for (set) |x| {
sum += @popCount(x);
}
return sum;
}
pub const MINSIGSTKSZ = switch (native_arch) {
.i386, .x86_64, .arm, .mipsel => 2048,
.aarch64 => 5120,
else => @compileError("MINSIGSTKSZ not defined for this architecture"),
};
pub const SIGSTKSZ = switch (native_arch) {
.i386, .x86_64, .arm, .mipsel => 8192,
.aarch64 => 16384,
else => @compileError("SIGSTKSZ not defined for this architecture"),
};
pub const SS_ONSTACK = 1;
pub const SS_DISABLE = 2;
pub const SS_AUTODISARM = 1 << 31;
pub const stack_t = if (is_mips)
// IRIX compatible stack_t
extern struct {
sp: [*]u8,
size: usize,
flags: i32,
}
else
extern struct {
sp: [*]u8,
flags: i32,
size: usize,
};
pub const sigval = extern union {
int: i32,
ptr: *anyopaque,
};
const siginfo_fields_union = extern union {
pad: [128 - 2 * @sizeOf(c_int) - @sizeOf(c_long)]u8,
common: extern struct {
first: extern union {
piduid: extern struct {
pid: pid_t,
uid: uid_t,
},
timer: extern struct {
timerid: i32,
overrun: i32,
},
},
second: extern union {
value: sigval,
sigchld: extern struct {
status: i32,
utime: clock_t,
stime: clock_t,
},
},
},
sigfault: extern struct {
addr: *anyopaque,
addr_lsb: i16,
first: extern union {
addr_bnd: extern struct {
lower: *anyopaque,
upper: *anyopaque,
},
pkey: u32,
},
},
sigpoll: extern struct {
band: isize,
fd: i32,
},
sigsys: extern struct {
call_addr: *anyopaque,
syscall: i32,
native_arch: u32,
},
};
pub const siginfo_t = if (is_mips)
extern struct {
signo: i32,
code: i32,
errno: i32,
fields: siginfo_fields_union,
}
else
extern struct {
signo: i32,
errno: i32,
code: i32,
fields: siginfo_fields_union,
};
pub const io_uring_params = extern struct {
sq_entries: u32,
cq_entries: u32,
flags: u32,
sq_thread_cpu: u32,
sq_thread_idle: u32,
features: u32,
wq_fd: u32,
resv: [3]u32,
sq_off: io_sqring_offsets,
cq_off: io_cqring_offsets,
};
// io_uring_params.features flags
pub const IORING_FEAT_SINGLE_MMAP = 1 << 0;
pub const IORING_FEAT_NODROP = 1 << 1;
pub const IORING_FEAT_SUBMIT_STABLE = 1 << 2;
pub const IORING_FEAT_RW_CUR_POS = 1 << 3;
pub const IORING_FEAT_CUR_PERSONALITY = 1 << 4;
pub const IORING_FEAT_FAST_POLL = 1 << 5;
pub const IORING_FEAT_POLL_32BITS = 1 << 6;
// io_uring_params.flags
/// io_context is polled
pub const IORING_SETUP_IOPOLL = 1 << 0;
/// SQ poll thread
pub const IORING_SETUP_SQPOLL = 1 << 1;
/// sq_thread_cpu is valid
pub const IORING_SETUP_SQ_AFF = 1 << 2;
/// app defines CQ size
pub const IORING_SETUP_CQSIZE = 1 << 3;
/// clamp SQ/CQ ring sizes
pub const IORING_SETUP_CLAMP = 1 << 4;
/// attach to existing wq
pub const IORING_SETUP_ATTACH_WQ = 1 << 5;
/// start with ring disabled
pub const IORING_SETUP_R_DISABLED = 1 << 6;
pub const io_sqring_offsets = extern struct {
/// offset of ring head
head: u32,
/// offset of ring tail
tail: u32,
/// ring mask value
ring_mask: u32,
/// entries in ring
ring_entries: u32,
/// ring flags
flags: u32,
/// number of sqes not submitted
dropped: u32,
/// sqe index array
array: u32,
resv1: u32,
resv2: u64,
};
// io_sqring_offsets.flags
/// needs io_uring_enter wakeup
pub const IORING_SQ_NEED_WAKEUP = 1 << 0;
/// kernel has cqes waiting beyond the cq ring
pub const IORING_SQ_CQ_OVERFLOW = 1 << 1;
pub const io_cqring_offsets = extern struct {
head: u32,
tail: u32,
ring_mask: u32,
ring_entries: u32,
overflow: u32,
cqes: u32,
resv: [2]u64,
};
pub const io_uring_sqe = extern struct {
opcode: IORING_OP,
flags: u8,
ioprio: u16,
fd: i32,
off: u64,
addr: u64,
len: u32,
rw_flags: u32,
user_data: u64,
buf_index: u16,
personality: u16,
splice_fd_in: i32,
__pad2: [2]u64,
};
pub const IOSQE_BIT = enum(u8) {
FIXED_FILE,
IO_DRAIN,
IO_LINK,
IO_HARDLINK,
ASYNC,
BUFFER_SELECT,
_,
};
// io_uring_sqe.flags
/// use fixed fileset
pub const IOSQE_FIXED_FILE = 1 << @intFromEnum(IOSQE_BIT.FIXED_FILE);
/// issue after inflight IO
pub const IOSQE_IO_DRAIN = 1 << @intFromEnum(IOSQE_BIT.IO_DRAIN);
/// links next sqe
pub const IOSQE_IO_LINK = 1 << @intFromEnum(IOSQE_BIT.IO_LINK);
/// like LINK, but stronger
pub const IOSQE_IO_HARDLINK = 1 << @intFromEnum(IOSQE_BIT.IO_HARDLINK);
/// always go async
pub const IOSQE_ASYNC = 1 << @intFromEnum(IOSQE_BIT.ASYNC);
/// select buffer from buf_group
pub const IOSQE_BUFFER_SELECT = 1 << @intFromEnum(IOSQE_BIT.BUFFER_SELECT);
pub const IORING_OP = enum(u8) {
NOP,
READV,
WRITEV,
FSYNC,
READ_FIXED,
WRITE_FIXED,
POLL_ADD,
POLL_REMOVE,
SYNC_FILE_RANGE,
SENDMSG,
RECVMSG,
TIMEOUT,
TIMEOUT_REMOVE,
ACCEPT,
ASYNC_CANCEL,
LINK_TIMEOUT,
CONNECT,
FALLOCATE,
OPENAT,
CLOSE,
FILES_UPDATE,
STATX,
READ,
WRITE,
FADVISE,
MADVISE,
SEND,
RECV,
OPENAT2,
EPOLL_CTL,
SPLICE,
PROVIDE_BUFFERS,
REMOVE_BUFFERS,
TEE,
_,
};
// io_uring_sqe.fsync_flags
pub const IORING_FSYNC_DATASYNC = 1 << 0;
// io_uring_sqe.timeout_flags
pub const IORING_TIMEOUT_ABS = 1 << 0;
// IO completion data structure (Completion Queue Entry)
pub const io_uring_cqe = extern struct {
/// io_uring_sqe.data submission passed back
user_data: u64,
/// result code for this event
res: i32,
flags: u32,
pub fn err(self: io_uring_cqe) E {
if (self.res > -4096 and self.res < 0) {
return @as(E, @enumFromInt(-self.res));
}
return .SUCCESS;
}
};
// io_uring_cqe.flags
/// If set, the upper 16 bits are the buffer ID
pub const IORING_CQE_F_BUFFER = 1 << 0;
pub const IORING_OFF_SQ_RING = 0;
pub const IORING_OFF_CQ_RING = 0x8000000;
pub const IORING_OFF_SQES = 0x10000000;
// io_uring_enter flags
pub const IORING_ENTER_GETEVENTS = 1 << 0;
pub const IORING_ENTER_SQ_WAKEUP = 1 << 1;
// io_uring_register opcodes and arguments
pub const IORING_REGISTER = enum(u8) {
REGISTER_BUFFERS,
UNREGISTER_BUFFERS,
REGISTER_FILES,
UNREGISTER_FILES,
REGISTER_EVENTFD,
UNREGISTER_EVENTFD,
REGISTER_FILES_UPDATE,
REGISTER_EVENTFD_ASYNC,
REGISTER_PROBE,
REGISTER_PERSONALITY,
UNREGISTER_PERSONALITY,
REGISTER_RESTRICTIONS,
REGISTER_ENABLE_RINGS,
_,
};
pub const io_uring_files_update = extern struct {
offset: u32,
resv: u32,
fds: u64,
};
pub const IO_URING_OP_SUPPORTED = 1 << 0;
pub const io_uring_probe_op = extern struct {
op: IORING_OP,
resv: u8,
/// IO_URING_OP_* flags
flags: u16,
resv2: u32,
};
pub const io_uring_probe = extern struct {
/// last opcode supported
last_op: IORING_OP,
/// Number of io_uring_probe_op following
ops_len: u8,
resv: u16,
resv2: u32[3],
// Followed by up to `ops_len` io_uring_probe_op structures
};
pub const io_uring_restriction = extern struct {
opcode: u16,
arg: extern union {
/// IORING_RESTRICTION_REGISTER_OP
register_op: IORING_REGISTER,
/// IORING_RESTRICTION_SQE_OP
sqe_op: IORING_OP,
/// IORING_RESTRICTION_SQE_FLAGS_*
sqe_flags: u8,
},
resv: u8,
resv2: u32[3],
};
/// io_uring_restriction->opcode values
pub const IORING_RESTRICTION = enum(u8) {
/// Allow an io_uring_register(2) opcode
REGISTER_OP = 0,
/// Allow an sqe opcode
SQE_OP = 1,
/// Allow sqe flags
SQE_FLAGS_ALLOWED = 2,
/// Require sqe flags (these flags must be set on each submission)
SQE_FLAGS_REQUIRED = 3,
_,
};
pub const utsname = extern struct {
sysname: [64:0]u8,
nodename: [64:0]u8,
release: [64:0]u8,
version: [64:0]u8,
machine: [64:0]u8,
domainname: [64:0]u8,
};
pub const HOST_NAME_MAX = 64;
pub const STATX_TYPE = 0x0001;
pub const STATX_MODE = 0x0002;
pub const STATX_NLINK = 0x0004;
pub const STATX_UID = 0x0008;
pub const STATX_GID = 0x0010;
pub const STATX_ATIME = 0x0020;
pub const STATX_MTIME = 0x0040;
pub const STATX_CTIME = 0x0080;
pub const STATX_INO = 0x0100;
pub const STATX_SIZE = 0x0200;
pub const STATX_BLOCKS = 0x0400;
pub const STATX_BASIC_STATS = 0x07ff;
pub const STATX_BTIME = 0x0800;
pub const STATX_ATTR_COMPRESSED = 0x0004;
pub const STATX_ATTR_IMMUTABLE = 0x0010;
pub const STATX_ATTR_APPEND = 0x0020;
pub const STATX_ATTR_NODUMP = 0x0040;
pub const STATX_ATTR_ENCRYPTED = 0x0800;
pub const STATX_ATTR_AUTOMOUNT = 0x1000;
pub const statx_timestamp = extern struct {
tv_sec: i64,
tv_nsec: u32,
__pad1: u32,
};
/// Renamed to `Statx` to not conflict with the `statx` function.
pub const Statx = extern struct {
/// Mask of bits indicating filled fields
mask: u32,
/// Block size for filesystem I/O
blksize: u32,
/// Extra file attribute indicators
attributes: u64,
/// Number of hard links
nlink: u32,
/// User ID of owner
uid: uid_t,
/// Group ID of owner
gid: gid_t,
/// File type and mode
mode: u16,
__pad1: u16,
/// Inode number
ino: u64,
/// Total size in bytes
size: u64,
/// Number of 512B blocks allocated
blocks: u64,
/// Mask to show what's supported in `attributes`.
attributes_mask: u64,
/// Last access file timestamp
atime: statx_timestamp,
/// Creation file timestamp
btime: statx_timestamp,
/// Last status change file timestamp
ctime: statx_timestamp,
/// Last modification file timestamp
mtime: statx_timestamp,
/// Major ID, if this file represents a device.
rdev_major: u32,
/// Minor ID, if this file represents a device.
rdev_minor: u32,
/// Major ID of the device containing the filesystem where this file resides.
dev_major: u32,
/// Minor ID of the device containing the filesystem where this file resides.
dev_minor: u32,
__pad2: [14]u64,
};
pub const addrinfo = extern struct {
flags: i32,
family: i32,
socktype: i32,
protocol: i32,
addrlen: socklen_t,
addr: ?*sockaddr,
canonname: ?[*:0]u8,
next: ?*addrinfo,
};
pub const IPPORT_RESERVED = 1024;
pub const IPPROTO = struct {
pub const IP = 0;
pub const HOPOPTS = 0;
pub const ICMP = 1;
pub const IGMP = 2;
pub const IPIP = 4;
pub const TCP = 6;
pub const EGP = 8;
pub const PUP = 12;
pub const UDP = 17;
pub const IDP = 22;
pub const TP = 29;
pub const DCCP = 33;
pub const IPV6 = 41;
pub const ROUTING = 43;
pub const FRAGMENT = 44;
pub const RSVP = 46;
pub const GRE = 47;
pub const ESP = 50;
pub const AH = 51;
pub const ICMPV6 = 58;
pub const NONE = 59;
pub const DSTOPTS = 60;
pub const MTP = 92;
pub const BEETPH = 94;
pub const ENCAP = 98;
pub const PIM = 103;
pub const COMP = 108;
pub const SCTP = 132;
pub const MH = 135;
pub const UDPLITE = 136;
pub const MPLS = 137;
pub const RAW = 255;
pub const MAX = 256;
};
pub const RR = struct {
pub const A = 1;
pub const CNAME = 5;
pub const AAAA = 28;
};
pub const tcp_repair_opt = extern struct {
opt_code: u32,
opt_val: u32,
};
pub const tcp_repair_window = extern struct {
snd_wl1: u32,
snd_wnd: u32,
max_window: u32,
rcv_wnd: u32,
rcv_wup: u32,
};
pub const TcpRepairOption = enum {
TCP_NO_QUEUE,
TCP_RECV_QUEUE,
TCP_SEND_QUEUE,
TCP_QUEUES_NR,
};
/// why fastopen failed from client perspective
pub const tcp_fastopen_client_fail = enum {
/// catch-all
TFO_STATUS_UNSPEC,
/// if not in TFO_CLIENT_NO_COOKIE mode
TFO_COOKIE_UNAVAILABLE,
/// SYN-ACK did not ack SYN data
TFO_DATA_NOT_ACKED,
/// SYN-ACK did not ack SYN data after timeout
TFO_SYN_RETRANSMITTED,
};
/// for TCP_INFO socket option
pub const TCPI_OPT_TIMESTAMPS = 1;
pub const TCPI_OPT_SACK = 2;
pub const TCPI_OPT_WSCALE = 4;
/// ECN was negociated at TCP session init
pub const TCPI_OPT_ECN = 8;
/// we received at least one packet with ECT
pub const TCPI_OPT_ECN_SEEN = 16;
/// SYN-ACK acked data in SYN sent or rcvd
pub const TCPI_OPT_SYN_DATA = 32;
pub const nfds_t = usize;
pub const pollfd = extern struct {
fd: fd_t,
events: i16,
revents: i16,
};
pub const POLL = struct {
pub const IN = 0x001;
pub const PRI = 0x002;
pub const OUT = 0x004;
pub const ERR = 0x008;
pub const HUP = 0x010;
pub const NVAL = 0x020;
pub const RDNORM = 0x040;
pub const RDBAND = 0x080;
};
pub const MFD_CLOEXEC = 0x0001;
pub const MFD_ALLOW_SEALING = 0x0002;
pub const MFD_HUGETLB = 0x0004;
pub const MFD_ALL_FLAGS = MFD_CLOEXEC | MFD_ALLOW_SEALING | MFD_HUGETLB;
pub const HUGETLB_FLAG_ENCODE_SHIFT = 26;
pub const HUGETLB_FLAG_ENCODE_MASK = 0x3f;
pub const HUGETLB_FLAG_ENCODE_64KB = 16 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_512KB = 19 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_1MB = 20 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_2MB = 21 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_8MB = 23 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_16MB = 24 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_32MB = 25 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_256MB = 28 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_512MB = 29 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_1GB = 30 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_2GB = 31 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const HUGETLB_FLAG_ENCODE_16GB = 34 << HUGETLB_FLAG_ENCODE_SHIFT;
pub const MFD_HUGE_SHIFT = HUGETLB_FLAG_ENCODE_SHIFT;
pub const MFD_HUGE_MASK = HUGETLB_FLAG_ENCODE_MASK;
pub const MFD_HUGE_64KB = HUGETLB_FLAG_ENCODE_64KB;
pub const MFD_HUGE_512KB = HUGETLB_FLAG_ENCODE_512KB;
pub const MFD_HUGE_1MB = HUGETLB_FLAG_ENCODE_1MB;
pub const MFD_HUGE_2MB = HUGETLB_FLAG_ENCODE_2MB;
pub const MFD_HUGE_8MB = HUGETLB_FLAG_ENCODE_8MB;
pub const MFD_HUGE_16MB = HUGETLB_FLAG_ENCODE_16MB;
pub const MFD_HUGE_32MB = HUGETLB_FLAG_ENCODE_32MB;
pub const MFD_HUGE_256MB = HUGETLB_FLAG_ENCODE_256MB;
pub const MFD_HUGE_512MB = HUGETLB_FLAG_ENCODE_512MB;
pub const MFD_HUGE_1GB = HUGETLB_FLAG_ENCODE_1GB;
pub const MFD_HUGE_2GB = HUGETLB_FLAG_ENCODE_2GB;
pub const MFD_HUGE_16GB = HUGETLB_FLAG_ENCODE_16GB;
pub const RUSAGE_SELF = 0;
pub const RUSAGE_CHILDREN = -1;
pub const RUSAGE_THREAD = 1;
pub const rusage = extern struct {
utime: timeval,
stime: timeval,
maxrss: isize,
ixrss: isize,
idrss: isize,
isrss: isize,
minflt: isize,
majflt: isize,
nswap: isize,
inblock: isize,
oublock: isize,
msgsnd: isize,
msgrcv: isize,
nsignals: isize,
nvcsw: isize,
nivcsw: isize,
__reserved: [16]isize = [1]isize{0} ** 16,
};
pub const cc_t = u8;
pub const speed_t = u32;
pub const tcflag_t = u32;
pub const NCCS = 32;
pub const B0 = 0o0000000;
pub const B50 = 0o0000001;
pub const B75 = 0o0000002;
pub const B110 = 0o0000003;
pub const B134 = 0o0000004;
pub const B150 = 0o0000005;
pub const B200 = 0o0000006;
pub const B300 = 0o0000007;
pub const B600 = 0o0000010;
pub const B1200 = 0o0000011;
pub const B1800 = 0o0000012;
pub const B2400 = 0o0000013;
pub const B4800 = 0o0000014;
pub const B9600 = 0o0000015;
pub const B19200 = 0o0000016;
pub const B38400 = 0o0000017;
pub const BOTHER = 0o0010000;
pub const B57600 = 0o0010001;
pub const B115200 = 0o0010002;
pub const B230400 = 0o0010003;
pub const B460800 = 0o0010004;
pub const B500000 = 0o0010005;
pub const B576000 = 0o0010006;
pub const B921600 = 0o0010007;
pub const B1000000 = 0o0010010;
pub const B1152000 = 0o0010011;
pub const B1500000 = 0o0010012;
pub const B2000000 = 0o0010013;
pub const B2500000 = 0o0010014;
pub const B3000000 = 0o0010015;
pub const B3500000 = 0o0010016;
pub const B4000000 = 0o0010017;
pub const V = switch (native_arch) {
.powerpc, .powerpc64, .powerpc64le => struct {
pub const INTR = 0;
pub const QUIT = 1;
pub const ERASE = 2;
pub const KILL = 3;
pub const EOF = 4;
pub const MIN = 5;
pub const EOL = 6;
pub const TIME = 7;
pub const EOL2 = 8;
pub const SWTC = 9;
pub const WERASE = 10;
pub const REPRINT = 11;
pub const SUSP = 12;
pub const START = 13;
pub const STOP = 14;
pub const LNEXT = 15;
pub const DISCARD = 16;
},
.sparc, .sparcv9 => struct {
pub const INTR = 0;
pub const QUIT = 1;
pub const ERASE = 2;
pub const KILL = 3;
pub const EOF = 4;
pub const EOL = 5;
pub const EOL2 = 6;
pub const SWTC = 7;
pub const START = 8;
pub const STOP = 9;
pub const SUSP = 10;
pub const DSUSP = 11;
pub const REPRINT = 12;
pub const DISCARD = 13;
pub const WERASE = 14;
pub const LNEXT = 15;
pub const MIN = EOF;
pub const TIME = EOL;
},
.mips, .mipsel, .mips64, .mips64el => struct {
pub const INTR = 0;
pub const QUIT = 1;
pub const ERASE = 2;
pub const KILL = 3;
pub const MIN = 4;
pub const TIME = 5;
pub const EOL2 = 6;
pub const SWTC = 7;
pub const SWTCH = 7;
pub const START = 8;
pub const STOP = 9;
pub const SUSP = 10;
pub const REPRINT = 12;
pub const DISCARD = 13;
pub const WERASE = 14;
pub const LNEXT = 15;
pub const EOF = 16;
pub const EOL = 17;
},
else => struct {
pub const INTR = 0;
pub const QUIT = 1;
pub const ERASE = 2;
pub const KILL = 3;
pub const EOF = 4;
pub const TIME = 5;
pub const MIN = 6;
pub const SWTC = 7;
pub const START = 8;
pub const STOP = 9;
pub const SUSP = 10;
pub const EOL = 11;
pub const REPRINT = 12;
pub const DISCARD = 13;
pub const WERASE = 14;
pub const LNEXT = 15;
pub const EOL2 = 16;
},
};
pub const IGNBRK = 1;
pub const BRKINT = 2;
pub const IGNPAR = 4;
pub const PARMRK = 8;
pub const INPCK = 16;
pub const ISTRIP = 32;
pub const INLCR = 64;
pub const IGNCR = 128;
pub const ICRNL = 256;
pub const IUCLC = 512;
pub const IXON = 1024;
pub const IXANY = 2048;
pub const IXOFF = 4096;
pub const IMAXBEL = 8192;
pub const IUTF8 = 16384;
pub const OPOST = 1;
pub const OLCUC = 2;
pub const ONLCR = 4;
pub const OCRNL = 8;
pub const ONOCR = 16;
pub const ONLRET = 32;
pub const OFILL = 64;
pub const OFDEL = 128;
pub const VTDLY = 16384;
pub const VT0 = 0;
pub const VT1 = 16384;
pub const CSIZE = 48;
pub const CS5 = 0;
pub const CS6 = 16;
pub const CS7 = 32;
pub const CS8 = 48;
pub const CSTOPB = 64;
pub const CREAD = 128;
pub const PARENB = 256;
pub const PARODD = 512;
pub const HUPCL = 1024;
pub const CLOCAL = 2048;
pub const ISIG = 1;
pub const ICANON = 2;
pub const ECHO = 8;
pub const ECHOE = 16;
pub const ECHOK = 32;
pub const ECHONL = 64;
pub const NOFLSH = 128;
pub const TOSTOP = 256;
pub const IEXTEN = 32768;
pub const TCSA = enum(c_uint) {
NOW,
DRAIN,
FLUSH,
_,
};
pub const termios = extern struct {
iflag: tcflag_t,
oflag: tcflag_t,
cflag: tcflag_t,
lflag: tcflag_t,
line: cc_t,
cc: [NCCS]cc_t,
ispeed: speed_t,
ospeed: speed_t,
};
pub const SIOCGIFINDEX = 0x8933;
pub const IFNAMESIZE = 16;
pub const ifmap = extern struct {
mem_start: u32,
mem_end: u32,
base_addr: u16,
irq: u8,
dma: u8,
port: u8,
};
pub const ifreq = extern struct {
ifrn: extern union {
name: [IFNAMESIZE]u8,
},
ifru: extern union {
addr: sockaddr,
dstaddr: sockaddr,
broadaddr: sockaddr,
netmask: sockaddr,
hwaddr: sockaddr,
flags: i16,
ivalue: i32,
mtu: i32,
map: ifmap,
slave: [IFNAMESIZE - 1:0]u8,
newname: [IFNAMESIZE - 1:0]u8,
data: ?[*]u8,
},
};
// doc comments copied from musl
pub const rlimit_resource = enum(c_int) {
/// Per-process CPU limit, in seconds.
CPU,
/// Largest file that can be created, in bytes.
FSIZE,
/// Maximum size of data segment, in bytes.
DATA,
/// Maximum size of stack segment, in bytes.
STACK,
/// Largest core file that can be created, in bytes.
CORE,
/// Largest resident set size, in bytes.
/// This affects swapping; processes that are exceeding their
/// resident set size will be more likely to have physical memory
/// taken from them.
RSS,
/// Number of processes.
NPROC,
/// Number of open files.
NOFILE,
/// Locked-in-memory address space.
MEMLOCK,
/// Address space limit.
AS,
/// Maximum number of file locks.
LOCKS,
/// Maximum number of pending signals.
SIGPENDING,
/// Maximum bytes in POSIX message queues.
MSGQUEUE,
/// Maximum nice priority allowed to raise to.
/// Nice levels 19 .. -20 correspond to 0 .. 39
/// values of this resource limit.
NICE,
/// Maximum realtime priority allowed for non-priviledged
/// processes.
RTPRIO,
/// Maximum CPU time in µs that a process scheduled under a real-time
/// scheduling policy may consume without making a blocking system
/// call before being forcibly descheduled.
RTTIME,
_,
};
pub const rlim_t = u64;
pub const RLIM = struct {
/// No limit
pub const INFINITY = ~@as(rlim_t, 0);
pub const SAVED_MAX = INFINITY;
pub const SAVED_CUR = INFINITY;
};
pub const rlimit = extern struct {
/// Soft limit
cur: rlim_t,
/// Hard limit
max: rlim_t,
};
pub const MADV = struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
pub const SEQUENTIAL = 2;
pub const WILLNEED = 3;
pub const DONTNEED = 4;
pub const FREE = 8;
pub const REMOVE = 9;
pub const DONTFORK = 10;
pub const DOFORK = 11;
pub const MERGEABLE = 12;
pub const UNMERGEABLE = 13;
pub const HUGEPAGE = 14;
pub const NOHUGEPAGE = 15;
pub const DONTDUMP = 16;
pub const DODUMP = 17;
pub const WIPEONFORK = 18;
pub const KEEPONFORK = 19;
pub const COLD = 20;
pub const PAGEOUT = 21;
pub const HWPOISON = 100;
pub const SOFT_OFFLINE = 101;
};
pub const POSIX_FADV = switch (native_arch) {
.s390x => if (@typeInfo(usize).Int.bits == 64) struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
pub const SEQUENTIAL = 2;
pub const WILLNEED = 3;
pub const DONTNEED = 6;
pub const NOREUSE = 7;
} else struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
pub const SEQUENTIAL = 2;
pub const WILLNEED = 3;
pub const DONTNEED = 4;
pub const NOREUSE = 5;
},
else => struct {
pub const NORMAL = 0;
pub const RANDOM = 1;
pub const SEQUENTIAL = 2;
pub const WILLNEED = 3;
pub const DONTNEED = 4;
pub const NOREUSE = 5;
},
};
/// The timespec struct used by the kernel.
pub const kernel_timespec = if (@sizeOf(usize) >= 8) timespec else extern struct {
tv_sec: i64,
tv_nsec: i64,
};
pub const timespec = extern struct {
tv_sec: isize,
tv_nsec: isize,
};
pub const XDP = struct {
pub const SHARED_UMEM = (1 << 0);
pub const COPY = (1 << 1);
pub const ZEROCOPY = (1 << 2);
pub const UMEM_UNALIGNED_CHUNK_FLAG = (1 << 0);
pub const USE_NEED_WAKEUP = (1 << 3);
pub const MMAP_OFFSETS = 1;
pub const RX_RING = 2;
pub const TX_RING = 3;
pub const UMEM_REG = 4;
pub const UMEM_FILL_RING = 5;
pub const UMEM_COMPLETION_RING = 6;
pub const STATISTICS = 7;
pub const OPTIONS = 8;
pub const OPTIONS_ZEROCOPY = (1 << 0);
pub const PGOFF_RX_RING = 0;
pub const PGOFF_TX_RING = 0x80000000;
pub const UMEM_PGOFF_FILL_RING = 0x100000000;
pub const UMEM_PGOFF_COMPLETION_RING = 0x180000000;
};
pub const xdp_ring_offset = extern struct {
producer: u64,
consumer: u64,
desc: u64,
flags: u64,
};
pub const xdp_mmap_offsets = extern struct {
rx: xdp_ring_offset,
tx: xdp_ring_offset,
fr: xdp_ring_offset,
cr: xdp_ring_offset,
};
pub const xdp_umem_reg = extern struct {
addr: u64,
len: u64,
chunk_size: u32,
headroom: u32,
flags: u32,
};
pub const xdp_statistics = extern struct {
rx_dropped: u64,
rx_invalid_descs: u64,
tx_invalid_descs: u64,
rx_ring_full: u64,
rx_fill_ring_empty_descs: u64,
tx_ring_empty_descs: u64,
};
pub const xdp_options = extern struct {
flags: u32,
};
pub const XSK_UNALIGNED_BUF_OFFSET_SHIFT = 48;
pub const XSK_UNALIGNED_BUF_ADDR_MASK = (1 << XSK_UNALIGNED_BUF_OFFSET_SHIFT) - 1;
pub const xdp_desc = extern struct {
addr: u64,
len: u32,
options: u32,
};
fn issecure_mask(comptime x: comptime_int) comptime_int {
return 1 << x;
}
pub const SECUREBITS_DEFAULT = 0x00000000;
pub const SECURE_NOROOT = 0;
pub const SECURE_NOROOT_LOCKED = 1;
pub const SECBIT_NOROOT = issecure_mask(SECURE_NOROOT);
pub const SECBIT_NOROOT_LOCKED = issecure_mask(SECURE_NOROOT_LOCKED);
pub const SECURE_NO_SETUID_FIXUP = 2;
pub const SECURE_NO_SETUID_FIXUP_LOCKED = 3;
pub const SECBIT_NO_SETUID_FIXUP = issecure_mask(SECURE_NO_SETUID_FIXUP);
pub const SECBIT_NO_SETUID_FIXUP_LOCKED = issecure_mask(SECURE_NO_SETUID_FIXUP_LOCKED);
pub const SECURE_KEEP_CAPS = 4;
pub const SECURE_KEEP_CAPS_LOCKED = 5;
pub const SECBIT_KEEP_CAPS = issecure_mask(SECURE_KEEP_CAPS);
pub const SECBIT_KEEP_CAPS_LOCKED = issecure_mask(SECURE_KEEP_CAPS_LOCKED);
pub const SECURE_NO_CAP_AMBIENT_RAISE = 6;
pub const SECURE_NO_CAP_AMBIENT_RAISE_LOCKED = 7;
pub const SECBIT_NO_CAP_AMBIENT_RAISE = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE);
pub const SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED = issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE_LOCKED);
pub const SECURE_ALL_BITS = issecure_mask(SECURE_NOROOT) |
issecure_mask(SECURE_NO_SETUID_FIXUP) |
issecure_mask(SECURE_KEEP_CAPS) |
issecure_mask(SECURE_NO_CAP_AMBIENT_RAISE);
pub const SECURE_ALL_LOCKS = SECURE_ALL_BITS << 1;
pub const PR = enum(i32) {
SET_PDEATHSIG = 1,
GET_PDEATHSIG = 2,
GET_DUMPABLE = 3,
SET_DUMPABLE = 4,
GET_UNALIGN = 5,
SET_UNALIGN = 6,
GET_KEEPCAPS = 7,
SET_KEEPCAPS = 8,
GET_FPEMU = 9,
SET_FPEMU = 10,
GET_FPEXC = 11,
SET_FPEXC = 12,
GET_TIMING = 13,
SET_TIMING = 14,
SET_NAME = 15,
GET_NAME = 16,
GET_ENDIAN = 19,
SET_ENDIAN = 20,
GET_SECCOMP = 21,
SET_SECCOMP = 22,
CAPBSET_READ = 23,
CAPBSET_DROP = 24,
GET_TSC = 25,
SET_TSC = 26,
GET_SECUREBITS = 27,
SET_SECUREBITS = 28,
SET_TIMERSLACK = 29,
GET_TIMERSLACK = 30,
TASK_PERF_EVENTS_DISABLE = 31,
TASK_PERF_EVENTS_ENABLE = 32,
MCE_KILL = 33,
MCE_KILL_GET = 34,
SET_MM = 35,
SET_PTRACER = 0x59616d61,
SET_CHILD_SUBREAPER = 36,
GET_CHILD_SUBREAPER = 37,
SET_NO_NEW_PRIVS = 38,
GET_NO_NEW_PRIVS = 39,
GET_TID_ADDRESS = 40,
SET_THP_DISABLE = 41,
GET_THP_DISABLE = 42,
MPX_ENABLE_MANAGEMENT = 43,
MPX_DISABLE_MANAGEMENT = 44,
SET_FP_MODE = 45,
GET_FP_MODE = 46,
CAP_AMBIENT = 47,
SVE_SET_VL = 50,
SVE_GET_VL = 51,
GET_SPECULATION_CTRL = 52,
SET_SPECULATION_CTRL = 53,
_,
pub const UNALIGN_NOPRINT = 1;
pub const UNALIGN_SIGBUS = 2;
pub const FPEMU_NOPRINT = 1;
pub const FPEMU_SIGFPE = 2;
pub const FP_EXC_SW_ENABLE = 0x80;
pub const FP_EXC_DIV = 0x010000;
pub const FP_EXC_OVF = 0x020000;
pub const FP_EXC_UND = 0x040000;
pub const FP_EXC_RES = 0x080000;
pub const FP_EXC_INV = 0x100000;
pub const FP_EXC_DISABLED = 0;
pub const FP_EXC_NONRECOV = 1;
pub const FP_EXC_ASYNC = 2;
pub const FP_EXC_PRECISE = 3;
pub const TIMING_STATISTICAL = 0;
pub const TIMING_TIMESTAMP = 1;
pub const ENDIAN_BIG = 0;
pub const ENDIAN_LITTLE = 1;
pub const ENDIAN_PPC_LITTLE = 2;
pub const TSC_ENABLE = 1;
pub const TSC_SIGSEGV = 2;
pub const MCE_KILL_CLEAR = 0;
pub const MCE_KILL_SET = 1;
pub const MCE_KILL_LATE = 0;
pub const MCE_KILL_EARLY = 1;
pub const MCE_KILL_DEFAULT = 2;
pub const SET_MM_START_CODE = 1;
pub const SET_MM_END_CODE = 2;
pub const SET_MM_START_DATA = 3;
pub const SET_MM_END_DATA = 4;
pub const SET_MM_START_STACK = 5;
pub const SET_MM_START_BRK = 6;
pub const SET_MM_BRK = 7;
pub const SET_MM_ARG_START = 8;
pub const SET_MM_ARG_END = 9;
pub const SET_MM_ENV_START = 10;
pub const SET_MM_ENV_END = 11;
pub const SET_MM_AUXV = 12;
pub const SET_MM_EXE_FILE = 13;
pub const SET_MM_MAP = 14;
pub const SET_MM_MAP_SIZE = 15;
pub const SET_PTRACER_ANY = std.math.maxInt(c_ulong);
pub const FP_MODE_FR = 1 << 0;
pub const FP_MODE_FRE = 1 << 1;
pub const CAP_AMBIENT_IS_SET = 1;
pub const CAP_AMBIENT_RAISE = 2;
pub const CAP_AMBIENT_LOWER = 3;
pub const CAP_AMBIENT_CLEAR_ALL = 4;
pub const SVE_SET_VL_ONEXEC = 1 << 18;
pub const SVE_VL_LEN_MASK = 0xffff;
pub const SVE_VL_INHERIT = 1 << 17;
pub const SPEC_STORE_BYPASS = 0;
pub const SPEC_NOT_AFFECTED = 0;
pub const SPEC_PRCTL = 1 << 0;
pub const SPEC_ENABLE = 1 << 1;
pub const SPEC_DISABLE = 1 << 2;
pub const SPEC_FORCE_DISABLE = 1 << 3;
};
pub const prctl_mm_map = extern struct {
start_code: u64,
end_code: u64,
start_data: u64,
end_data: u64,
start_brk: u64,
brk: u64,
start_stack: u64,
arg_start: u64,
arg_end: u64,
env_start: u64,
env_end: u64,
auxv: *u64,
auxv_size: u32,
exe_fd: u32,
};
pub const NETLINK = struct {
/// Routing/device hook
pub const ROUTE = 0;
/// Unused number
pub const UNUSED = 1;
/// Reserved for user mode socket protocols
pub const USERSOCK = 2;
/// Unused number, formerly ip_queue
pub const FIREWALL = 3;
/// socket monitoring
pub const SOCK_DIAG = 4;
/// netfilter/iptables ULOG
pub const NFLOG = 5;
/// ipsec
pub const XFRM = 6;
/// SELinux event notifications
pub const SELINUX = 7;
/// Open-iSCSI
pub const ISCSI = 8;
/// auditing
pub const AUDIT = 9;
pub const FIB_LOOKUP = 10;
pub const CONNECTOR = 11;
/// netfilter subsystem
pub const NETFILTER = 12;
pub const IP6_FW = 13;
/// DECnet routing messages
pub const DNRTMSG = 14;
/// Kernel messages to userspace
pub const KOBJECT_UEVENT = 15;
pub const GENERIC = 16;
// leave room for NETLINK_DM (DM Events)
/// SCSI Transports
pub const SCSITRANSPORT = 18;
pub const ECRYPTFS = 19;
pub const RDMA = 20;
/// Crypto layer
pub const CRYPTO = 21;
/// SMC monitoring
pub const SMC = 22;
};
// Flags values
/// It is request message.
pub const NLM_F_REQUEST = 0x01;
/// Multipart message, terminated by NLMSG_DONE
pub const NLM_F_MULTI = 0x02;
/// Reply with ack, with zero or error code
pub const NLM_F_ACK = 0x04;
/// Echo this request
pub const NLM_F_ECHO = 0x08;
/// Dump was inconsistent due to sequence change
pub const NLM_F_DUMP_INTR = 0x10;
/// Dump was filtered as requested
pub const NLM_F_DUMP_FILTERED = 0x20;
// Modifiers to GET request
/// specify tree root
pub const NLM_F_ROOT = 0x100;
/// return all matching
pub const NLM_F_MATCH = 0x200;
/// atomic GET
pub const NLM_F_ATOMIC = 0x400;
pub const NLM_F_DUMP = NLM_F_ROOT | NLM_F_MATCH;
// Modifiers to NEW request
/// Override existing
pub const NLM_F_REPLACE = 0x100;
/// Do not touch, if it exists
pub const NLM_F_EXCL = 0x200;
/// Create, if it does not exist
pub const NLM_F_CREATE = 0x400;
/// Add to end of list
pub const NLM_F_APPEND = 0x800;
// Modifiers to DELETE request
/// Do not delete recursively
pub const NLM_F_NONREC = 0x100;
// Flags for ACK message
/// request was capped
pub const NLM_F_CAPPED = 0x100;
/// extended ACK TVLs were included
pub const NLM_F_ACK_TLVS = 0x200;
pub const NetlinkMessageType = enum(u16) {
/// < 0x10: reserved control messages
pub const MIN_TYPE = 0x10;
/// Nothing.
NOOP = 0x1,
/// Error
ERROR = 0x2,
/// End of a dump
DONE = 0x3,
/// Data lost
OVERRUN = 0x4,
// rtlink types
RTM_NEWLINK = 16,
RTM_DELLINK,
RTM_GETLINK,
RTM_SETLINK,
RTM_NEWADDR = 20,
RTM_DELADDR,
RTM_GETADDR,
RTM_NEWROUTE = 24,
RTM_DELROUTE,
RTM_GETROUTE,
RTM_NEWNEIGH = 28,
RTM_DELNEIGH,
RTM_GETNEIGH,
RTM_NEWRULE = 32,
RTM_DELRULE,
RTM_GETRULE,
RTM_NEWQDISC = 36,
RTM_DELQDISC,
RTM_GETQDISC,
RTM_NEWTCLASS = 40,
RTM_DELTCLASS,
RTM_GETTCLASS,
RTM_NEWTFILTER = 44,
RTM_DELTFILTER,
RTM_GETTFILTER,
RTM_NEWACTION = 48,
RTM_DELACTION,
RTM_GETACTION,
RTM_NEWPREFIX = 52,
RTM_GETMULTICAST = 58,
RTM_GETANYCAST = 62,
RTM_NEWNEIGHTBL = 64,
RTM_GETNEIGHTBL = 66,
RTM_SETNEIGHTBL,
RTM_NEWNDUSEROPT = 68,
RTM_NEWADDRLABEL = 72,
RTM_DELADDRLABEL,
RTM_GETADDRLABEL,
RTM_GETDCB = 78,
RTM_SETDCB,
RTM_NEWNETCONF = 80,
RTM_DELNETCONF,
RTM_GETNETCONF = 82,
RTM_NEWMDB = 84,
RTM_DELMDB = 85,
RTM_GETMDB = 86,
RTM_NEWNSID = 88,
RTM_DELNSID = 89,
RTM_GETNSID = 90,
RTM_NEWSTATS = 92,
RTM_GETSTATS = 94,
RTM_NEWCACHEREPORT = 96,
RTM_NEWCHAIN = 100,
RTM_DELCHAIN,
RTM_GETCHAIN,
RTM_NEWNEXTHOP = 104,
RTM_DELNEXTHOP,
RTM_GETNEXTHOP,
_,
};
/// Netlink message header
/// Specified in RFC 3549 Section 2.3.2
pub const nlmsghdr = extern struct {
/// Length of message including header
len: u32,
/// Message content
type: NetlinkMessageType,
/// Additional flags
flags: u16,
/// Sequence number
seq: u32,
/// Sending process port ID
pid: u32,
};
pub const ifinfomsg = extern struct {
family: u8,
__pad1: u8 = 0,
/// ARPHRD_*
type: c_ushort,
/// Link index
index: c_int,
/// IFF_* flags
flags: c_uint,
/// IFF_* change mask
change: c_uint,
};
pub const rtattr = extern struct {
/// Length of option
len: c_ushort,
/// Type of option
type: IFLA,
pub const ALIGNTO = 4;
};
pub const IFLA = enum(c_ushort) {
UNSPEC,
ADDRESS,
BROADCAST,
IFNAME,
MTU,
LINK,
QDISC,
STATS,
COST,
PRIORITY,
MASTER,
/// Wireless Extension event
WIRELESS,
/// Protocol specific information for a link
PROTINFO,
TXQLEN,
MAP,
WEIGHT,
OPERSTATE,
LINKMODE,
LINKINFO,
NET_NS_PID,
IFALIAS,
/// Number of VFs if device is SR-IOV PF
NUM_VF,
VFINFO_LIST,
STATS64,
VF_PORTS,
PORT_SELF,
AF_SPEC,
/// Group the device belongs to
GROUP,
NET_NS_FD,
/// Extended info mask, VFs, etc
EXT_MASK,
/// Promiscuity count: > 0 means acts PROMISC
PROMISCUITY,
NUM_TX_QUEUES,
NUM_RX_QUEUES,
CARRIER,
PHYS_PORT_ID,
CARRIER_CHANGES,
PHYS_SWITCH_ID,
LINK_NETNSID,
PHYS_PORT_NAME,
PROTO_DOWN,
GSO_MAX_SEGS,
GSO_MAX_SIZE,
PAD,
XDP,
EVENT,
NEW_NETNSID,
IF_NETNSID,
CARRIER_UP_COUNT,
CARRIER_DOWN_COUNT,
NEW_IFINDEX,
MIN_MTU,
MAX_MTU,
_,
pub const TARGET_NETNSID: IFLA = .IF_NETNSID;
};
pub const rtnl_link_ifmap = extern struct {
mem_start: u64,
mem_end: u64,
base_addr: u64,
irq: u16,
dma: u8,
port: u8,
};
pub const rtnl_link_stats = extern struct {
/// total packets received
rx_packets: u32,
/// total packets transmitted
tx_packets: u32,
/// total bytes received
rx_bytes: u32,
/// total bytes transmitted
tx_bytes: u32,
/// bad packets received
rx_errors: u32,
/// packet transmit problems
tx_errors: u32,
/// no space in linux buffers
rx_dropped: u32,
/// no space available in linux
tx_dropped: u32,
/// multicast packets received
multicast: u32,
collisions: u32,
// detailed rx_errors
rx_length_errors: u32,
/// receiver ring buff overflow
rx_over_errors: u32,
/// recved pkt with crc error
rx_crc_errors: u32,
/// recv'd frame alignment error
rx_frame_errors: u32,
/// recv'r fifo overrun
rx_fifo_errors: u32,
/// receiver missed packet
rx_missed_errors: u32,
// detailed tx_errors
tx_aborted_errors: u32,
tx_carrier_errors: u32,
tx_fifo_errors: u32,
tx_heartbeat_errors: u32,
tx_window_errors: u32,
// for cslip etc
rx_compressed: u32,
tx_compressed: u32,
/// dropped, no handler found
rx_nohandler: u32,
};
pub const rtnl_link_stats64 = extern struct {
/// total packets received
rx_packets: u64,
/// total packets transmitted
tx_packets: u64,
/// total bytes received
rx_bytes: u64,
/// total bytes transmitted
tx_bytes: u64,
/// bad packets received
rx_errors: u64,
/// packet transmit problems
tx_errors: u64,
/// no space in linux buffers
rx_dropped: u64,
/// no space available in linux
tx_dropped: u64,
/// multicast packets received
multicast: u64,
collisions: u64,
// detailed rx_errors
rx_length_errors: u64,
/// receiver ring buff overflow
rx_over_errors: u64,
/// recved pkt with crc error
rx_crc_errors: u64,
/// recv'd frame alignment error
rx_frame_errors: u64,
/// recv'r fifo overrun
rx_fifo_errors: u64,
/// receiver missed packet
rx_missed_errors: u64,
// detailed tx_errors
tx_aborted_errors: u64,
tx_carrier_errors: u64,
tx_fifo_errors: u64,
tx_heartbeat_errors: u64,
tx_window_errors: u64,
// for cslip etc
rx_compressed: u64,
tx_compressed: u64,
/// dropped, no handler found
rx_nohandler: u64,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows.zig | //! This file contains thin wrappers around Windows-specific APIs, with these
//! specific goals in mind:
//! * Convert "errno"-style error codes into Zig errors.
//! * When null-terminated or UTF16LE byte buffers are required, provide APIs which accept
//! slices as well as APIs which accept null-terminated UTF16LE byte buffers.
const builtin = @import("builtin");
const std = @import("../std.zig");
const mem = std.mem;
const assert = std.debug.assert;
const math = std.math;
const maxInt = std.math.maxInt;
const native_arch = builtin.cpu.arch;
test {
if (builtin.os.tag == .windows) {
_ = @import("windows/test.zig");
}
}
pub const advapi32 = @import("windows/advapi32.zig");
pub const kernel32 = @import("windows/kernel32.zig");
pub const ntdll = @import("windows/ntdll.zig");
pub const ole32 = @import("windows/ole32.zig");
pub const psapi = @import("windows/psapi.zig");
pub const shell32 = @import("windows/shell32.zig");
pub const user32 = @import("windows/user32.zig");
pub const ws2_32 = @import("windows/ws2_32.zig");
pub const gdi32 = @import("windows/gdi32.zig");
pub const winmm = @import("windows/winmm.zig");
pub const self_process_handle = @as(HANDLE, @ptrFromInt(maxInt(usize)));
pub const OpenError = error{
IsDir,
NotDir,
FileNotFound,
NoDevice,
AccessDenied,
PipeBusy,
PathAlreadyExists,
Unexpected,
NameTooLong,
WouldBlock,
};
pub const OpenFileOptions = struct {
access_mask: ACCESS_MASK,
dir: ?HANDLE = null,
sa: ?*SECURITY_ATTRIBUTES = null,
share_access: ULONG = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE,
creation: ULONG,
io_mode: std.io.ModeOverride,
/// If true, tries to open path as a directory.
/// Defaults to false.
open_dir: bool = false,
/// If false, tries to open path as a reparse point without dereferencing it.
/// Defaults to true.
follow_symlinks: bool = true,
};
pub fn OpenFile(sub_path_w: []const u16, options: OpenFileOptions) OpenError!HANDLE {
if (mem.eql(u16, sub_path_w, &[_]u16{'.'}) and !options.open_dir) {
return error.IsDir;
}
if (mem.eql(u16, sub_path_w, &[_]u16{ '.', '.' }) and !options.open_dir) {
return error.IsDir;
}
var result: HANDLE = undefined;
const path_len_bytes = math.cast(u16, sub_path_w.len * 2) catch |err| switch (err) {
error.Overflow => return error.NameTooLong,
};
var nt_name = UNICODE_STRING{
.Length = path_len_bytes,
.MaximumLength = path_len_bytes,
.Buffer = @as([*]u16, @ptrFromInt(@intFromPtr(sub_path_w.ptr))),
};
var attr = OBJECT_ATTRIBUTES{
.Length = @sizeOf(OBJECT_ATTRIBUTES),
.RootDirectory = if (std.fs.path.isAbsoluteWindowsWTF16(sub_path_w)) null else options.dir,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = if (options.sa) |ptr| ptr.lpSecurityDescriptor else null,
.SecurityQualityOfService = null,
};
var io: IO_STATUS_BLOCK = undefined;
const blocking_flag: ULONG = if (options.io_mode == .blocking) FILE_SYNCHRONOUS_IO_NONALERT else 0;
const file_or_dir_flag: ULONG = if (options.open_dir) FILE_DIRECTORY_FILE else FILE_NON_DIRECTORY_FILE;
// If we're not following symlinks, we need to ensure we don't pass in any synchronization flags such as FILE_SYNCHRONOUS_IO_NONALERT.
const flags: ULONG = if (options.follow_symlinks) file_or_dir_flag | blocking_flag else file_or_dir_flag | FILE_OPEN_REPARSE_POINT;
const rc = ntdll.NtCreateFile(
&result,
options.access_mask,
&attr,
&io,
null,
FILE_ATTRIBUTE_NORMAL,
options.share_access,
options.creation,
flags,
null,
0,
);
switch (rc) {
.SUCCESS => {
if (std.io.is_async and options.io_mode == .evented) {
_ = CreateIoCompletionPort(result, std.event.Loop.instance.?.os_data.io_port, undefined, undefined) catch undefined;
}
return result;
},
.OBJECT_NAME_INVALID => unreachable,
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
.NO_MEDIA_IN_DEVICE => return error.NoDevice,
.INVALID_PARAMETER => unreachable,
.SHARING_VIOLATION => return error.AccessDenied,
.ACCESS_DENIED => return error.AccessDenied,
.PIPE_BUSY => return error.PipeBusy,
.OBJECT_PATH_SYNTAX_BAD => unreachable,
.OBJECT_NAME_COLLISION => return error.PathAlreadyExists,
.FILE_IS_A_DIRECTORY => return error.IsDir,
.NOT_A_DIRECTORY => return error.NotDir,
else => return unexpectedStatus(rc),
}
}
pub const CreatePipeError = error{Unexpected};
pub fn CreatePipe(rd: *HANDLE, wr: *HANDLE, sattr: *const SECURITY_ATTRIBUTES) CreatePipeError!void {
if (kernel32.CreatePipe(rd, wr, sattr, 0) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub fn CreateEventEx(attributes: ?*SECURITY_ATTRIBUTES, name: []const u8, flags: DWORD, desired_access: DWORD) !HANDLE {
const nameW = try sliceToPrefixedFileW(name);
return CreateEventExW(attributes, nameW.span().ptr, flags, desired_access);
}
pub fn CreateEventExW(attributes: ?*SECURITY_ATTRIBUTES, nameW: [*:0]const u16, flags: DWORD, desired_access: DWORD) !HANDLE {
const handle = kernel32.CreateEventExW(attributes, nameW, flags, desired_access);
if (handle) |h| {
return h;
} else {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub const DeviceIoControlError = error{ AccessDenied, Unexpected };
/// A Zig wrapper around `NtDeviceIoControlFile` and `NtFsControlFile` syscalls.
/// It implements similar behavior to `DeviceIoControl` and is meant to serve
/// as a direct substitute for that call.
/// TODO work out if we need to expose other arguments to the underlying syscalls.
pub fn DeviceIoControl(
h: HANDLE,
ioControlCode: ULONG,
in: ?[]const u8,
out: ?[]u8,
) DeviceIoControlError!void {
// Logic from: https://doxygen.reactos.org/d3/d74/deviceio_8c.html
const is_fsctl = (ioControlCode >> 16) == FILE_DEVICE_FILE_SYSTEM;
var io: IO_STATUS_BLOCK = undefined;
const in_ptr = if (in) |i| i.ptr else null;
const in_len = if (in) |i| @as(ULONG, @intCast(i.len)) else 0;
const out_ptr = if (out) |o| o.ptr else null;
const out_len = if (out) |o| @as(ULONG, @intCast(o.len)) else 0;
const rc = blk: {
if (is_fsctl) {
break :blk ntdll.NtFsControlFile(
h,
null,
null,
null,
&io,
ioControlCode,
in_ptr,
in_len,
out_ptr,
out_len,
);
} else {
break :blk ntdll.NtDeviceIoControlFile(
h,
null,
null,
null,
&io,
ioControlCode,
in_ptr,
in_len,
out_ptr,
out_len,
);
}
};
switch (rc) {
.SUCCESS => {},
.PRIVILEGE_NOT_HELD => return error.AccessDenied,
.ACCESS_DENIED => return error.AccessDenied,
.INVALID_PARAMETER => unreachable,
else => return unexpectedStatus(rc),
}
}
pub fn GetOverlappedResult(h: HANDLE, overlapped: *OVERLAPPED, wait: bool) !DWORD {
var bytes: DWORD = undefined;
if (kernel32.GetOverlappedResult(h, overlapped, &bytes, @intFromBool(wait)) == 0) {
switch (kernel32.GetLastError()) {
.IO_INCOMPLETE => if (!wait) return error.WouldBlock else unreachable,
else => |err| return unexpectedError(err),
}
}
return bytes;
}
pub const SetHandleInformationError = error{Unexpected};
pub fn SetHandleInformation(h: HANDLE, mask: DWORD, flags: DWORD) SetHandleInformationError!void {
if (kernel32.SetHandleInformation(h, mask, flags) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub const RtlGenRandomError = error{Unexpected};
/// Call RtlGenRandom() instead of CryptGetRandom() on Windows
/// https://github.com/rust-lang-nursery/rand/issues/111
/// https://bugzilla.mozilla.org/show_bug.cgi?id=504270
pub fn RtlGenRandom(output: []u8) RtlGenRandomError!void {
var total_read: usize = 0;
var buff: []u8 = output[0..];
const max_read_size: ULONG = maxInt(ULONG);
while (total_read < output.len) {
const to_read: ULONG = math.min(buff.len, max_read_size);
if (advapi32.RtlGenRandom(buff.ptr, to_read) == 0) {
return unexpectedError(kernel32.GetLastError());
}
total_read += to_read;
buff = buff[to_read..];
}
}
pub const WaitForSingleObjectError = error{
WaitAbandoned,
WaitTimeOut,
Unexpected,
};
pub fn WaitForSingleObject(handle: HANDLE, milliseconds: DWORD) WaitForSingleObjectError!void {
return WaitForSingleObjectEx(handle, milliseconds, false);
}
pub fn WaitForSingleObjectEx(handle: HANDLE, milliseconds: DWORD, alertable: bool) WaitForSingleObjectError!void {
switch (kernel32.WaitForSingleObjectEx(handle, milliseconds, @intFromBool(alertable))) {
WAIT_ABANDONED => return error.WaitAbandoned,
WAIT_OBJECT_0 => return,
WAIT_TIMEOUT => return error.WaitTimeOut,
WAIT_FAILED => switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
},
else => return error.Unexpected,
}
}
pub fn WaitForMultipleObjectsEx(handles: []const HANDLE, waitAll: bool, milliseconds: DWORD, alertable: bool) !u32 {
assert(handles.len < MAXIMUM_WAIT_OBJECTS);
const nCount: DWORD = @as(DWORD, @intCast(handles.len));
switch (kernel32.WaitForMultipleObjectsEx(
nCount,
handles.ptr,
@intFromBool(waitAll),
milliseconds,
@intFromBool(alertable),
)) {
WAIT_OBJECT_0...WAIT_OBJECT_0 + MAXIMUM_WAIT_OBJECTS => |n| {
const handle_index = n - WAIT_OBJECT_0;
assert(handle_index < nCount);
return handle_index;
},
WAIT_ABANDONED_0...WAIT_ABANDONED_0 + MAXIMUM_WAIT_OBJECTS => |n| {
const handle_index = n - WAIT_ABANDONED_0;
assert(handle_index < nCount);
return error.WaitAbandoned;
},
WAIT_TIMEOUT => return error.WaitTimeOut,
WAIT_FAILED => switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
},
else => return error.Unexpected,
}
}
pub const CreateIoCompletionPortError = error{Unexpected};
pub fn CreateIoCompletionPort(
file_handle: HANDLE,
existing_completion_port: ?HANDLE,
completion_key: usize,
concurrent_thread_count: DWORD,
) CreateIoCompletionPortError!HANDLE {
const handle = kernel32.CreateIoCompletionPort(file_handle, existing_completion_port, completion_key, concurrent_thread_count) orelse {
switch (kernel32.GetLastError()) {
.INVALID_PARAMETER => unreachable,
else => |err| return unexpectedError(err),
}
};
return handle;
}
pub const PostQueuedCompletionStatusError = error{Unexpected};
pub fn PostQueuedCompletionStatus(
completion_port: HANDLE,
bytes_transferred_count: DWORD,
completion_key: usize,
lpOverlapped: ?*OVERLAPPED,
) PostQueuedCompletionStatusError!void {
if (kernel32.PostQueuedCompletionStatus(completion_port, bytes_transferred_count, completion_key, lpOverlapped) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub const GetQueuedCompletionStatusResult = enum {
Normal,
Aborted,
Cancelled,
EOF,
};
pub fn GetQueuedCompletionStatus(
completion_port: HANDLE,
bytes_transferred_count: *DWORD,
lpCompletionKey: *usize,
lpOverlapped: *?*OVERLAPPED,
dwMilliseconds: DWORD,
) GetQueuedCompletionStatusResult {
if (kernel32.GetQueuedCompletionStatus(
completion_port,
bytes_transferred_count,
lpCompletionKey,
lpOverlapped,
dwMilliseconds,
) == FALSE) {
switch (kernel32.GetLastError()) {
.ABANDONED_WAIT_0 => return GetQueuedCompletionStatusResult.Aborted,
.OPERATION_ABORTED => return GetQueuedCompletionStatusResult.Cancelled,
.HANDLE_EOF => return GetQueuedCompletionStatusResult.EOF,
else => |err| {
if (std.debug.runtime_safety) {
@setEvalBranchQuota(2500);
std.debug.panic("unexpected error: {}\n", .{err});
}
},
}
}
return GetQueuedCompletionStatusResult.Normal;
}
pub const GetQueuedCompletionStatusError = error{
Aborted,
Cancelled,
EOF,
Timeout,
} || std.os.UnexpectedError;
pub fn GetQueuedCompletionStatusEx(
completion_port: HANDLE,
completion_port_entries: []OVERLAPPED_ENTRY,
timeout_ms: ?DWORD,
alertable: bool,
) GetQueuedCompletionStatusError!u32 {
var num_entries_removed: u32 = 0;
const success = kernel32.GetQueuedCompletionStatusEx(
completion_port,
completion_port_entries.ptr,
@as(ULONG, @intCast(completion_port_entries.len)),
&num_entries_removed,
timeout_ms orelse INFINITE,
@intFromBool(alertable),
);
if (success == FALSE) {
return switch (kernel32.GetLastError()) {
.ABANDONED_WAIT_0 => error.Aborted,
.OPERATION_ABORTED => error.Cancelled,
.HANDLE_EOF => error.EOF,
.IMEOUT => error.Timeout,
else => |err| unexpectedError(err),
};
}
return num_entries_removed;
}
pub fn CloseHandle(hObject: HANDLE) void {
assert(ntdll.NtClose(hObject) == .SUCCESS);
}
pub fn FindClose(hFindFile: HANDLE) void {
assert(kernel32.FindClose(hFindFile) != 0);
}
pub const ReadFileError = error{
OperationAborted,
BrokenPipe,
Unexpected,
};
/// If buffer's length exceeds what a Windows DWORD integer can hold, it will be broken into
/// multiple non-atomic reads.
pub fn ReadFile(in_hFile: HANDLE, buffer: []u8, offset: ?u64, io_mode: std.io.ModeOverride) ReadFileError!usize {
if (io_mode != .blocking) {
const loop = std.event.Loop.instance.?;
// TODO make getting the file position non-blocking
const off = if (offset) |o| o else try SetFilePointerEx_CURRENT_get(in_hFile);
var resume_node = std.event.Loop.ResumeNode.Basic{
.base = .{
.id = .Basic,
.handle = @frame(),
.overlapped = OVERLAPPED{
.Internal = 0,
.InternalHigh = 0,
.DUMMYUNIONNAME = .{
.DUMMYSTRUCTNAME = .{
.Offset = @as(u32, @truncate(off)),
.OffsetHigh = @as(u32, @truncate(off >> 32)),
},
},
.hEvent = null,
},
},
};
loop.beginOneEvent();
suspend {
// TODO handle buffer bigger than DWORD can hold
_ = kernel32.ReadFile(in_hFile, buffer.ptr, @as(DWORD, @intCast(buffer.len)), null, &resume_node.base.overlapped);
}
var bytes_transferred: DWORD = undefined;
if (kernel32.GetOverlappedResult(in_hFile, &resume_node.base.overlapped, &bytes_transferred, FALSE) == 0) {
switch (kernel32.GetLastError()) {
.IO_PENDING => unreachable,
.OPERATION_ABORTED => return error.OperationAborted,
.BROKEN_PIPE => return error.BrokenPipe,
.HANDLE_EOF => return @as(usize, bytes_transferred),
else => |err| return unexpectedError(err),
}
}
if (offset == null) {
// TODO make setting the file position non-blocking
const new_off = off + bytes_transferred;
try SetFilePointerEx_CURRENT(in_hFile, @as(i64, @bitCast(new_off)));
}
return @as(usize, bytes_transferred);
} else {
while (true) {
const want_read_count = @as(DWORD, @intCast(math.min(@as(DWORD, maxInt(DWORD)), buffer.len)));
var amt_read: DWORD = undefined;
var overlapped_data: OVERLAPPED = undefined;
const overlapped: ?*OVERLAPPED = if (offset) |off| blk: {
overlapped_data = .{
.Internal = 0,
.InternalHigh = 0,
.DUMMYUNIONNAME = .{
.DUMMYSTRUCTNAME = .{
.Offset = @as(u32, @truncate(off)),
.OffsetHigh = @as(u32, @truncate(off >> 32)),
},
},
.hEvent = null,
};
break :blk &overlapped_data;
} else null;
if (kernel32.ReadFile(in_hFile, buffer.ptr, want_read_count, &amt_read, overlapped) == 0) {
switch (kernel32.GetLastError()) {
.OPERATION_ABORTED => continue,
.BROKEN_PIPE => return 0,
.HANDLE_EOF => return 0,
else => |err| return unexpectedError(err),
}
}
return amt_read;
}
}
}
pub const WriteFileError = error{
SystemResources,
OperationAborted,
BrokenPipe,
NotOpenForWriting,
Unexpected,
};
pub fn WriteFile(
handle: HANDLE,
bytes: []const u8,
offset: ?u64,
io_mode: std.io.ModeOverride,
) WriteFileError!usize {
if (std.event.Loop.instance != null and io_mode != .blocking) {
const loop = std.event.Loop.instance.?;
// TODO make getting the file position non-blocking
const off = if (offset) |o| o else try SetFilePointerEx_CURRENT_get(handle);
var resume_node = std.event.Loop.ResumeNode.Basic{
.base = .{
.id = .Basic,
.handle = @frame(),
.overlapped = OVERLAPPED{
.Internal = 0,
.InternalHigh = 0,
.DUMMYUNIONNAME = .{
.DUMMYSTRUCTNAME = .{
.Offset = @as(u32, @truncate(off)),
.OffsetHigh = @as(u32, @truncate(off >> 32)),
},
},
.hEvent = null,
},
},
};
loop.beginOneEvent();
suspend {
const adjusted_len = math.cast(DWORD, bytes.len) catch maxInt(DWORD);
_ = kernel32.WriteFile(handle, bytes.ptr, adjusted_len, null, &resume_node.base.overlapped);
}
var bytes_transferred: DWORD = undefined;
if (kernel32.GetOverlappedResult(handle, &resume_node.base.overlapped, &bytes_transferred, FALSE) == 0) {
switch (kernel32.GetLastError()) {
.IO_PENDING => unreachable,
.INVALID_USER_BUFFER => return error.SystemResources,
.NOT_ENOUGH_MEMORY => return error.SystemResources,
.OPERATION_ABORTED => return error.OperationAborted,
.NOT_ENOUGH_QUOTA => return error.SystemResources,
.BROKEN_PIPE => return error.BrokenPipe,
else => |err| return unexpectedError(err),
}
}
if (offset == null) {
// TODO make setting the file position non-blocking
const new_off = off + bytes_transferred;
try SetFilePointerEx_CURRENT(handle, @as(i64, @bitCast(new_off)));
}
return bytes_transferred;
} else {
var bytes_written: DWORD = undefined;
var overlapped_data: OVERLAPPED = undefined;
const overlapped: ?*OVERLAPPED = if (offset) |off| blk: {
overlapped_data = .{
.Internal = 0,
.InternalHigh = 0,
.DUMMYUNIONNAME = .{
.DUMMYSTRUCTNAME = .{
.Offset = @as(u32, @truncate(off)),
.OffsetHigh = @as(u32, @truncate(off >> 32)),
},
},
.hEvent = null,
};
break :blk &overlapped_data;
} else null;
const adjusted_len = math.cast(u32, bytes.len) catch maxInt(u32);
if (kernel32.WriteFile(handle, bytes.ptr, adjusted_len, &bytes_written, overlapped) == 0) {
switch (kernel32.GetLastError()) {
.INVALID_USER_BUFFER => return error.SystemResources,
.NOT_ENOUGH_MEMORY => return error.SystemResources,
.OPERATION_ABORTED => return error.OperationAborted,
.NOT_ENOUGH_QUOTA => return error.SystemResources,
.IO_PENDING => unreachable,
.BROKEN_PIPE => return error.BrokenPipe,
.INVALID_HANDLE => return error.NotOpenForWriting,
else => |err| return unexpectedError(err),
}
}
return bytes_written;
}
}
pub const SetCurrentDirectoryError = error{
NameTooLong,
InvalidUtf8,
FileNotFound,
NotDir,
AccessDenied,
NoDevice,
BadPathName,
Unexpected,
};
pub fn SetCurrentDirectory(path_name: []const u16) SetCurrentDirectoryError!void {
const path_len_bytes = math.cast(u16, path_name.len * 2) catch |err| switch (err) {
error.Overflow => return error.NameTooLong,
};
var nt_name = UNICODE_STRING{
.Length = path_len_bytes,
.MaximumLength = path_len_bytes,
.Buffer = @as([*]u16, @ptrFromInt(@intFromPtr(path_name.ptr))),
};
const rc = ntdll.RtlSetCurrentDirectory_U(&nt_name);
switch (rc) {
.SUCCESS => {},
.OBJECT_NAME_INVALID => return error.BadPathName,
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
.NO_MEDIA_IN_DEVICE => return error.NoDevice,
.INVALID_PARAMETER => unreachable,
.ACCESS_DENIED => return error.AccessDenied,
.OBJECT_PATH_SYNTAX_BAD => unreachable,
.NOT_A_DIRECTORY => return error.NotDir,
else => return unexpectedStatus(rc),
}
}
pub const GetCurrentDirectoryError = error{
NameTooLong,
Unexpected,
};
/// The result is a slice of `buffer`, indexed from 0.
pub fn GetCurrentDirectory(buffer: []u8) GetCurrentDirectoryError![]u8 {
var utf16le_buf: [PATH_MAX_WIDE]u16 = undefined;
const result = kernel32.GetCurrentDirectoryW(utf16le_buf.len, &utf16le_buf);
if (result == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
assert(result <= utf16le_buf.len);
const utf16le_slice = utf16le_buf[0..result];
// Trust that Windows gives us valid UTF-16LE.
var end_index: usize = 0;
var it = std.unicode.Utf16LeIterator.init(utf16le_slice);
while (it.nextCodepoint() catch unreachable) |codepoint| {
const seq_len = std.unicode.utf8CodepointSequenceLength(codepoint) catch unreachable;
if (end_index + seq_len >= buffer.len)
return error.NameTooLong;
end_index += std.unicode.utf8Encode(codepoint, buffer[end_index..]) catch unreachable;
}
return buffer[0..end_index];
}
pub const CreateSymbolicLinkError = error{
AccessDenied,
PathAlreadyExists,
FileNotFound,
NameTooLong,
NoDevice,
Unexpected,
};
/// Needs either:
/// - `SeCreateSymbolicLinkPrivilege` privilege
/// or
/// - Developer mode on Windows 10
/// otherwise fails with `error.AccessDenied`. In which case `sym_link_path` may still
/// be created on the file system but will lack reparse processing data applied to it.
pub fn CreateSymbolicLink(
dir: ?HANDLE,
sym_link_path: []const u16,
target_path: []const u16,
is_directory: bool,
) CreateSymbolicLinkError!void {
const SYMLINK_DATA = extern struct {
ReparseTag: ULONG,
ReparseDataLength: USHORT,
Reserved: USHORT,
SubstituteNameOffset: USHORT,
SubstituteNameLength: USHORT,
PrintNameOffset: USHORT,
PrintNameLength: USHORT,
Flags: ULONG,
};
const symlink_handle = OpenFile(sym_link_path, .{
.access_mask = SYNCHRONIZE | GENERIC_READ | GENERIC_WRITE,
.dir = dir,
.creation = FILE_CREATE,
.io_mode = .blocking,
.open_dir = is_directory,
}) catch |err| switch (err) {
error.IsDir => return error.PathAlreadyExists,
error.NotDir => unreachable,
error.WouldBlock => unreachable,
error.PipeBusy => unreachable,
else => |e| return e,
};
defer CloseHandle(symlink_handle);
// prepare reparse data buffer
var buffer: [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]u8 = undefined;
const buf_len = @sizeOf(SYMLINK_DATA) + target_path.len * 4;
const header_len = @sizeOf(ULONG) + @sizeOf(USHORT) * 2;
const symlink_data = SYMLINK_DATA{
.ReparseTag = IO_REPARSE_TAG_SYMLINK,
.ReparseDataLength = @as(u16, @intCast(buf_len - header_len)),
.Reserved = 0,
.SubstituteNameOffset = @as(u16, @intCast(target_path.len * 2)),
.SubstituteNameLength = @as(u16, @intCast(target_path.len * 2)),
.PrintNameOffset = 0,
.PrintNameLength = @as(u16, @intCast(target_path.len * 2)),
.Flags = if (dir) |_| SYMLINK_FLAG_RELATIVE else 0,
};
@memcpy(buffer[0..@sizeOf(SYMLINK_DATA)], std.mem.asBytes(&symlink_data));
@memcpy(buffer[@sizeOf(SYMLINK_DATA)..][0 .. target_path.len * 2], @as([*]const u8, @ptrCast(target_path)));
const paths_start = @sizeOf(SYMLINK_DATA) + target_path.len * 2;
@memcpy(buffer[paths_start..][0 .. target_path.len * 2], @as([*]const u8, @ptrCast(target_path)));
_ = try DeviceIoControl(symlink_handle, FSCTL_SET_REPARSE_POINT, buffer[0..buf_len], null);
}
pub const ReadLinkError = error{
FileNotFound,
AccessDenied,
Unexpected,
NameTooLong,
UnsupportedReparsePointType,
};
pub fn ReadLink(dir: ?HANDLE, sub_path_w: []const u16, out_buffer: []u8) ReadLinkError![]u8 {
// Here, we use `NtCreateFile` to shave off one syscall if we were to use `OpenFile` wrapper.
// With the latter, we'd need to call `NtCreateFile` twice, once for file symlink, and if that
// failed, again for dir symlink. Omitting any mention of file/dir flags makes it possible
// to open the symlink there and then.
const path_len_bytes = math.cast(u16, sub_path_w.len * 2) catch |err| switch (err) {
error.Overflow => return error.NameTooLong,
};
var nt_name = UNICODE_STRING{
.Length = path_len_bytes,
.MaximumLength = path_len_bytes,
.Buffer = @as([*]u16, @ptrFromInt(@intFromPtr(sub_path_w.ptr))),
};
var attr = OBJECT_ATTRIBUTES{
.Length = @sizeOf(OBJECT_ATTRIBUTES),
.RootDirectory = if (std.fs.path.isAbsoluteWindowsWTF16(sub_path_w)) null else dir,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = null,
.SecurityQualityOfService = null,
};
var result_handle: HANDLE = undefined;
var io: IO_STATUS_BLOCK = undefined;
const rc = ntdll.NtCreateFile(
&result_handle,
FILE_READ_ATTRIBUTES,
&attr,
&io,
null,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ,
FILE_OPEN,
FILE_OPEN_REPARSE_POINT,
null,
0,
);
switch (rc) {
.SUCCESS => {},
.OBJECT_NAME_INVALID => unreachable,
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
.NO_MEDIA_IN_DEVICE => return error.FileNotFound,
.INVALID_PARAMETER => unreachable,
.SHARING_VIOLATION => return error.AccessDenied,
.ACCESS_DENIED => return error.AccessDenied,
.PIPE_BUSY => return error.AccessDenied,
.OBJECT_PATH_SYNTAX_BAD => unreachable,
.OBJECT_NAME_COLLISION => unreachable,
.FILE_IS_A_DIRECTORY => unreachable,
else => return unexpectedStatus(rc),
}
defer CloseHandle(result_handle);
var reparse_buf: [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]u8 = undefined;
_ = DeviceIoControl(result_handle, FSCTL_GET_REPARSE_POINT, null, reparse_buf[0..]) catch |err| switch (err) {
error.AccessDenied => unreachable,
else => |e| return e,
};
const reparse_struct: *const REPARSE_DATA_BUFFER = @ptrCast(@alignCast(&reparse_buf[0]));
switch (reparse_struct.ReparseTag) {
IO_REPARSE_TAG_SYMLINK => {
const buf: *const SYMBOLIC_LINK_REPARSE_BUFFER = @ptrCast(@alignCast(&reparse_struct.DataBuffer[0]));
const offset = buf.SubstituteNameOffset >> 1;
const len = buf.SubstituteNameLength >> 1;
const path_buf = @as([*]const u16, &buf.PathBuffer);
const is_relative = buf.Flags & SYMLINK_FLAG_RELATIVE != 0;
return parseReadlinkPath(path_buf[offset .. offset + len], is_relative, out_buffer);
},
IO_REPARSE_TAG_MOUNT_POINT => {
const buf: *const MOUNT_POINT_REPARSE_BUFFER = @ptrCast(@alignCast(&reparse_struct.DataBuffer[0]));
const offset = buf.SubstituteNameOffset >> 1;
const len = buf.SubstituteNameLength >> 1;
const path_buf = @as([*]const u16, &buf.PathBuffer);
return parseReadlinkPath(path_buf[offset .. offset + len], false, out_buffer);
},
else => |value| {
std.debug.warn("unsupported symlink type: {}", .{value});
return error.UnsupportedReparsePointType;
},
}
}
fn parseReadlinkPath(path: []const u16, is_relative: bool, out_buffer: []u8) []u8 {
const prefix = [_]u16{ '\\', '?', '?', '\\' };
var start_index: usize = 0;
if (!is_relative and std.mem.startsWith(u16, path, &prefix)) {
start_index = prefix.len;
}
const out_len = std.unicode.utf16leToUtf8(out_buffer, path[start_index..]) catch unreachable;
return out_buffer[0..out_len];
}
pub const DeleteFileError = error{
FileNotFound,
AccessDenied,
NameTooLong,
/// Also known as sharing violation.
FileBusy,
Unexpected,
NotDir,
IsDir,
};
pub const DeleteFileOptions = struct {
dir: ?HANDLE,
remove_dir: bool = false,
};
pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFileError!void {
const create_options_flags: ULONG = if (options.remove_dir)
FILE_DELETE_ON_CLOSE | FILE_DIRECTORY_FILE | FILE_OPEN_REPARSE_POINT
else
FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE | FILE_OPEN_REPARSE_POINT; // would we ever want to delete the target instead?
const path_len_bytes = @as(u16, @intCast(sub_path_w.len * 2));
var nt_name = UNICODE_STRING{
.Length = path_len_bytes,
.MaximumLength = path_len_bytes,
// The Windows API makes this mutable, but it will not mutate here.
.Buffer = @as([*]u16, @ptrFromInt(@intFromPtr(sub_path_w.ptr))),
};
if (sub_path_w[0] == '.' and sub_path_w[1] == 0) {
// Windows does not recognize this, but it does work with empty string.
nt_name.Length = 0;
}
if (sub_path_w[0] == '.' and sub_path_w[1] == '.' and sub_path_w[2] == 0) {
// Can't remove the parent directory with an open handle.
return error.FileBusy;
}
var attr = OBJECT_ATTRIBUTES{
.Length = @sizeOf(OBJECT_ATTRIBUTES),
.RootDirectory = if (std.fs.path.isAbsoluteWindowsWTF16(sub_path_w)) null else options.dir,
.Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
.ObjectName = &nt_name,
.SecurityDescriptor = null,
.SecurityQualityOfService = null,
};
var io: IO_STATUS_BLOCK = undefined;
var tmp_handle: HANDLE = undefined;
var rc = ntdll.NtCreateFile(
&tmp_handle,
SYNCHRONIZE | DELETE,
&attr,
&io,
null,
0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN,
create_options_flags,
null,
0,
);
switch (rc) {
.SUCCESS => return CloseHandle(tmp_handle),
.OBJECT_NAME_INVALID => unreachable,
.OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
.OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
.INVALID_PARAMETER => unreachable,
.FILE_IS_A_DIRECTORY => return error.IsDir,
.NOT_A_DIRECTORY => return error.NotDir,
.SHARING_VIOLATION => return error.FileBusy,
else => return unexpectedStatus(rc),
}
}
pub const MoveFileError = error{ FileNotFound, AccessDenied, Unexpected };
pub fn MoveFileEx(old_path: []const u8, new_path: []const u8, flags: DWORD) MoveFileError!void {
const old_path_w = try sliceToPrefixedFileW(old_path);
const new_path_w = try sliceToPrefixedFileW(new_path);
return MoveFileExW(old_path_w.span().ptr, new_path_w.span().ptr, flags);
}
pub fn MoveFileExW(old_path: [*:0]const u16, new_path: [*:0]const u16, flags: DWORD) MoveFileError!void {
if (kernel32.MoveFileExW(old_path, new_path, flags) == 0) {
switch (kernel32.GetLastError()) {
.FILE_NOT_FOUND => return error.FileNotFound,
.ACCESS_DENIED => return error.AccessDenied,
else => |err| return unexpectedError(err),
}
}
}
pub const GetStdHandleError = error{
NoStandardHandleAttached,
Unexpected,
};
pub fn GetStdHandle(handle_id: DWORD) GetStdHandleError!HANDLE {
const handle = kernel32.GetStdHandle(handle_id) orelse return error.NoStandardHandleAttached;
if (handle == INVALID_HANDLE_VALUE) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
return handle;
}
pub const SetFilePointerError = error{Unexpected};
/// The SetFilePointerEx function with the `dwMoveMethod` parameter set to `FILE_BEGIN`.
pub fn SetFilePointerEx_BEGIN(handle: HANDLE, offset: u64) SetFilePointerError!void {
// "The starting point is zero or the beginning of the file. If [FILE_BEGIN]
// is specified, then the liDistanceToMove parameter is interpreted as an unsigned value."
// https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfilepointerex
const ipos = @as(LARGE_INTEGER, @bitCast(offset));
if (kernel32.SetFilePointerEx(handle, ipos, null, FILE_BEGIN) == 0) {
switch (kernel32.GetLastError()) {
.INVALID_PARAMETER => unreachable,
.INVALID_HANDLE => unreachable,
else => |err| return unexpectedError(err),
}
}
}
/// The SetFilePointerEx function with the `dwMoveMethod` parameter set to `FILE_CURRENT`.
pub fn SetFilePointerEx_CURRENT(handle: HANDLE, offset: i64) SetFilePointerError!void {
if (kernel32.SetFilePointerEx(handle, offset, null, FILE_CURRENT) == 0) {
switch (kernel32.GetLastError()) {
.INVALID_PARAMETER => unreachable,
.INVALID_HANDLE => unreachable,
else => |err| return unexpectedError(err),
}
}
}
/// The SetFilePointerEx function with the `dwMoveMethod` parameter set to `FILE_END`.
pub fn SetFilePointerEx_END(handle: HANDLE, offset: i64) SetFilePointerError!void {
if (kernel32.SetFilePointerEx(handle, offset, null, FILE_END) == 0) {
switch (kernel32.GetLastError()) {
.INVALID_PARAMETER => unreachable,
.INVALID_HANDLE => unreachable,
else => |err| return unexpectedError(err),
}
}
}
/// The SetFilePointerEx function with parameters to get the current offset.
pub fn SetFilePointerEx_CURRENT_get(handle: HANDLE) SetFilePointerError!u64 {
var result: LARGE_INTEGER = undefined;
if (kernel32.SetFilePointerEx(handle, 0, &result, FILE_CURRENT) == 0) {
switch (kernel32.GetLastError()) {
.INVALID_PARAMETER => unreachable,
.INVALID_HANDLE => unreachable,
else => |err| return unexpectedError(err),
}
}
// Based on the docs for FILE_BEGIN, it seems that the returned signed integer
// should be interpreted as an unsigned integer.
return @as(u64, @bitCast(result));
}
pub fn QueryObjectName(
handle: HANDLE,
out_buffer: []u16,
) ![]u16 {
const out_buffer_aligned = mem.alignInSlice(out_buffer, @alignOf(OBJECT_NAME_INFORMATION)) orelse return error.NameTooLong;
const info = @as(*OBJECT_NAME_INFORMATION, @ptrCast(out_buffer_aligned));
//buffer size is specified in bytes
const out_buffer_len = std.math.cast(ULONG, out_buffer_aligned.len * 2) catch |e| switch (e) {
error.Overflow => std.math.maxInt(ULONG),
};
//last argument would return the length required for full_buffer, not exposed here
const rc = ntdll.NtQueryObject(handle, .ObjectNameInformation, info, out_buffer_len, null);
switch (rc) {
.SUCCESS => {
// info.Name.Buffer from ObQueryNameString is documented to be null (and MaximumLength == 0)
// if the object was "unnamed", not sure if this can happen for file handles
if (info.Name.MaximumLength == 0) return error.Unexpected;
// resulting string length is specified in bytes
const path_length_unterminated = @divExact(info.Name.Length, 2);
return info.Name.Buffer[0..path_length_unterminated];
},
.ACCESS_DENIED => return error.AccessDenied,
.INVALID_HANDLE => return error.InvalidHandle,
// triggered when the buffer is too small for the OBJECT_NAME_INFORMATION object (.INFO_LENGTH_MISMATCH),
// or if the buffer is too small for the file path returned (.BUFFER_OVERFLOW, .BUFFER_TOO_SMALL)
.INFO_LENGTH_MISMATCH, .BUFFER_OVERFLOW, .BUFFER_TOO_SMALL => return error.NameTooLong,
else => |e| return unexpectedStatus(e),
}
}
test "QueryObjectName" {
if (builtin.os.tag != .windows)
return;
//any file will do; canonicalization works on NTFS junctions and symlinks, hardlinks remain separate paths.
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const handle = tmp.dir.fd;
var out_buffer: [PATH_MAX_WIDE]u16 = undefined;
var result_path = try QueryObjectName(handle, &out_buffer);
const required_len_in_u16 = result_path.len + @divExact(@intFromPtr(result_path.ptr) - @intFromPtr(&out_buffer), 2) + 1;
//insufficient size
try std.testing.expectError(error.NameTooLong, QueryObjectName(handle, out_buffer[0 .. required_len_in_u16 - 1]));
//exactly-sufficient size
_ = try QueryObjectName(handle, out_buffer[0..required_len_in_u16]);
}
pub const GetFinalPathNameByHandleError = error{
AccessDenied,
BadPathName,
FileNotFound,
NameTooLong,
Unexpected,
};
/// Specifies how to format volume path in the result of `GetFinalPathNameByHandle`.
/// Defaults to DOS volume names.
pub const GetFinalPathNameByHandleFormat = struct {
volume_name: enum {
/// Format as DOS volume name
Dos,
/// Format as NT volume name
Nt,
} = .Dos,
};
/// Returns canonical (normalized) path of handle.
/// Use `GetFinalPathNameByHandleFormat` to specify whether the path is meant to include
/// NT or DOS volume name (e.g., `\Device\HarddiskVolume0\foo.txt` versus `C:\foo.txt`).
/// If DOS volume name format is selected, note that this function does *not* prepend
/// `\\?\` prefix to the resultant path.
pub fn GetFinalPathNameByHandle(
hFile: HANDLE,
fmt: GetFinalPathNameByHandleFormat,
out_buffer: []u16,
) GetFinalPathNameByHandleError![]u16 {
const final_path = QueryObjectName(hFile, out_buffer) catch |err| switch (err) {
// we assume InvalidHandle is close enough to FileNotFound in semantics
// to not further complicate the error set
error.InvalidHandle => return error.FileNotFound,
else => |e| return e,
};
switch (fmt.volume_name) {
.Nt => {
// the returned path is already in .Nt format
return final_path;
},
.Dos => {
// parse the string to separate volume path from file path
const expected_prefix = std.unicode.utf8ToUtf16LeStringLiteral("\\Device\\");
// TODO find out if a path can start with something besides `\Device\<volume name>`,
// and if we need to handle it differently
// (i.e. how to determine the start and end of the volume name in that case)
if (!mem.eql(u16, expected_prefix, final_path[0..expected_prefix.len])) return error.Unexpected;
const file_path_begin_index = mem.indexOfPos(u16, final_path, expected_prefix.len, &[_]u16{'\\'}) orelse unreachable;
const volume_name_u16 = final_path[0..file_path_begin_index];
const file_name_u16 = final_path[file_path_begin_index..];
// Get DOS volume name. DOS volume names are actually symbolic link objects to the
// actual NT volume. For example:
// (NT) \Device\HarddiskVolume4 => (DOS) \DosDevices\C: == (DOS) C:
const MIN_SIZE = @sizeOf(MOUNTMGR_MOUNT_POINT) + MAX_PATH;
// We initialize the input buffer to all zeros for convenience since
// `DeviceIoControl` with `IOCTL_MOUNTMGR_QUERY_POINTS` expects this.
var input_buf: [MIN_SIZE]u8 align(@alignOf(MOUNTMGR_MOUNT_POINT)) = [_]u8{0} ** MIN_SIZE;
var output_buf: [MIN_SIZE * 4]u8 align(@alignOf(MOUNTMGR_MOUNT_POINTS)) = undefined;
// This surprising path is a filesystem path to the mount manager on Windows.
// Source: https://stackoverflow.com/questions/3012828/using-ioctl-mountmgr-query-points
const mgmt_path = "\\MountPointManager";
const mgmt_path_u16 = sliceToPrefixedFileW(mgmt_path) catch unreachable;
const mgmt_handle = OpenFile(mgmt_path_u16.span(), .{
.access_mask = SYNCHRONIZE,
.share_access = FILE_SHARE_READ | FILE_SHARE_WRITE,
.creation = FILE_OPEN,
.io_mode = .blocking,
}) catch |err| switch (err) {
error.IsDir => unreachable,
error.NotDir => unreachable,
error.NoDevice => unreachable,
error.AccessDenied => unreachable,
error.PipeBusy => unreachable,
error.PathAlreadyExists => unreachable,
error.WouldBlock => unreachable,
else => |e| return e,
};
defer CloseHandle(mgmt_handle);
var input_struct = @as(*MOUNTMGR_MOUNT_POINT, @ptrCast(&input_buf[0]));
input_struct.DeviceNameOffset = @sizeOf(MOUNTMGR_MOUNT_POINT);
input_struct.DeviceNameLength = @as(USHORT, @intCast(volume_name_u16.len * 2));
@memcpy(input_buf[@sizeOf(MOUNTMGR_MOUNT_POINT)..][0 .. volume_name_u16.len * 2], @as([*]const u8, @ptrCast(volume_name_u16.ptr)));
DeviceIoControl(mgmt_handle, IOCTL_MOUNTMGR_QUERY_POINTS, &input_buf, &output_buf) catch |err| switch (err) {
error.AccessDenied => unreachable,
else => |e| return e,
};
const mount_points_struct = @as(*const MOUNTMGR_MOUNT_POINTS, @ptrCast(&output_buf[0]));
const mount_points = @as(
[*]const MOUNTMGR_MOUNT_POINT,
@ptrCast(&mount_points_struct.MountPoints[0]),
)[0..mount_points_struct.NumberOfMountPoints];
for (mount_points) |mount_point| {
const symlink = @as(
[*]const u16,
@ptrCast(@alignCast(&output_buf[mount_point.SymbolicLinkNameOffset])),
)[0 .. mount_point.SymbolicLinkNameLength / 2];
// Look for `\DosDevices\` prefix. We don't really care if there are more than one symlinks
// with traditional DOS drive letters, so pick the first one available.
var prefix_buf = std.unicode.utf8ToUtf16LeStringLiteral("\\DosDevices\\");
const prefix = prefix_buf[0..prefix_buf.len];
if (mem.startsWith(u16, symlink, prefix)) {
const drive_letter = symlink[prefix.len..];
if (out_buffer.len < drive_letter.len + file_name_u16.len) return error.NameTooLong;
mem.copy(u16, out_buffer, drive_letter);
mem.copy(u16, out_buffer[drive_letter.len..], file_name_u16);
const total_len = drive_letter.len + file_name_u16.len;
// Validate that DOS does not contain any spurious nul bytes.
if (mem.indexOfScalar(u16, out_buffer[0..total_len], 0)) |_| {
return error.BadPathName;
}
return out_buffer[0..total_len];
}
}
// If we've ended up here, then something went wrong/is corrupted in the OS,
// so error out!
return error.FileNotFound;
},
}
}
test "GetFinalPathNameByHandle" {
if (builtin.os.tag != .windows)
return;
//any file will do
var tmp = std.testing.tmpDir(.{});
defer tmp.cleanup();
const handle = tmp.dir.fd;
var buffer: [PATH_MAX_WIDE]u16 = undefined;
//check with sufficient size
const nt_path = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, &buffer);
_ = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, &buffer);
const required_len_in_u16 = nt_path.len + @divExact(@intFromPtr(nt_path.ptr) - @intFromPtr(&buffer), 2) + 1;
//check with insufficient size
try std.testing.expectError(error.NameTooLong, GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, buffer[0 .. required_len_in_u16 - 1]));
try std.testing.expectError(error.NameTooLong, GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, buffer[0 .. required_len_in_u16 - 1]));
//check with exactly-sufficient size
_ = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Nt }, buffer[0..required_len_in_u16]);
_ = try GetFinalPathNameByHandle(handle, .{ .volume_name = .Dos }, buffer[0..required_len_in_u16]);
}
pub const QueryInformationFileError = error{Unexpected};
pub fn QueryInformationFile(
handle: HANDLE,
info_class: FILE_INFORMATION_CLASS,
out_buffer: []u8,
) QueryInformationFileError!void {
var io: IO_STATUS_BLOCK = undefined;
const len_bytes = std.math.cast(u32, out_buffer.len) catch unreachable;
const rc = ntdll.NtQueryInformationFile(handle, &io, out_buffer.ptr, len_bytes, info_class);
switch (rc) {
.SUCCESS => {},
.INVALID_PARAMETER => unreachable,
else => return unexpectedStatus(rc),
}
}
pub const GetFileSizeError = error{Unexpected};
pub fn GetFileSizeEx(hFile: HANDLE) GetFileSizeError!u64 {
var file_size: LARGE_INTEGER = undefined;
if (kernel32.GetFileSizeEx(hFile, &file_size) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
return @as(u64, @bitCast(file_size));
}
pub const GetFileAttributesError = error{
FileNotFound,
PermissionDenied,
Unexpected,
};
pub fn GetFileAttributes(filename: []const u8) GetFileAttributesError!DWORD {
const filename_w = try sliceToPrefixedFileW(filename);
return GetFileAttributesW(filename_w.span().ptr);
}
pub fn GetFileAttributesW(lpFileName: [*:0]const u16) GetFileAttributesError!DWORD {
const rc = kernel32.GetFileAttributesW(lpFileName);
if (rc == INVALID_FILE_ATTRIBUTES) {
switch (kernel32.GetLastError()) {
.FILE_NOT_FOUND => return error.FileNotFound,
.PATH_NOT_FOUND => return error.FileNotFound,
.ACCESS_DENIED => return error.PermissionDenied,
else => |err| return unexpectedError(err),
}
}
return rc;
}
pub fn WSAStartup(majorVersion: u8, minorVersion: u8) !ws2_32.WSADATA {
var wsadata: ws2_32.WSADATA = undefined;
return switch (ws2_32.WSAStartup((@as(WORD, minorVersion) << 8) | majorVersion, &wsadata)) {
0 => wsadata,
else => |err_int| switch (@as(ws2_32.WinsockError, @enumFromInt(@as(u16, @intCast(err_int))))) {
.WSASYSNOTREADY => return error.SystemNotAvailable,
.WSAVERNOTSUPPORTED => return error.VersionNotSupported,
.WSAEINPROGRESS => return error.BlockingOperationInProgress,
.WSAEPROCLIM => return error.ProcessFdQuotaExceeded,
else => |err| return unexpectedWSAError(err),
},
};
}
pub fn WSACleanup() !void {
return switch (ws2_32.WSACleanup()) {
0 => {},
ws2_32.SOCKET_ERROR => switch (ws2_32.WSAGetLastError()) {
.WSANOTINITIALISED => return error.NotInitialized,
.WSAENETDOWN => return error.NetworkNotAvailable,
.WSAEINPROGRESS => return error.BlockingOperationInProgress,
else => |err| return unexpectedWSAError(err),
},
else => unreachable,
};
}
var wsa_startup_mutex: std.Thread.Mutex = .{};
/// Microsoft requires WSAStartup to be called to initialize, or else
/// WSASocketW will return WSANOTINITIALISED.
/// Since this is a standard library, we do not have the luxury of
/// putting initialization code anywhere, because we would not want
/// to pay the cost of calling WSAStartup if there ended up being no
/// networking. Also, if Zig code is used as a library, Zig is not in
/// charge of the start code, and we couldn't put in any initialization
/// code even if we wanted to.
/// The documentation for WSAStartup mentions that there must be a
/// matching WSACleanup call. It is not possible for the Zig Standard
/// Library to honor this for the same reason - there is nowhere to put
/// deinitialization code.
/// So, API users of the zig std lib have two options:
/// * (recommended) The simple, cross-platform way: just call `WSASocketW`
/// and don't worry about it. Zig will call WSAStartup() in a thread-safe
/// manner and never deinitialize networking. This is ideal for an
/// application which has the capability to do networking.
/// * The getting-your-hands-dirty way: call `WSAStartup()` before doing
/// networking, so that the error handling code for WSANOTINITIALISED never
/// gets run, which then allows the application or library to call `WSACleanup()`.
/// This could make sense for a library, which has init and deinit
/// functions for the whole library's lifetime.
pub fn WSASocketW(
af: i32,
socket_type: i32,
protocol: i32,
protocolInfo: ?*ws2_32.WSAPROTOCOL_INFOW,
g: ws2_32.GROUP,
dwFlags: DWORD,
) !ws2_32.SOCKET {
var first = true;
while (true) {
const rc = ws2_32.WSASocketW(af, socket_type, protocol, protocolInfo, g, dwFlags);
if (rc == ws2_32.INVALID_SOCKET) {
switch (ws2_32.WSAGetLastError()) {
.WSAEAFNOSUPPORT => return error.AddressFamilyNotSupported,
.WSAEMFILE => return error.ProcessFdQuotaExceeded,
.WSAENOBUFS => return error.SystemResources,
.WSAEPROTONOSUPPORT => return error.ProtocolNotSupported,
.WSANOTINITIALISED => {
if (!first) return error.Unexpected;
first = false;
var held = wsa_startup_mutex.acquire();
defer held.release();
// Here we could use a flag to prevent multiple threads to prevent
// multiple calls to WSAStartup, but it doesn't matter. We're globally
// leaking the resource intentionally, and the mutex already prevents
// data races within the WSAStartup function.
_ = WSAStartup(2, 2) catch |err| switch (err) {
error.SystemNotAvailable => return error.SystemResources,
error.VersionNotSupported => return error.Unexpected,
error.BlockingOperationInProgress => return error.Unexpected,
error.ProcessFdQuotaExceeded => return error.ProcessFdQuotaExceeded,
error.Unexpected => return error.Unexpected,
};
continue;
},
else => |err| return unexpectedWSAError(err),
}
}
return rc;
}
}
pub fn bind(s: ws2_32.SOCKET, name: *const ws2_32.sockaddr, namelen: ws2_32.socklen_t) i32 {
return ws2_32.bind(s, name, @as(i32, @intCast(namelen)));
}
pub fn listen(s: ws2_32.SOCKET, backlog: u31) i32 {
return ws2_32.listen(s, backlog);
}
pub fn closesocket(s: ws2_32.SOCKET) !void {
switch (ws2_32.closesocket(s)) {
0 => {},
ws2_32.SOCKET_ERROR => switch (ws2_32.WSAGetLastError()) {
else => |err| return unexpectedWSAError(err),
},
else => unreachable,
}
}
pub fn accept(s: ws2_32.SOCKET, name: ?*ws2_32.sockaddr, namelen: ?*ws2_32.socklen_t) ws2_32.SOCKET {
assert((name == null) == (namelen == null));
return ws2_32.accept(s, name, @as(?*i32, @ptrCast(namelen)));
}
pub fn getsockname(s: ws2_32.SOCKET, name: *ws2_32.sockaddr, namelen: *ws2_32.socklen_t) i32 {
return ws2_32.getsockname(s, name, @as(*i32, @ptrCast(namelen)));
}
pub fn getpeername(s: ws2_32.SOCKET, name: *ws2_32.sockaddr, namelen: *ws2_32.socklen_t) i32 {
return ws2_32.getpeername(s, name, @as(*i32, @ptrCast(namelen)));
}
pub fn sendmsg(
s: ws2_32.SOCKET,
msg: *const ws2_32.WSAMSG,
flags: u32,
) i32 {
var bytes_send: DWORD = undefined;
if (ws2_32.WSASendMsg(s, msg, flags, &bytes_send, null, null) == ws2_32.SOCKET_ERROR) {
return ws2_32.SOCKET_ERROR;
} else {
return @as(i32, @as(u31, @intCast(bytes_send)));
}
}
pub fn sendto(s: ws2_32.SOCKET, buf: [*]const u8, len: usize, flags: u32, to: ?*const ws2_32.sockaddr, to_len: ws2_32.socklen_t) i32 {
var buffer = ws2_32.WSABUF{ .len = @as(u31, @truncate(len)), .buf = @as([*]u8, @ptrFromInt(@intFromPtr(buf))) };
var bytes_send: DWORD = undefined;
if (ws2_32.WSASendTo(s, @as([*]ws2_32.WSABUF, @ptrCast(&buffer)), 1, &bytes_send, flags, to, @as(i32, @intCast(to_len)), null, null) == ws2_32.SOCKET_ERROR) {
return ws2_32.SOCKET_ERROR;
} else {
return @as(i32, @as(u31, @intCast(bytes_send)));
}
}
pub fn recvfrom(s: ws2_32.SOCKET, buf: [*]u8, len: usize, flags: u32, from: ?*ws2_32.sockaddr, from_len: ?*ws2_32.socklen_t) i32 {
var buffer = ws2_32.WSABUF{ .len = @as(u31, @truncate(len)), .buf = buf };
var bytes_received: DWORD = undefined;
var flags_inout = flags;
if (ws2_32.WSARecvFrom(s, @as([*]ws2_32.WSABUF, @ptrCast(&buffer)), 1, &bytes_received, &flags_inout, from, @as(?*i32, @ptrCast(from_len)), null, null) == ws2_32.SOCKET_ERROR) {
return ws2_32.SOCKET_ERROR;
} else {
return @as(i32, @as(u31, @intCast(bytes_received)));
}
}
pub fn poll(fds: [*]ws2_32.pollfd, n: c_ulong, timeout: i32) i32 {
return ws2_32.WSAPoll(fds, n, timeout);
}
pub fn WSAIoctl(
s: ws2_32.SOCKET,
dwIoControlCode: DWORD,
inBuffer: ?[]const u8,
outBuffer: []u8,
overlapped: ?*OVERLAPPED,
completionRoutine: ?ws2_32.LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) !DWORD {
var bytes: DWORD = undefined;
switch (ws2_32.WSAIoctl(
s,
dwIoControlCode,
if (inBuffer) |i| i.ptr else null,
if (inBuffer) |i| @as(DWORD, @intCast(i.len)) else 0,
outBuffer.ptr,
@as(DWORD, @intCast(outBuffer.len)),
&bytes,
overlapped,
completionRoutine,
)) {
0 => {},
ws2_32.SOCKET_ERROR => switch (ws2_32.WSAGetLastError()) {
else => |err| return unexpectedWSAError(err),
},
else => unreachable,
}
return bytes;
}
const GetModuleFileNameError = error{Unexpected};
pub fn GetModuleFileNameW(hModule: ?HMODULE, buf_ptr: [*]u16, buf_len: DWORD) GetModuleFileNameError![:0]u16 {
const rc = kernel32.GetModuleFileNameW(hModule, buf_ptr, buf_len);
if (rc == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
return buf_ptr[0..rc :0];
}
pub const TerminateProcessError = error{Unexpected};
pub fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) TerminateProcessError!void {
if (kernel32.TerminateProcess(hProcess, uExitCode) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub const VirtualAllocError = error{Unexpected};
pub fn VirtualAlloc(addr: ?LPVOID, size: usize, alloc_type: DWORD, flProtect: DWORD) VirtualAllocError!LPVOID {
return kernel32.VirtualAlloc(addr, size, alloc_type, flProtect) orelse {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
};
}
pub fn VirtualFree(lpAddress: ?LPVOID, dwSize: usize, dwFreeType: DWORD) void {
assert(kernel32.VirtualFree(lpAddress, dwSize, dwFreeType) != 0);
}
pub const SetConsoleTextAttributeError = error{Unexpected};
pub fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) SetConsoleTextAttributeError!void {
if (kernel32.SetConsoleTextAttribute(hConsoleOutput, wAttributes) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub fn SetConsoleCtrlHandler(handler_routine: ?HANDLER_ROUTINE, add: bool) !void {
const success = kernel32.SetConsoleCtrlHandler(
handler_routine,
if (add) TRUE else FALSE,
);
if (success == FALSE) {
return switch (kernel32.GetLastError()) {
else => |err| unexpectedError(err),
};
}
}
pub fn SetFileCompletionNotificationModes(handle: HANDLE, flags: UCHAR) !void {
const success = kernel32.SetFileCompletionNotificationModes(handle, flags);
if (success == FALSE) {
return switch (kernel32.GetLastError()) {
else => |err| unexpectedError(err),
};
}
}
pub const GetEnvironmentStringsError = error{OutOfMemory};
pub fn GetEnvironmentStringsW() GetEnvironmentStringsError![*:0]u16 {
return kernel32.GetEnvironmentStringsW() orelse return error.OutOfMemory;
}
pub fn FreeEnvironmentStringsW(penv: [*:0]u16) void {
assert(kernel32.FreeEnvironmentStringsW(penv) != 0);
}
pub const GetEnvironmentVariableError = error{
EnvironmentVariableNotFound,
Unexpected,
};
pub fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) GetEnvironmentVariableError!DWORD {
const rc = kernel32.GetEnvironmentVariableW(lpName, lpBuffer, nSize);
if (rc == 0) {
switch (kernel32.GetLastError()) {
.ENVVAR_NOT_FOUND => return error.EnvironmentVariableNotFound,
else => |err| return unexpectedError(err),
}
}
return rc;
}
pub const CreateProcessError = error{
FileNotFound,
AccessDenied,
InvalidName,
Unexpected,
};
pub fn CreateProcessW(
lpApplicationName: ?LPWSTR,
lpCommandLine: LPWSTR,
lpProcessAttributes: ?*SECURITY_ATTRIBUTES,
lpThreadAttributes: ?*SECURITY_ATTRIBUTES,
bInheritHandles: BOOL,
dwCreationFlags: DWORD,
lpEnvironment: ?*anyopaque,
lpCurrentDirectory: ?LPWSTR,
lpStartupInfo: *STARTUPINFOW,
lpProcessInformation: *PROCESS_INFORMATION,
) CreateProcessError!void {
if (kernel32.CreateProcessW(
lpApplicationName,
lpCommandLine,
lpProcessAttributes,
lpThreadAttributes,
bInheritHandles,
dwCreationFlags,
lpEnvironment,
lpCurrentDirectory,
lpStartupInfo,
lpProcessInformation,
) == 0) {
switch (kernel32.GetLastError()) {
.FILE_NOT_FOUND => return error.FileNotFound,
.PATH_NOT_FOUND => return error.FileNotFound,
.ACCESS_DENIED => return error.AccessDenied,
.INVALID_PARAMETER => unreachable,
.INVALID_NAME => return error.InvalidName,
else => |err| return unexpectedError(err),
}
}
}
pub const LoadLibraryError = error{
FileNotFound,
Unexpected,
};
pub fn LoadLibraryW(lpLibFileName: [*:0]const u16) LoadLibraryError!HMODULE {
return kernel32.LoadLibraryW(lpLibFileName) orelse {
switch (kernel32.GetLastError()) {
.FILE_NOT_FOUND => return error.FileNotFound,
.PATH_NOT_FOUND => return error.FileNotFound,
.MOD_NOT_FOUND => return error.FileNotFound,
else => |err| return unexpectedError(err),
}
};
}
pub fn FreeLibrary(hModule: HMODULE) void {
assert(kernel32.FreeLibrary(hModule) != 0);
}
pub fn QueryPerformanceFrequency() u64 {
// "On systems that run Windows XP or later, the function will always succeed"
// https://docs.microsoft.com/en-us/windows/desktop/api/profileapi/nf-profileapi-queryperformancefrequency
var result: LARGE_INTEGER = undefined;
assert(kernel32.QueryPerformanceFrequency(&result) != 0);
// The kernel treats this integer as unsigned.
return @as(u64, @bitCast(result));
}
pub fn QueryPerformanceCounter() u64 {
// "On systems that run Windows XP or later, the function will always succeed"
// https://docs.microsoft.com/en-us/windows/desktop/api/profileapi/nf-profileapi-queryperformancecounter
var result: LARGE_INTEGER = undefined;
assert(kernel32.QueryPerformanceCounter(&result) != 0);
// The kernel treats this integer as unsigned.
return @as(u64, @bitCast(result));
}
pub fn InitOnceExecuteOnce(InitOnce: *INIT_ONCE, InitFn: INIT_ONCE_FN, Parameter: ?*anyopaque, Context: ?*anyopaque) void {
assert(kernel32.InitOnceExecuteOnce(InitOnce, InitFn, Parameter, Context) != 0);
}
pub fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: *anyopaque) void {
assert(kernel32.HeapFree(hHeap, dwFlags, lpMem) != 0);
}
pub fn HeapDestroy(hHeap: HANDLE) void {
assert(kernel32.HeapDestroy(hHeap) != 0);
}
pub fn LocalFree(hMem: HLOCAL) void {
assert(kernel32.LocalFree(hMem) == null);
}
pub const GetFileInformationByHandleError = error{Unexpected};
pub fn GetFileInformationByHandle(
hFile: HANDLE,
) GetFileInformationByHandleError!BY_HANDLE_FILE_INFORMATION {
var info: BY_HANDLE_FILE_INFORMATION = undefined;
const rc = ntdll.GetFileInformationByHandle(hFile, &info);
if (rc == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
return info;
}
pub const SetFileTimeError = error{Unexpected};
pub fn SetFileTime(
hFile: HANDLE,
lpCreationTime: ?*const FILETIME,
lpLastAccessTime: ?*const FILETIME,
lpLastWriteTime: ?*const FILETIME,
) SetFileTimeError!void {
const rc = kernel32.SetFileTime(hFile, lpCreationTime, lpLastAccessTime, lpLastWriteTime);
if (rc == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub const LockFileError = error{
SystemResources,
WouldBlock,
} || std.os.UnexpectedError;
pub fn LockFile(
FileHandle: HANDLE,
Event: ?HANDLE,
ApcRoutine: ?*IO_APC_ROUTINE,
ApcContext: ?*anyopaque,
IoStatusBlock: *IO_STATUS_BLOCK,
ByteOffset: *const LARGE_INTEGER,
Length: *const LARGE_INTEGER,
Key: ?*ULONG,
FailImmediately: BOOLEAN,
ExclusiveLock: BOOLEAN,
) !void {
const rc = ntdll.NtLockFile(
FileHandle,
Event,
ApcRoutine,
ApcContext,
IoStatusBlock,
ByteOffset,
Length,
Key,
FailImmediately,
ExclusiveLock,
);
switch (rc) {
.SUCCESS => return,
.INSUFFICIENT_RESOURCES => return error.SystemResources,
.LOCK_NOT_GRANTED => return error.WouldBlock,
.ACCESS_VIOLATION => unreachable, // bad io_status_block pointer
else => return unexpectedStatus(rc),
}
}
pub const UnlockFileError = error{
RangeNotLocked,
} || std.os.UnexpectedError;
pub fn UnlockFile(
FileHandle: HANDLE,
IoStatusBlock: *IO_STATUS_BLOCK,
ByteOffset: *const LARGE_INTEGER,
Length: *const LARGE_INTEGER,
Key: ?*ULONG,
) !void {
const rc = ntdll.NtUnlockFile(FileHandle, IoStatusBlock, ByteOffset, Length, Key);
switch (rc) {
.SUCCESS => return,
.RANGE_NOT_LOCKED => return error.RangeNotLocked,
.ACCESS_VIOLATION => unreachable, // bad io_status_block pointer
else => return unexpectedStatus(rc),
}
}
pub fn teb() *TEB {
return switch (native_arch) {
.i386 => asm volatile (
\\ movl %%fs:0x18, %[ptr]
: [ptr] "=r" (-> *TEB),
),
.x86_64 => asm volatile (
\\ movq %%gs:0x30, %[ptr]
: [ptr] "=r" (-> *TEB),
),
.aarch64 => asm volatile (
\\ mov %[ptr], x18
: [ptr] "=r" (-> *TEB),
),
else => @compileError("unsupported arch"),
};
}
pub fn peb() *PEB {
return teb().ProcessEnvironmentBlock;
}
/// A file time is a 64-bit value that represents the number of 100-nanosecond
/// intervals that have elapsed since 12:00 A.M. January 1, 1601 Coordinated
/// Universal Time (UTC).
/// This function returns the number of nanoseconds since the canonical epoch,
/// which is the POSIX one (Jan 01, 1970 AD).
pub fn fromSysTime(hns: i64) i128 {
const adjusted_epoch: i128 = hns + std.time.epoch.windows * (std.time.ns_per_s / 100);
return adjusted_epoch * 100;
}
pub fn toSysTime(ns: i128) i64 {
const hns = @divFloor(ns, 100);
return @as(i64, @intCast(hns)) - std.time.epoch.windows * (std.time.ns_per_s / 100);
}
pub fn fileTimeToNanoSeconds(ft: FILETIME) i128 {
const hns = (@as(i64, ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
return fromSysTime(hns);
}
/// Converts a number of nanoseconds since the POSIX epoch to a Windows FILETIME.
pub fn nanoSecondsToFileTime(ns: i128) FILETIME {
const adjusted = @as(u64, @bitCast(toSysTime(ns)));
return FILETIME{
.dwHighDateTime = @as(u32, @truncate(adjusted >> 32)),
.dwLowDateTime = @as(u32, @truncate(adjusted)),
};
}
pub const PathSpace = struct {
data: [PATH_MAX_WIDE:0]u16,
len: usize,
pub fn span(self: PathSpace) [:0]const u16 {
return self.data[0..self.len :0];
}
};
/// The error type for `removeDotDirsSanitized`
pub const RemoveDotDirsError = error{TooManyParentDirs};
/// Removes '.' and '..' path components from a "sanitized relative path".
/// A "sanitized path" is one where:
/// 1) all forward slashes have been replaced with back slashes
/// 2) all repeating back slashes have been collapsed
/// 3) the path is a relative one (does not start with a back slash)
pub fn removeDotDirsSanitized(comptime T: type, path: []T) RemoveDotDirsError!usize {
std.debug.assert(path.len == 0 or path[0] != '\\');
var write_idx: usize = 0;
var read_idx: usize = 0;
while (read_idx < path.len) {
if (path[read_idx] == '.') {
if (read_idx + 1 == path.len)
return write_idx;
const after_dot = path[read_idx + 1];
if (after_dot == '\\') {
read_idx += 2;
continue;
}
if (after_dot == '.' and (read_idx + 2 == path.len or path[read_idx + 2] == '\\')) {
if (write_idx == 0) return error.TooManyParentDirs;
std.debug.assert(write_idx >= 2);
write_idx -= 1;
while (true) {
write_idx -= 1;
if (write_idx == 0) break;
if (path[write_idx] == '\\') {
write_idx += 1;
break;
}
}
if (read_idx + 2 == path.len)
return write_idx;
read_idx += 3;
continue;
}
}
// skip to the next path separator
while (true) : (read_idx += 1) {
if (read_idx == path.len)
return write_idx;
path[write_idx] = path[read_idx];
write_idx += 1;
if (path[read_idx] == '\\')
break;
}
read_idx += 1;
}
return write_idx;
}
/// Normalizes a Windows path with the following steps:
/// 1) convert all forward slashes to back slashes
/// 2) collapse duplicate back slashes
/// 3) remove '.' and '..' directory parts
/// Returns the length of the new path.
pub fn normalizePath(comptime T: type, path: []T) RemoveDotDirsError!usize {
mem.replaceScalar(T, path, '/', '\\');
const new_len = mem.collapseRepeatsLen(T, path, '\\');
const prefix_len: usize = init: {
if (new_len >= 1 and path[0] == '\\') break :init 1;
if (new_len >= 2 and path[1] == ':')
break :init if (new_len >= 3 and path[2] == '\\') @as(usize, 3) else @as(usize, 2);
break :init 0;
};
return prefix_len + try removeDotDirsSanitized(T, path[prefix_len..new_len]);
}
/// Same as `sliceToPrefixedFileW` but accepts a pointer
/// to a null-terminated path.
pub fn cStrToPrefixedFileW(s: [*:0]const u8) !PathSpace {
return sliceToPrefixedFileW(mem.spanZ(s));
}
/// Converts the path `s` to WTF16, null-terminated. If the path is absolute,
/// it will get NT-style prefix `\??\` prepended automatically.
pub fn sliceToPrefixedFileW(s: []const u8) !PathSpace {
// TODO https://github.com/ziglang/zig/issues/2765
var path_space: PathSpace = undefined;
const prefix = "\\??\\";
const prefix_index: usize = if (mem.startsWith(u8, s, prefix)) prefix.len else 0;
for (s[prefix_index..]) |byte| {
switch (byte) {
'*', '?', '"', '<', '>', '|' => return error.BadPathName,
else => {},
}
}
const prefix_u16 = [_]u16{ '\\', '?', '?', '\\' };
const start_index = if (prefix_index > 0 or !std.fs.path.isAbsolute(s)) 0 else blk: {
mem.copy(u16, path_space.data[0..], prefix_u16[0..]);
break :blk prefix_u16.len;
};
path_space.len = start_index + try std.unicode.utf8ToUtf16Le(path_space.data[start_index..], s);
if (path_space.len > path_space.data.len) return error.NameTooLong;
path_space.len = start_index + (normalizePath(u16, path_space.data[start_index..path_space.len]) catch |err| switch (err) {
error.TooManyParentDirs => {
if (!std.fs.path.isAbsolute(s)) {
var temp_path: PathSpace = undefined;
temp_path.len = try std.unicode.utf8ToUtf16Le(&temp_path.data, s);
std.debug.assert(temp_path.len == path_space.len);
temp_path.data[path_space.len] = 0;
path_space.len = prefix_u16.len + try getFullPathNameW(&temp_path.data, path_space.data[prefix_u16.len..]);
mem.copy(u16, &path_space.data, &prefix_u16);
std.debug.assert(path_space.data[path_space.len] == 0);
return path_space;
}
return error.BadPathName;
},
});
path_space.data[path_space.len] = 0;
return path_space;
}
fn getFullPathNameW(path: [*:0]const u16, out: []u16) !usize {
const result = kernel32.GetFullPathNameW(path, @as(u32, @intCast(out.len)), std.meta.assumeSentinel(out.ptr, 0), null);
if (result == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
return result;
}
/// Assumes an absolute path.
pub fn wToPrefixedFileW(s: []const u16) !PathSpace {
// TODO https://github.com/ziglang/zig/issues/2765
var path_space: PathSpace = undefined;
const start_index = if (mem.startsWith(u16, s, &[_]u16{ '\\', '?' })) 0 else blk: {
const prefix = [_]u16{ '\\', '?', '?', '\\' };
mem.copy(u16, path_space.data[0..], &prefix);
break :blk prefix.len;
};
path_space.len = start_index + s.len;
if (path_space.len > path_space.data.len) return error.NameTooLong;
mem.copy(u16, path_space.data[start_index..], s);
// > File I/O functions in the Windows API convert "/" to "\" as part of
// > converting the name to an NT-style name, except when using the "\\?\"
// > prefix as detailed in the following sections.
// from https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation
// Because we want the larger maximum path length for absolute paths, we
// convert forward slashes to backward slashes here.
for (path_space.data[0..path_space.len]) |*elem| {
if (elem.* == '/') {
elem.* = '\\';
}
}
path_space.data[path_space.len] = 0;
return path_space;
}
inline fn MAKELANGID(p: c_ushort, s: c_ushort) LANGID {
return (s << 10) | p;
}
/// Loads a Winsock extension function in runtime specified by a GUID.
pub fn loadWinsockExtensionFunction(comptime T: type, sock: ws2_32.SOCKET, guid: GUID) !T {
var function: T = undefined;
var num_bytes: DWORD = undefined;
const rc = ws2_32.WSAIoctl(
sock,
ws2_32.SIO_GET_EXTENSION_FUNCTION_POINTER,
@as(*const anyopaque, @ptrCast(&guid)),
@sizeOf(GUID),
&function,
@sizeOf(T),
&num_bytes,
null,
null,
);
if (rc == ws2_32.SOCKET_ERROR) {
return switch (ws2_32.WSAGetLastError()) {
.WSAEOPNOTSUPP => error.OperationNotSupported,
.WSAENOTSOCK => error.FileDescriptorNotASocket,
else => |err| unexpectedWSAError(err),
};
}
if (num_bytes != @sizeOf(T)) {
return error.ShortRead;
}
return function;
}
/// Call this when you made a windows DLL call or something that does SetLastError
/// and you get an unexpected error.
pub fn unexpectedError(err: Win32Error) std.os.UnexpectedError {
if (std.os.unexpected_error_tracing) {
// 614 is the length of the longest windows error desciption
var buf_wstr: [614]WCHAR = undefined;
var buf_utf8: [614]u8 = undefined;
const len = kernel32.FormatMessageW(
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
null,
err,
MAKELANGID(LANG.NEUTRAL, SUBLANG.DEFAULT),
&buf_wstr,
buf_wstr.len,
null,
);
_ = std.unicode.utf16leToUtf8(&buf_utf8, buf_wstr[0..len]) catch unreachable;
std.debug.warn("error.Unexpected: GetLastError({}): {s}\n", .{ @intFromEnum(err), buf_utf8[0..len] });
std.debug.dumpCurrentStackTrace(null);
}
return error.Unexpected;
}
pub fn unexpectedWSAError(err: ws2_32.WinsockError) std.os.UnexpectedError {
return unexpectedError(@as(Win32Error, @enumFromInt(@intFromEnum(err))));
}
/// Call this when you made a windows NtDll call
/// and you get an unexpected status.
pub fn unexpectedStatus(status: NTSTATUS) std.os.UnexpectedError {
if (std.os.unexpected_error_tracing) {
std.debug.warn("error.Unexpected NTSTATUS=0x{x}\n", .{@intFromEnum(status)});
std.debug.dumpCurrentStackTrace(null);
}
return error.Unexpected;
}
pub fn SetThreadDescription(hThread: HANDLE, lpThreadDescription: LPCWSTR) !void {
if (kernel32.SetThreadDescription(hThread, lpThreadDescription) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub fn GetThreadDescription(hThread: HANDLE, ppszThreadDescription: *LPWSTR) !void {
if (kernel32.GetThreadDescription(hThread, ppszThreadDescription) == 0) {
switch (kernel32.GetLastError()) {
else => |err| return unexpectedError(err),
}
}
}
pub const Win32Error = @import("windows/win32error.zig").Win32Error;
pub const NTSTATUS = @import("windows/ntstatus.zig").NTSTATUS;
pub const LANG = @import("windows/lang.zig");
pub const SUBLANG = @import("windows/sublang.zig");
/// The standard input device. Initially, this is the console input buffer, CONIN$.
pub const STD_INPUT_HANDLE = maxInt(DWORD) - 10 + 1;
/// The standard output device. Initially, this is the active console screen buffer, CONOUT$.
pub const STD_OUTPUT_HANDLE = maxInt(DWORD) - 11 + 1;
/// The standard error device. Initially, this is the active console screen buffer, CONOUT$.
pub const STD_ERROR_HANDLE = maxInt(DWORD) - 12 + 1;
pub const WINAPI: std.builtin.CallingConvention = if (native_arch == .i386)
.Stdcall
else
.C;
pub const BOOL = c_int;
pub const BOOLEAN = BYTE;
pub const BYTE = u8;
pub const CHAR = u8;
pub const UCHAR = u8;
pub const FLOAT = f32;
pub const HANDLE = *anyopaque;
pub const HCRYPTPROV = ULONG_PTR;
pub const ATOM = u16;
pub const HBRUSH = *opaque {};
pub const HCURSOR = *opaque {};
pub const HICON = *opaque {};
pub const HINSTANCE = *opaque {};
pub const HMENU = *opaque {};
pub const HMODULE = *opaque {};
pub const HWND = *opaque {};
pub const HDC = *opaque {};
pub const HGLRC = *opaque {};
pub const FARPROC = *opaque {};
pub const INT = c_int;
pub const LPCSTR = [*:0]const CHAR;
pub const LPCVOID = *const anyopaque;
pub const LPSTR = [*:0]CHAR;
pub const LPVOID = *anyopaque;
pub const LPWSTR = [*:0]WCHAR;
pub const LPCWSTR = [*:0]const WCHAR;
pub const PVOID = *anyopaque;
pub const PWSTR = [*:0]WCHAR;
pub const SIZE_T = usize;
pub const UINT = c_uint;
pub const ULONG_PTR = usize;
pub const LONG_PTR = isize;
pub const DWORD_PTR = ULONG_PTR;
pub const WCHAR = u16;
pub const WORD = u16;
pub const DWORD = u32;
pub const DWORD64 = u64;
pub const LARGE_INTEGER = i64;
pub const ULARGE_INTEGER = u64;
pub const USHORT = u16;
pub const SHORT = i16;
pub const ULONG = u32;
pub const LONG = i32;
pub const ULONGLONG = u64;
pub const LONGLONG = i64;
pub const HLOCAL = HANDLE;
pub const LANGID = c_ushort;
pub const WPARAM = usize;
pub const LPARAM = LONG_PTR;
pub const LRESULT = LONG_PTR;
pub const va_list = *opaque {};
pub const TRUE = 1;
pub const FALSE = 0;
pub const DEVICE_TYPE = ULONG;
pub const FILE_DEVICE_BEEP: DEVICE_TYPE = 0x0001;
pub const FILE_DEVICE_CD_ROM: DEVICE_TYPE = 0x0002;
pub const FILE_DEVICE_CD_ROM_FILE_SYSTEM: DEVICE_TYPE = 0x0003;
pub const FILE_DEVICE_CONTROLLER: DEVICE_TYPE = 0x0004;
pub const FILE_DEVICE_DATALINK: DEVICE_TYPE = 0x0005;
pub const FILE_DEVICE_DFS: DEVICE_TYPE = 0x0006;
pub const FILE_DEVICE_DISK: DEVICE_TYPE = 0x0007;
pub const FILE_DEVICE_DISK_FILE_SYSTEM: DEVICE_TYPE = 0x0008;
pub const FILE_DEVICE_FILE_SYSTEM: DEVICE_TYPE = 0x0009;
pub const FILE_DEVICE_INPORT_PORT: DEVICE_TYPE = 0x000a;
pub const FILE_DEVICE_KEYBOARD: DEVICE_TYPE = 0x000b;
pub const FILE_DEVICE_MAILSLOT: DEVICE_TYPE = 0x000c;
pub const FILE_DEVICE_MIDI_IN: DEVICE_TYPE = 0x000d;
pub const FILE_DEVICE_MIDI_OUT: DEVICE_TYPE = 0x000e;
pub const FILE_DEVICE_MOUSE: DEVICE_TYPE = 0x000f;
pub const FILE_DEVICE_MULTI_UNC_PROVIDER: DEVICE_TYPE = 0x0010;
pub const FILE_DEVICE_NAMED_PIPE: DEVICE_TYPE = 0x0011;
pub const FILE_DEVICE_NETWORK: DEVICE_TYPE = 0x0012;
pub const FILE_DEVICE_NETWORK_BROWSER: DEVICE_TYPE = 0x0013;
pub const FILE_DEVICE_NETWORK_FILE_SYSTEM: DEVICE_TYPE = 0x0014;
pub const FILE_DEVICE_NULL: DEVICE_TYPE = 0x0015;
pub const FILE_DEVICE_PARALLEL_PORT: DEVICE_TYPE = 0x0016;
pub const FILE_DEVICE_PHYSICAL_NETCARD: DEVICE_TYPE = 0x0017;
pub const FILE_DEVICE_PRINTER: DEVICE_TYPE = 0x0018;
pub const FILE_DEVICE_SCANNER: DEVICE_TYPE = 0x0019;
pub const FILE_DEVICE_SERIAL_MOUSE_PORT: DEVICE_TYPE = 0x001a;
pub const FILE_DEVICE_SERIAL_PORT: DEVICE_TYPE = 0x001b;
pub const FILE_DEVICE_SCREEN: DEVICE_TYPE = 0x001c;
pub const FILE_DEVICE_SOUND: DEVICE_TYPE = 0x001d;
pub const FILE_DEVICE_STREAMS: DEVICE_TYPE = 0x001e;
pub const FILE_DEVICE_TAPE: DEVICE_TYPE = 0x001f;
pub const FILE_DEVICE_TAPE_FILE_SYSTEM: DEVICE_TYPE = 0x0020;
pub const FILE_DEVICE_TRANSPORT: DEVICE_TYPE = 0x0021;
pub const FILE_DEVICE_UNKNOWN: DEVICE_TYPE = 0x0022;
pub const FILE_DEVICE_VIDEO: DEVICE_TYPE = 0x0023;
pub const FILE_DEVICE_VIRTUAL_DISK: DEVICE_TYPE = 0x0024;
pub const FILE_DEVICE_WAVE_IN: DEVICE_TYPE = 0x0025;
pub const FILE_DEVICE_WAVE_OUT: DEVICE_TYPE = 0x0026;
pub const FILE_DEVICE_8042_PORT: DEVICE_TYPE = 0x0027;
pub const FILE_DEVICE_NETWORK_REDIRECTOR: DEVICE_TYPE = 0x0028;
pub const FILE_DEVICE_BATTERY: DEVICE_TYPE = 0x0029;
pub const FILE_DEVICE_BUS_EXTENDER: DEVICE_TYPE = 0x002a;
pub const FILE_DEVICE_MODEM: DEVICE_TYPE = 0x002b;
pub const FILE_DEVICE_VDM: DEVICE_TYPE = 0x002c;
pub const FILE_DEVICE_MASS_STORAGE: DEVICE_TYPE = 0x002d;
pub const FILE_DEVICE_SMB: DEVICE_TYPE = 0x002e;
pub const FILE_DEVICE_KS: DEVICE_TYPE = 0x002f;
pub const FILE_DEVICE_CHANGER: DEVICE_TYPE = 0x0030;
pub const FILE_DEVICE_SMARTCARD: DEVICE_TYPE = 0x0031;
pub const FILE_DEVICE_ACPI: DEVICE_TYPE = 0x0032;
pub const FILE_DEVICE_DVD: DEVICE_TYPE = 0x0033;
pub const FILE_DEVICE_FULLSCREEN_VIDEO: DEVICE_TYPE = 0x0034;
pub const FILE_DEVICE_DFS_FILE_SYSTEM: DEVICE_TYPE = 0x0035;
pub const FILE_DEVICE_DFS_VOLUME: DEVICE_TYPE = 0x0036;
pub const FILE_DEVICE_SERENUM: DEVICE_TYPE = 0x0037;
pub const FILE_DEVICE_TERMSRV: DEVICE_TYPE = 0x0038;
pub const FILE_DEVICE_KSEC: DEVICE_TYPE = 0x0039;
pub const FILE_DEVICE_FIPS: DEVICE_TYPE = 0x003a;
pub const FILE_DEVICE_INFINIBAND: DEVICE_TYPE = 0x003b;
// TODO: missing values?
pub const FILE_DEVICE_VMBUS: DEVICE_TYPE = 0x003e;
pub const FILE_DEVICE_CRYPT_PROVIDER: DEVICE_TYPE = 0x003f;
pub const FILE_DEVICE_WPD: DEVICE_TYPE = 0x0040;
pub const FILE_DEVICE_BLUETOOTH: DEVICE_TYPE = 0x0041;
pub const FILE_DEVICE_MT_COMPOSITE: DEVICE_TYPE = 0x0042;
pub const FILE_DEVICE_MT_TRANSPORT: DEVICE_TYPE = 0x0043;
pub const FILE_DEVICE_BIOMETRIC: DEVICE_TYPE = 0x0044;
pub const FILE_DEVICE_PMI: DEVICE_TYPE = 0x0045;
pub const FILE_DEVICE_EHSTOR: DEVICE_TYPE = 0x0046;
pub const FILE_DEVICE_DEVAPI: DEVICE_TYPE = 0x0047;
pub const FILE_DEVICE_GPIO: DEVICE_TYPE = 0x0048;
pub const FILE_DEVICE_USBEX: DEVICE_TYPE = 0x0049;
pub const FILE_DEVICE_CONSOLE: DEVICE_TYPE = 0x0050;
pub const FILE_DEVICE_NFP: DEVICE_TYPE = 0x0051;
pub const FILE_DEVICE_SYSENV: DEVICE_TYPE = 0x0052;
pub const FILE_DEVICE_VIRTUAL_BLOCK: DEVICE_TYPE = 0x0053;
pub const FILE_DEVICE_POINT_OF_SERVICE: DEVICE_TYPE = 0x0054;
pub const FILE_DEVICE_STORAGE_REPLICATION: DEVICE_TYPE = 0x0055;
pub const FILE_DEVICE_TRUST_ENV: DEVICE_TYPE = 0x0056;
pub const FILE_DEVICE_UCM: DEVICE_TYPE = 0x0057;
pub const FILE_DEVICE_UCMTCPCI: DEVICE_TYPE = 0x0058;
pub const FILE_DEVICE_PERSISTENT_MEMORY: DEVICE_TYPE = 0x0059;
pub const FILE_DEVICE_NVDIMM: DEVICE_TYPE = 0x005a;
pub const FILE_DEVICE_HOLOGRAPHIC: DEVICE_TYPE = 0x005b;
pub const FILE_DEVICE_SDFXHCI: DEVICE_TYPE = 0x005c;
/// https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/buffer-descriptions-for-i-o-control-codes
pub const TransferType = enum(u2) {
METHOD_BUFFERED = 0,
METHOD_IN_DIRECT = 1,
METHOD_OUT_DIRECT = 2,
METHOD_NEITHER = 3,
};
pub const FILE_ANY_ACCESS = 0;
pub const FILE_READ_ACCESS = 1;
pub const FILE_WRITE_ACCESS = 2;
/// https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/defining-i-o-control-codes
pub fn CTL_CODE(deviceType: u16, function: u12, method: TransferType, access: u2) DWORD {
return (@as(DWORD, deviceType) << 16) |
(@as(DWORD, access) << 14) |
(@as(DWORD, function) << 2) |
@intFromEnum(method);
}
pub const INVALID_HANDLE_VALUE = @as(HANDLE, @ptrFromInt(maxInt(usize)));
pub const INVALID_FILE_ATTRIBUTES = @as(DWORD, maxInt(DWORD));
pub const FILE_ALL_INFORMATION = extern struct {
BasicInformation: FILE_BASIC_INFORMATION,
StandardInformation: FILE_STANDARD_INFORMATION,
InternalInformation: FILE_INTERNAL_INFORMATION,
EaInformation: FILE_EA_INFORMATION,
AccessInformation: FILE_ACCESS_INFORMATION,
PositionInformation: FILE_POSITION_INFORMATION,
ModeInformation: FILE_MODE_INFORMATION,
AlignmentInformation: FILE_ALIGNMENT_INFORMATION,
NameInformation: FILE_NAME_INFORMATION,
};
pub const FILE_BASIC_INFORMATION = extern struct {
CreationTime: LARGE_INTEGER,
LastAccessTime: LARGE_INTEGER,
LastWriteTime: LARGE_INTEGER,
ChangeTime: LARGE_INTEGER,
FileAttributes: ULONG,
};
pub const FILE_STANDARD_INFORMATION = extern struct {
AllocationSize: LARGE_INTEGER,
EndOfFile: LARGE_INTEGER,
NumberOfLinks: ULONG,
DeletePending: BOOLEAN,
Directory: BOOLEAN,
};
pub const FILE_INTERNAL_INFORMATION = extern struct {
IndexNumber: LARGE_INTEGER,
};
pub const FILE_EA_INFORMATION = extern struct {
EaSize: ULONG,
};
pub const FILE_ACCESS_INFORMATION = extern struct {
AccessFlags: ACCESS_MASK,
};
pub const FILE_POSITION_INFORMATION = extern struct {
CurrentByteOffset: LARGE_INTEGER,
};
pub const FILE_END_OF_FILE_INFORMATION = extern struct {
EndOfFile: LARGE_INTEGER,
};
pub const FILE_MODE_INFORMATION = extern struct {
Mode: ULONG,
};
pub const FILE_ALIGNMENT_INFORMATION = extern struct {
AlignmentRequirement: ULONG,
};
pub const FILE_NAME_INFORMATION = extern struct {
FileNameLength: ULONG,
FileName: [1]WCHAR,
};
pub const FILE_RENAME_INFORMATION = extern struct {
ReplaceIfExists: BOOLEAN,
RootDirectory: ?HANDLE,
FileNameLength: ULONG,
FileName: [1]WCHAR,
};
pub const IO_STATUS_BLOCK = extern struct {
// "DUMMYUNIONNAME" expands to "u"
u: extern union {
Status: NTSTATUS,
Pointer: ?*anyopaque,
},
Information: ULONG_PTR,
};
pub const FILE_INFORMATION_CLASS = enum(c_int) {
FileDirectoryInformation = 1,
FileFullDirectoryInformation,
FileBothDirectoryInformation,
FileBasicInformation,
FileStandardInformation,
FileInternalInformation,
FileEaInformation,
FileAccessInformation,
FileNameInformation,
FileRenameInformation,
FileLinkInformation,
FileNamesInformation,
FileDispositionInformation,
FilePositionInformation,
FileFullEaInformation,
FileModeInformation,
FileAlignmentInformation,
FileAllInformation,
FileAllocationInformation,
FileEndOfFileInformation,
FileAlternateNameInformation,
FileStreamInformation,
FilePipeInformation,
FilePipeLocalInformation,
FilePipeRemoteInformation,
FileMailslotQueryInformation,
FileMailslotSetInformation,
FileCompressionInformation,
FileObjectIdInformation,
FileCompletionInformation,
FileMoveClusterInformation,
FileQuotaInformation,
FileReparsePointInformation,
FileNetworkOpenInformation,
FileAttributeTagInformation,
FileTrackingInformation,
FileIdBothDirectoryInformation,
FileIdFullDirectoryInformation,
FileValidDataLengthInformation,
FileShortNameInformation,
FileIoCompletionNotificationInformation,
FileIoStatusBlockRangeInformation,
FileIoPriorityHintInformation,
FileSfioReserveInformation,
FileSfioVolumeInformation,
FileHardLinkInformation,
FileProcessIdsUsingFileInformation,
FileNormalizedNameInformation,
FileNetworkPhysicalNameInformation,
FileIdGlobalTxDirectoryInformation,
FileIsRemoteDeviceInformation,
FileUnusedInformation,
FileNumaNodeInformation,
FileStandardLinkInformation,
FileRemoteProtocolInformation,
FileRenameInformationBypassAccessCheck,
FileLinkInformationBypassAccessCheck,
FileVolumeNameInformation,
FileIdInformation,
FileIdExtdDirectoryInformation,
FileReplaceCompletionInformation,
FileHardLinkFullIdInformation,
FileIdExtdBothDirectoryInformation,
FileDispositionInformationEx,
FileRenameInformationEx,
FileRenameInformationExBypassAccessCheck,
FileDesiredStorageClassInformation,
FileStatInformation,
FileMemoryPartitionInformation,
FileStatLxInformation,
FileCaseSensitiveInformation,
FileLinkInformationEx,
FileLinkInformationExBypassAccessCheck,
FileStorageReserveIdInformation,
FileCaseSensitiveInformationForceAccessCheck,
FileMaximumInformation,
};
pub const OVERLAPPED = extern struct {
Internal: ULONG_PTR,
InternalHigh: ULONG_PTR,
DUMMYUNIONNAME: extern union {
DUMMYSTRUCTNAME: extern struct {
Offset: DWORD,
OffsetHigh: DWORD,
},
Pointer: ?PVOID,
},
hEvent: ?HANDLE,
};
pub const OVERLAPPED_ENTRY = extern struct {
lpCompletionKey: ULONG_PTR,
lpOverlapped: *OVERLAPPED,
Internal: ULONG_PTR,
dwNumberOfBytesTransferred: DWORD,
};
pub const MAX_PATH = 260;
// TODO issue #305
pub const FILE_INFO_BY_HANDLE_CLASS = u32;
pub const FileBasicInfo = 0;
pub const FileStandardInfo = 1;
pub const FileNameInfo = 2;
pub const FileRenameInfo = 3;
pub const FileDispositionInfo = 4;
pub const FileAllocationInfo = 5;
pub const FileEndOfFileInfo = 6;
pub const FileStreamInfo = 7;
pub const FileCompressionInfo = 8;
pub const FileAttributeTagInfo = 9;
pub const FileIdBothDirectoryInfo = 10;
pub const FileIdBothDirectoryRestartInfo = 11;
pub const FileIoPriorityHintInfo = 12;
pub const FileRemoteProtocolInfo = 13;
pub const FileFullDirectoryInfo = 14;
pub const FileFullDirectoryRestartInfo = 15;
pub const FileStorageInfo = 16;
pub const FileAlignmentInfo = 17;
pub const FileIdInfo = 18;
pub const FileIdExtdDirectoryInfo = 19;
pub const FileIdExtdDirectoryRestartInfo = 20;
pub const BY_HANDLE_FILE_INFORMATION = extern struct {
dwFileAttributes: DWORD,
ftCreationTime: FILETIME,
ftLastAccessTime: FILETIME,
ftLastWriteTime: FILETIME,
dwVolumeSerialNumber: DWORD,
nFileSizeHigh: DWORD,
nFileSizeLow: DWORD,
nNumberOfLinks: DWORD,
nFileIndexHigh: DWORD,
nFileIndexLow: DWORD,
};
pub const FILE_NAME_INFO = extern struct {
FileNameLength: DWORD,
FileName: [1]WCHAR,
};
/// Return the normalized drive name. This is the default.
pub const FILE_NAME_NORMALIZED = 0x0;
/// Return the opened file name (not normalized).
pub const FILE_NAME_OPENED = 0x8;
/// Return the path with the drive letter. This is the default.
pub const VOLUME_NAME_DOS = 0x0;
/// Return the path with a volume GUID path instead of the drive name.
pub const VOLUME_NAME_GUID = 0x1;
/// Return the path with no drive information.
pub const VOLUME_NAME_NONE = 0x4;
/// Return the path with the volume device path.
pub const VOLUME_NAME_NT = 0x2;
pub const SECURITY_ATTRIBUTES = extern struct {
nLength: DWORD,
lpSecurityDescriptor: ?*anyopaque,
bInheritHandle: BOOL,
};
pub const PIPE_ACCESS_INBOUND = 0x00000001;
pub const PIPE_ACCESS_OUTBOUND = 0x00000002;
pub const PIPE_ACCESS_DUPLEX = 0x00000003;
pub const PIPE_TYPE_BYTE = 0x00000000;
pub const PIPE_TYPE_MESSAGE = 0x00000004;
pub const PIPE_READMODE_BYTE = 0x00000000;
pub const PIPE_READMODE_MESSAGE = 0x00000002;
pub const PIPE_WAIT = 0x00000000;
pub const PIPE_NOWAIT = 0x00000001;
pub const GENERIC_READ = 0x80000000;
pub const GENERIC_WRITE = 0x40000000;
pub const GENERIC_EXECUTE = 0x20000000;
pub const GENERIC_ALL = 0x10000000;
pub const FILE_SHARE_DELETE = 0x00000004;
pub const FILE_SHARE_READ = 0x00000001;
pub const FILE_SHARE_WRITE = 0x00000002;
pub const DELETE = 0x00010000;
pub const READ_CONTROL = 0x00020000;
pub const WRITE_DAC = 0x00040000;
pub const WRITE_OWNER = 0x00080000;
pub const SYNCHRONIZE = 0x00100000;
pub const STANDARD_RIGHTS_READ = READ_CONTROL;
pub const STANDARD_RIGHTS_WRITE = READ_CONTROL;
pub const STANDARD_RIGHTS_EXECUTE = READ_CONTROL;
pub const STANDARD_RIGHTS_REQUIRED = DELETE | READ_CONTROL | WRITE_DAC | WRITE_OWNER;
// disposition for NtCreateFile
pub const FILE_SUPERSEDE = 0;
pub const FILE_OPEN = 1;
pub const FILE_CREATE = 2;
pub const FILE_OPEN_IF = 3;
pub const FILE_OVERWRITE = 4;
pub const FILE_OVERWRITE_IF = 5;
pub const FILE_MAXIMUM_DISPOSITION = 5;
// flags for NtCreateFile and NtOpenFile
pub const FILE_READ_DATA = 0x00000001;
pub const FILE_LIST_DIRECTORY = 0x00000001;
pub const FILE_WRITE_DATA = 0x00000002;
pub const FILE_ADD_FILE = 0x00000002;
pub const FILE_APPEND_DATA = 0x00000004;
pub const FILE_ADD_SUBDIRECTORY = 0x00000004;
pub const FILE_CREATE_PIPE_INSTANCE = 0x00000004;
pub const FILE_READ_EA = 0x00000008;
pub const FILE_WRITE_EA = 0x00000010;
pub const FILE_EXECUTE = 0x00000020;
pub const FILE_TRAVERSE = 0x00000020;
pub const FILE_DELETE_CHILD = 0x00000040;
pub const FILE_READ_ATTRIBUTES = 0x00000080;
pub const FILE_WRITE_ATTRIBUTES = 0x00000100;
pub const FILE_DIRECTORY_FILE = 0x00000001;
pub const FILE_WRITE_THROUGH = 0x00000002;
pub const FILE_SEQUENTIAL_ONLY = 0x00000004;
pub const FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008;
pub const FILE_SYNCHRONOUS_IO_ALERT = 0x00000010;
pub const FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020;
pub const FILE_NON_DIRECTORY_FILE = 0x00000040;
pub const FILE_CREATE_TREE_CONNECTION = 0x00000080;
pub const FILE_COMPLETE_IF_OPLOCKED = 0x00000100;
pub const FILE_NO_EA_KNOWLEDGE = 0x00000200;
pub const FILE_OPEN_FOR_RECOVERY = 0x00000400;
pub const FILE_RANDOM_ACCESS = 0x00000800;
pub const FILE_DELETE_ON_CLOSE = 0x00001000;
pub const FILE_OPEN_BY_FILE_ID = 0x00002000;
pub const FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000;
pub const FILE_NO_COMPRESSION = 0x00008000;
pub const FILE_RESERVE_OPFILTER = 0x00100000;
pub const FILE_OPEN_REPARSE_POINT = 0x00200000;
pub const FILE_OPEN_OFFLINE_FILE = 0x00400000;
pub const FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000;
pub const CREATE_ALWAYS = 2;
pub const CREATE_NEW = 1;
pub const OPEN_ALWAYS = 4;
pub const OPEN_EXISTING = 3;
pub const TRUNCATE_EXISTING = 5;
pub const FILE_ATTRIBUTE_ARCHIVE = 0x20;
pub const FILE_ATTRIBUTE_COMPRESSED = 0x800;
pub const FILE_ATTRIBUTE_DEVICE = 0x40;
pub const FILE_ATTRIBUTE_DIRECTORY = 0x10;
pub const FILE_ATTRIBUTE_ENCRYPTED = 0x4000;
pub const FILE_ATTRIBUTE_HIDDEN = 0x2;
pub const FILE_ATTRIBUTE_INTEGRITY_STREAM = 0x8000;
pub const FILE_ATTRIBUTE_NORMAL = 0x80;
pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x2000;
pub const FILE_ATTRIBUTE_NO_SCRUB_DATA = 0x20000;
pub const FILE_ATTRIBUTE_OFFLINE = 0x1000;
pub const FILE_ATTRIBUTE_READONLY = 0x1;
pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS = 0x400000;
pub const FILE_ATTRIBUTE_RECALL_ON_OPEN = 0x40000;
pub const FILE_ATTRIBUTE_REPARSE_POINT = 0x400;
pub const FILE_ATTRIBUTE_SPARSE_FILE = 0x200;
pub const FILE_ATTRIBUTE_SYSTEM = 0x4;
pub const FILE_ATTRIBUTE_TEMPORARY = 0x100;
pub const FILE_ATTRIBUTE_VIRTUAL = 0x10000;
// flags for CreateEvent
pub const CREATE_EVENT_INITIAL_SET = 0x00000002;
pub const CREATE_EVENT_MANUAL_RESET = 0x00000001;
pub const EVENT_ALL_ACCESS = 0x1F0003;
pub const EVENT_MODIFY_STATE = 0x0002;
pub const PROCESS_INFORMATION = extern struct {
hProcess: HANDLE,
hThread: HANDLE,
dwProcessId: DWORD,
dwThreadId: DWORD,
};
pub const STARTUPINFOW = extern struct {
cb: DWORD,
lpReserved: ?LPWSTR,
lpDesktop: ?LPWSTR,
lpTitle: ?LPWSTR,
dwX: DWORD,
dwY: DWORD,
dwXSize: DWORD,
dwYSize: DWORD,
dwXCountChars: DWORD,
dwYCountChars: DWORD,
dwFillAttribute: DWORD,
dwFlags: DWORD,
wShowWindow: WORD,
cbReserved2: WORD,
lpReserved2: ?*BYTE,
hStdInput: ?HANDLE,
hStdOutput: ?HANDLE,
hStdError: ?HANDLE,
};
pub const STARTF_FORCEONFEEDBACK = 0x00000040;
pub const STARTF_FORCEOFFFEEDBACK = 0x00000080;
pub const STARTF_PREVENTPINNING = 0x00002000;
pub const STARTF_RUNFULLSCREEN = 0x00000020;
pub const STARTF_TITLEISAPPID = 0x00001000;
pub const STARTF_TITLEISLINKNAME = 0x00000800;
pub const STARTF_UNTRUSTEDSOURCE = 0x00008000;
pub const STARTF_USECOUNTCHARS = 0x00000008;
pub const STARTF_USEFILLATTRIBUTE = 0x00000010;
pub const STARTF_USEHOTKEY = 0x00000200;
pub const STARTF_USEPOSITION = 0x00000004;
pub const STARTF_USESHOWWINDOW = 0x00000001;
pub const STARTF_USESIZE = 0x00000002;
pub const STARTF_USESTDHANDLES = 0x00000100;
pub const INFINITE = 4294967295;
pub const MAXIMUM_WAIT_OBJECTS = 64;
pub const WAIT_ABANDONED = 0x00000080;
pub const WAIT_ABANDONED_0 = WAIT_ABANDONED + 0;
pub const WAIT_OBJECT_0 = 0x00000000;
pub const WAIT_TIMEOUT = 0x00000102;
pub const WAIT_FAILED = 0xFFFFFFFF;
pub const HANDLE_FLAG_INHERIT = 0x00000001;
pub const HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002;
pub const MOVEFILE_COPY_ALLOWED = 2;
pub const MOVEFILE_CREATE_HARDLINK = 16;
pub const MOVEFILE_DELAY_UNTIL_REBOOT = 4;
pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE = 32;
pub const MOVEFILE_REPLACE_EXISTING = 1;
pub const MOVEFILE_WRITE_THROUGH = 8;
pub const FILE_BEGIN = 0;
pub const FILE_CURRENT = 1;
pub const FILE_END = 2;
pub const HEAP_CREATE_ENABLE_EXECUTE = 0x00040000;
pub const HEAP_REALLOC_IN_PLACE_ONLY = 0x00000010;
pub const HEAP_GENERATE_EXCEPTIONS = 0x00000004;
pub const HEAP_NO_SERIALIZE = 0x00000001;
// AllocationType values
pub const MEM_COMMIT = 0x1000;
pub const MEM_RESERVE = 0x2000;
pub const MEM_RESET = 0x80000;
pub const MEM_RESET_UNDO = 0x1000000;
pub const MEM_LARGE_PAGES = 0x20000000;
pub const MEM_PHYSICAL = 0x400000;
pub const MEM_TOP_DOWN = 0x100000;
pub const MEM_WRITE_WATCH = 0x200000;
// Protect values
pub const PAGE_EXECUTE = 0x10;
pub const PAGE_EXECUTE_READ = 0x20;
pub const PAGE_EXECUTE_READWRITE = 0x40;
pub const PAGE_EXECUTE_WRITECOPY = 0x80;
pub const PAGE_NOACCESS = 0x01;
pub const PAGE_READONLY = 0x02;
pub const PAGE_READWRITE = 0x04;
pub const PAGE_WRITECOPY = 0x08;
pub const PAGE_TARGETS_INVALID = 0x40000000;
pub const PAGE_TARGETS_NO_UPDATE = 0x40000000; // Same as PAGE_TARGETS_INVALID
pub const PAGE_GUARD = 0x100;
pub const PAGE_NOCACHE = 0x200;
pub const PAGE_WRITECOMBINE = 0x400;
// FreeType values
pub const MEM_COALESCE_PLACEHOLDERS = 0x1;
pub const MEM_RESERVE_PLACEHOLDERS = 0x2;
pub const MEM_DECOMMIT = 0x4000;
pub const MEM_RELEASE = 0x8000;
pub const PTHREAD_START_ROUTINE = fn (LPVOID) callconv(.C) DWORD;
pub const LPTHREAD_START_ROUTINE = PTHREAD_START_ROUTINE;
pub const WIN32_FIND_DATAW = extern struct {
dwFileAttributes: DWORD,
ftCreationTime: FILETIME,
ftLastAccessTime: FILETIME,
ftLastWriteTime: FILETIME,
nFileSizeHigh: DWORD,
nFileSizeLow: DWORD,
dwReserved0: DWORD,
dwReserved1: DWORD,
cFileName: [260]u16,
cAlternateFileName: [14]u16,
};
pub const FILETIME = extern struct {
dwLowDateTime: DWORD,
dwHighDateTime: DWORD,
};
pub const SYSTEM_INFO = extern struct {
anon1: extern union {
dwOemId: DWORD,
anon2: extern struct {
wProcessorArchitecture: WORD,
wReserved: WORD,
},
},
dwPageSize: DWORD,
lpMinimumApplicationAddress: LPVOID,
lpMaximumApplicationAddress: LPVOID,
dwActiveProcessorMask: DWORD_PTR,
dwNumberOfProcessors: DWORD,
dwProcessorType: DWORD,
dwAllocationGranularity: DWORD,
wProcessorLevel: WORD,
wProcessorRevision: WORD,
};
pub const HRESULT = c_long;
pub const KNOWNFOLDERID = GUID;
pub const GUID = extern struct {
Data1: c_ulong,
Data2: c_ushort,
Data3: c_ushort,
Data4: [8]u8,
pub fn parse(str: []const u8) GUID {
var guid: GUID = undefined;
var index: usize = 0;
assert(str[index] == '{');
index += 1;
guid.Data1 = std.fmt.parseUnsigned(c_ulong, str[index .. index + 8], 16) catch unreachable;
index += 8;
assert(str[index] == '-');
index += 1;
guid.Data2 = std.fmt.parseUnsigned(c_ushort, str[index .. index + 4], 16) catch unreachable;
index += 4;
assert(str[index] == '-');
index += 1;
guid.Data3 = std.fmt.parseUnsigned(c_ushort, str[index .. index + 4], 16) catch unreachable;
index += 4;
assert(str[index] == '-');
index += 1;
guid.Data4[0] = std.fmt.parseUnsigned(u8, str[index .. index + 2], 16) catch unreachable;
index += 2;
guid.Data4[1] = std.fmt.parseUnsigned(u8, str[index .. index + 2], 16) catch unreachable;
index += 2;
assert(str[index] == '-');
index += 1;
var i: usize = 2;
while (i < guid.Data4.len) : (i += 1) {
guid.Data4[i] = std.fmt.parseUnsigned(u8, str[index .. index + 2], 16) catch unreachable;
index += 2;
}
assert(str[index] == '}');
index += 1;
return guid;
}
};
pub const FOLDERID_LocalAppData = GUID.parse("{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}");
pub const KF_FLAG_DEFAULT = 0;
pub const KF_FLAG_NO_APPCONTAINER_REDIRECTION = 65536;
pub const KF_FLAG_CREATE = 32768;
pub const KF_FLAG_DONT_VERIFY = 16384;
pub const KF_FLAG_DONT_UNEXPAND = 8192;
pub const KF_FLAG_NO_ALIAS = 4096;
pub const KF_FLAG_INIT = 2048;
pub const KF_FLAG_DEFAULT_PATH = 1024;
pub const KF_FLAG_NOT_PARENT_RELATIVE = 512;
pub const KF_FLAG_SIMPLE_IDLIST = 256;
pub const KF_FLAG_ALIAS_ONLY = -2147483648;
pub const S_OK = 0;
pub const E_NOTIMPL = @as(c_long, @bitCast(@as(c_ulong, 0x80004001)));
pub const E_NOINTERFACE = @as(c_long, @bitCast(@as(c_ulong, 0x80004002)));
pub const E_POINTER = @as(c_long, @bitCast(@as(c_ulong, 0x80004003)));
pub const E_ABORT = @as(c_long, @bitCast(@as(c_ulong, 0x80004004)));
pub const E_FAIL = @as(c_long, @bitCast(@as(c_ulong, 0x80004005)));
pub const E_UNEXPECTED = @as(c_long, @bitCast(@as(c_ulong, 0x8000FFFF)));
pub const E_ACCESSDENIED = @as(c_long, @bitCast(@as(c_ulong, 0x80070005)));
pub const E_HANDLE = @as(c_long, @bitCast(@as(c_ulong, 0x80070006)));
pub const E_OUTOFMEMORY = @as(c_long, @bitCast(@as(c_ulong, 0x8007000E)));
pub const E_INVALIDARG = @as(c_long, @bitCast(@as(c_ulong, 0x80070057)));
pub const FILE_FLAG_BACKUP_SEMANTICS = 0x02000000;
pub const FILE_FLAG_DELETE_ON_CLOSE = 0x04000000;
pub const FILE_FLAG_NO_BUFFERING = 0x20000000;
pub const FILE_FLAG_OPEN_NO_RECALL = 0x00100000;
pub const FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000;
pub const FILE_FLAG_OVERLAPPED = 0x40000000;
pub const FILE_FLAG_POSIX_SEMANTICS = 0x0100000;
pub const FILE_FLAG_RANDOM_ACCESS = 0x10000000;
pub const FILE_FLAG_SESSION_AWARE = 0x00800000;
pub const FILE_FLAG_SEQUENTIAL_SCAN = 0x08000000;
pub const FILE_FLAG_WRITE_THROUGH = 0x80000000;
pub const RECT = extern struct {
left: LONG,
top: LONG,
right: LONG,
bottom: LONG,
};
pub const SMALL_RECT = extern struct {
Left: SHORT,
Top: SHORT,
Right: SHORT,
Bottom: SHORT,
};
pub const POINT = extern struct {
x: LONG,
y: LONG,
};
pub const COORD = extern struct {
X: SHORT,
Y: SHORT,
};
pub const CREATE_UNICODE_ENVIRONMENT = 1024;
pub const TLS_OUT_OF_INDEXES = 4294967295;
pub const IMAGE_TLS_DIRECTORY = extern struct {
StartAddressOfRawData: usize,
EndAddressOfRawData: usize,
AddressOfIndex: usize,
AddressOfCallBacks: usize,
SizeOfZeroFill: u32,
Characteristics: u32,
};
pub const IMAGE_TLS_DIRECTORY64 = IMAGE_TLS_DIRECTORY;
pub const IMAGE_TLS_DIRECTORY32 = IMAGE_TLS_DIRECTORY;
pub const PIMAGE_TLS_CALLBACK = ?fn (PVOID, DWORD, PVOID) callconv(.C) void;
pub const PROV_RSA_FULL = 1;
pub const REGSAM = ACCESS_MASK;
pub const ACCESS_MASK = DWORD;
pub const HKEY = *HKEY__;
pub const HKEY__ = extern struct {
unused: c_int,
};
pub const LSTATUS = LONG;
pub const FILE_NOTIFY_INFORMATION = extern struct {
NextEntryOffset: DWORD,
Action: DWORD,
FileNameLength: DWORD,
// Flexible array member
// FileName: [1]WCHAR,
};
pub const FILE_ACTION_ADDED = 0x00000001;
pub const FILE_ACTION_REMOVED = 0x00000002;
pub const FILE_ACTION_MODIFIED = 0x00000003;
pub const FILE_ACTION_RENAMED_OLD_NAME = 0x00000004;
pub const FILE_ACTION_RENAMED_NEW_NAME = 0x00000005;
pub const LPOVERLAPPED_COMPLETION_ROUTINE = ?fn (DWORD, DWORD, *OVERLAPPED) callconv(.C) void;
pub const FILE_NOTIFY_CHANGE_CREATION = 64;
pub const FILE_NOTIFY_CHANGE_SIZE = 8;
pub const FILE_NOTIFY_CHANGE_SECURITY = 256;
pub const FILE_NOTIFY_CHANGE_LAST_ACCESS = 32;
pub const FILE_NOTIFY_CHANGE_LAST_WRITE = 16;
pub const FILE_NOTIFY_CHANGE_DIR_NAME = 2;
pub const FILE_NOTIFY_CHANGE_FILE_NAME = 1;
pub const FILE_NOTIFY_CHANGE_ATTRIBUTES = 4;
pub const CONSOLE_SCREEN_BUFFER_INFO = extern struct {
dwSize: COORD,
dwCursorPosition: COORD,
wAttributes: WORD,
srWindow: SMALL_RECT,
dwMaximumWindowSize: COORD,
};
pub const FOREGROUND_BLUE = 1;
pub const FOREGROUND_GREEN = 2;
pub const FOREGROUND_RED = 4;
pub const FOREGROUND_INTENSITY = 8;
pub const LIST_ENTRY = extern struct {
Flink: *LIST_ENTRY,
Blink: *LIST_ENTRY,
};
pub const RTL_CRITICAL_SECTION_DEBUG = extern struct {
Type: WORD,
CreatorBackTraceIndex: WORD,
CriticalSection: *RTL_CRITICAL_SECTION,
ProcessLocksList: LIST_ENTRY,
EntryCount: DWORD,
ContentionCount: DWORD,
Flags: DWORD,
CreatorBackTraceIndexHigh: WORD,
SpareWORD: WORD,
};
pub const RTL_CRITICAL_SECTION = extern struct {
DebugInfo: *RTL_CRITICAL_SECTION_DEBUG,
LockCount: LONG,
RecursionCount: LONG,
OwningThread: HANDLE,
LockSemaphore: HANDLE,
SpinCount: ULONG_PTR,
};
pub const CRITICAL_SECTION = RTL_CRITICAL_SECTION;
pub const INIT_ONCE = RTL_RUN_ONCE;
pub const INIT_ONCE_STATIC_INIT = RTL_RUN_ONCE_INIT;
pub const INIT_ONCE_FN = fn (InitOnce: *INIT_ONCE, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(.C) BOOL;
pub const RTL_RUN_ONCE = extern struct {
Ptr: ?*anyopaque,
};
pub const RTL_RUN_ONCE_INIT = RTL_RUN_ONCE{ .Ptr = null };
pub const COINIT_APARTMENTTHREADED = COINIT.COINIT_APARTMENTTHREADED;
pub const COINIT_MULTITHREADED = COINIT.COINIT_MULTITHREADED;
pub const COINIT_DISABLE_OLE1DDE = COINIT.COINIT_DISABLE_OLE1DDE;
pub const COINIT_SPEED_OVER_MEMORY = COINIT.COINIT_SPEED_OVER_MEMORY;
pub const COINIT = enum(c_int) {
COINIT_APARTMENTTHREADED = 2,
COINIT_MULTITHREADED = 0,
COINIT_DISABLE_OLE1DDE = 4,
COINIT_SPEED_OVER_MEMORY = 8,
};
/// > The maximum path of 32,767 characters is approximate, because the "\\?\"
/// > prefix may be expanded to a longer string by the system at run time, and
/// > this expansion applies to the total length.
/// from https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file#maximum-path-length-limitation
pub const PATH_MAX_WIDE = 32767;
pub const FORMAT_MESSAGE_ALLOCATE_BUFFER = 0x00000100;
pub const FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
pub const FORMAT_MESSAGE_FROM_HMODULE = 0x00000800;
pub const FORMAT_MESSAGE_FROM_STRING = 0x00000400;
pub const FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
pub const FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
pub const FORMAT_MESSAGE_MAX_WIDTH_MASK = 0x000000FF;
pub const EXCEPTION_DATATYPE_MISALIGNMENT = 0x80000002;
pub const EXCEPTION_ACCESS_VIOLATION = 0xc0000005;
pub const EXCEPTION_ILLEGAL_INSTRUCTION = 0xc000001d;
pub const EXCEPTION_STACK_OVERFLOW = 0xc00000fd;
pub const EXCEPTION_CONTINUE_SEARCH = 0;
pub const EXCEPTION_RECORD = extern struct {
ExceptionCode: u32,
ExceptionFlags: u32,
ExceptionRecord: *EXCEPTION_RECORD,
ExceptionAddress: *anyopaque,
NumberParameters: u32,
ExceptionInformation: [15]usize,
};
pub usingnamespace switch (native_arch) {
.i386 => struct {
pub const FLOATING_SAVE_AREA = extern struct {
ControlWord: DWORD,
StatusWord: DWORD,
TagWord: DWORD,
ErrorOffset: DWORD,
ErrorSelector: DWORD,
DataOffset: DWORD,
DataSelector: DWORD,
RegisterArea: [80]BYTE,
Cr0NpxState: DWORD,
};
pub const CONTEXT = extern struct {
ContextFlags: DWORD,
Dr0: DWORD,
Dr1: DWORD,
Dr2: DWORD,
Dr3: DWORD,
Dr6: DWORD,
Dr7: DWORD,
FloatSave: FLOATING_SAVE_AREA,
SegGs: DWORD,
SegFs: DWORD,
SegEs: DWORD,
SegDs: DWORD,
Edi: DWORD,
Esi: DWORD,
Ebx: DWORD,
Edx: DWORD,
Ecx: DWORD,
Eax: DWORD,
Ebp: DWORD,
Eip: DWORD,
SegCs: DWORD,
EFlags: DWORD,
Esp: DWORD,
SegSs: DWORD,
ExtendedRegisters: [512]BYTE,
pub fn getRegs(ctx: *const CONTEXT) struct { bp: usize, ip: usize } {
return .{ .bp = ctx.Ebp, .ip = ctx.Eip };
}
};
},
.x86_64 => struct {
pub const M128A = extern struct {
Low: ULONGLONG,
High: LONGLONG,
};
pub const XMM_SAVE_AREA32 = extern struct {
ControlWord: WORD,
StatusWord: WORD,
TagWord: BYTE,
Reserved1: BYTE,
ErrorOpcode: WORD,
ErrorOffset: DWORD,
ErrorSelector: WORD,
Reserved2: WORD,
DataOffset: DWORD,
DataSelector: WORD,
Reserved3: WORD,
MxCsr: DWORD,
MxCsr_Mask: DWORD,
FloatRegisters: [8]M128A,
XmmRegisters: [16]M128A,
Reserved4: [96]BYTE,
};
pub const CONTEXT = extern struct {
P1Home: DWORD64,
P2Home: DWORD64,
P3Home: DWORD64,
P4Home: DWORD64,
P5Home: DWORD64,
P6Home: DWORD64,
ContextFlags: DWORD,
MxCsr: DWORD,
SegCs: WORD,
SegDs: WORD,
SegEs: WORD,
SegFs: WORD,
SegGs: WORD,
SegSs: WORD,
EFlags: DWORD,
Dr0: DWORD64,
Dr1: DWORD64,
Dr2: DWORD64,
Dr3: DWORD64,
Dr6: DWORD64,
Dr7: DWORD64,
Rax: DWORD64,
Rcx: DWORD64,
Rdx: DWORD64,
Rbx: DWORD64,
Rsp: DWORD64,
Rbp: DWORD64,
Rsi: DWORD64,
Rdi: DWORD64,
R8: DWORD64,
R9: DWORD64,
R10: DWORD64,
R11: DWORD64,
R12: DWORD64,
R13: DWORD64,
R14: DWORD64,
R15: DWORD64,
Rip: DWORD64,
DUMMYUNIONNAME: extern union {
FltSave: XMM_SAVE_AREA32,
FloatSave: XMM_SAVE_AREA32,
DUMMYSTRUCTNAME: extern struct {
Header: [2]M128A,
Legacy: [8]M128A,
Xmm0: M128A,
Xmm1: M128A,
Xmm2: M128A,
Xmm3: M128A,
Xmm4: M128A,
Xmm5: M128A,
Xmm6: M128A,
Xmm7: M128A,
Xmm8: M128A,
Xmm9: M128A,
Xmm10: M128A,
Xmm11: M128A,
Xmm12: M128A,
Xmm13: M128A,
Xmm14: M128A,
Xmm15: M128A,
},
},
VectorRegister: [26]M128A,
VectorControl: DWORD64,
DebugControl: DWORD64,
LastBranchToRip: DWORD64,
LastBranchFromRip: DWORD64,
LastExceptionToRip: DWORD64,
LastExceptionFromRip: DWORD64,
pub fn getRegs(ctx: *const CONTEXT) struct { bp: usize, ip: usize } {
return .{ .bp = ctx.Rbp, .ip = ctx.Rip };
}
};
},
.aarch64 => struct {
pub const NEON128 = extern union {
DUMMYSTRUCTNAME: extern struct {
Low: ULONGLONG,
High: LONGLONG,
},
D: [2]f64,
S: [4]f32,
H: [8]WORD,
B: [16]BYTE,
};
pub const CONTEXT = extern struct {
ContextFlags: ULONG,
Cpsr: ULONG,
DUMMYUNIONNAME: extern union {
DUMMYSTRUCTNAME: extern struct {
X0: DWORD64,
X1: DWORD64,
X2: DWORD64,
X3: DWORD64,
X4: DWORD64,
X5: DWORD64,
X6: DWORD64,
X7: DWORD64,
X8: DWORD64,
X9: DWORD64,
X10: DWORD64,
X11: DWORD64,
X12: DWORD64,
X13: DWORD64,
X14: DWORD64,
X15: DWORD64,
X16: DWORD64,
X17: DWORD64,
X18: DWORD64,
X19: DWORD64,
X20: DWORD64,
X21: DWORD64,
X22: DWORD64,
X23: DWORD64,
X24: DWORD64,
X25: DWORD64,
X26: DWORD64,
X27: DWORD64,
X28: DWORD64,
Fp: DWORD64,
Lr: DWORD64,
},
X: [31]DWORD64,
},
Sp: DWORD64,
Pc: DWORD64,
V: [32]NEON128,
Fpcr: DWORD,
Fpsr: DWORD,
Bcr: [8]DWORD,
Bvr: [8]DWORD64,
Wcr: [2]DWORD,
Wvr: [2]DWORD64,
pub fn getRegs(ctx: *const CONTEXT) struct { bp: usize, ip: usize } {
return .{
.bp = ctx.DUMMYUNIONNAME.DUMMYSTRUCTNAME.Fp,
.ip = ctx.Pc,
};
}
};
},
else => struct {},
};
pub const EXCEPTION_POINTERS = extern struct {
ExceptionRecord: *EXCEPTION_RECORD,
ContextRecord: *std.os.windows.CONTEXT,
};
pub const VECTORED_EXCEPTION_HANDLER = fn (ExceptionInfo: *EXCEPTION_POINTERS) callconv(WINAPI) c_long;
pub const OBJECT_ATTRIBUTES = extern struct {
Length: ULONG,
RootDirectory: ?HANDLE,
ObjectName: *UNICODE_STRING,
Attributes: ULONG,
SecurityDescriptor: ?*anyopaque,
SecurityQualityOfService: ?*anyopaque,
};
pub const OBJ_INHERIT = 0x00000002;
pub const OBJ_PERMANENT = 0x00000010;
pub const OBJ_EXCLUSIVE = 0x00000020;
pub const OBJ_CASE_INSENSITIVE = 0x00000040;
pub const OBJ_OPENIF = 0x00000080;
pub const OBJ_OPENLINK = 0x00000100;
pub const OBJ_KERNEL_HANDLE = 0x00000200;
pub const OBJ_VALID_ATTRIBUTES = 0x000003F2;
pub const UNICODE_STRING = extern struct {
Length: c_ushort,
MaximumLength: c_ushort,
Buffer: [*]WCHAR,
};
pub const ACTIVATION_CONTEXT_DATA = opaque {};
pub const ASSEMBLY_STORAGE_MAP = opaque {};
pub const FLS_CALLBACK_INFO = opaque {};
pub const RTL_BITMAP = opaque {};
pub const KAFFINITY = usize;
pub const TEB = extern struct {
Reserved1: [12]PVOID,
ProcessEnvironmentBlock: *PEB,
Reserved2: [399]PVOID,
Reserved3: [1952]u8,
TlsSlots: [64]PVOID,
Reserved4: [8]u8,
Reserved5: [26]PVOID,
ReservedForOle: PVOID,
Reserved6: [4]PVOID,
TlsExpansionSlots: PVOID,
};
/// Process Environment Block
/// Microsoft documentation of this is incomplete, the fields here are taken from various resources including:
/// - https://github.com/wine-mirror/wine/blob/1aff1e6a370ee8c0213a0fd4b220d121da8527aa/include/winternl.h#L269
/// - https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb/index.htm
pub const PEB = extern struct {
// Versions: All
InheritedAddressSpace: BOOLEAN,
// Versions: 3.51+
ReadImageFileExecOptions: BOOLEAN,
BeingDebugged: BOOLEAN,
// Versions: 5.2+ (previously was padding)
BitField: UCHAR,
// Versions: all
Mutant: HANDLE,
ImageBaseAddress: HMODULE,
Ldr: *PEB_LDR_DATA,
ProcessParameters: *RTL_USER_PROCESS_PARAMETERS,
SubSystemData: PVOID,
ProcessHeap: HANDLE,
// Versions: 5.1+
FastPebLock: *RTL_CRITICAL_SECTION,
// Versions: 5.2+
AtlThunkSListPtr: PVOID,
IFEOKey: PVOID,
// Versions: 6.0+
/// https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb/crossprocessflags.htm
CrossProcessFlags: ULONG,
// Versions: 6.0+
union1: extern union {
KernelCallbackTable: PVOID,
UserSharedInfoPtr: PVOID,
},
// Versions: 5.1+
SystemReserved: ULONG,
// Versions: 5.1, (not 5.2, not 6.0), 6.1+
AtlThunkSListPtr32: ULONG,
// Versions: 6.1+
ApiSetMap: PVOID,
// Versions: all
TlsExpansionCounter: ULONG,
// note: there is padding here on 64 bit
TlsBitmap: *RTL_BITMAP,
TlsBitmapBits: [2]ULONG,
ReadOnlySharedMemoryBase: PVOID,
// Versions: 1703+
SharedData: PVOID,
// Versions: all
ReadOnlyStaticServerData: *PVOID,
AnsiCodePageData: PVOID,
OemCodePageData: PVOID,
UnicodeCaseTableData: PVOID,
// Versions: 3.51+
NumberOfProcessors: ULONG,
NtGlobalFlag: ULONG,
// Versions: all
CriticalSectionTimeout: LARGE_INTEGER,
// End of Original PEB size
// Fields appended in 3.51:
HeapSegmentReserve: ULONG_PTR,
HeapSegmentCommit: ULONG_PTR,
HeapDeCommitTotalFreeThreshold: ULONG_PTR,
HeapDeCommitFreeBlockThreshold: ULONG_PTR,
NumberOfHeaps: ULONG,
MaximumNumberOfHeaps: ULONG,
ProcessHeaps: *PVOID,
// Fields appended in 4.0:
GdiSharedHandleTable: PVOID,
ProcessStarterHelper: PVOID,
GdiDCAttributeList: ULONG,
// note: there is padding here on 64 bit
LoaderLock: *RTL_CRITICAL_SECTION,
OSMajorVersion: ULONG,
OSMinorVersion: ULONG,
OSBuildNumber: USHORT,
OSCSDVersion: USHORT,
OSPlatformId: ULONG,
ImageSubSystem: ULONG,
ImageSubSystemMajorVersion: ULONG,
ImageSubSystemMinorVersion: ULONG,
// note: there is padding here on 64 bit
ActiveProcessAffinityMask: KAFFINITY,
GdiHandleBuffer: [
switch (@sizeOf(usize)) {
4 => 0x22,
8 => 0x3C,
else => unreachable,
}
]ULONG,
// Fields appended in 5.0 (Windows 2000):
PostProcessInitRoutine: PVOID,
TlsExpansionBitmap: *RTL_BITMAP,
TlsExpansionBitmapBits: [32]ULONG,
SessionId: ULONG,
// note: there is padding here on 64 bit
// Versions: 5.1+
AppCompatFlags: ULARGE_INTEGER,
AppCompatFlagsUser: ULARGE_INTEGER,
ShimData: PVOID,
// Versions: 5.0+
AppCompatInfo: PVOID,
CSDVersion: UNICODE_STRING,
// Fields appended in 5.1 (Windows XP):
ActivationContextData: *const ACTIVATION_CONTEXT_DATA,
ProcessAssemblyStorageMap: *ASSEMBLY_STORAGE_MAP,
SystemDefaultActivationData: *const ACTIVATION_CONTEXT_DATA,
SystemAssemblyStorageMap: *ASSEMBLY_STORAGE_MAP,
MinimumStackCommit: ULONG_PTR,
// Fields appended in 5.2 (Windows Server 2003):
FlsCallback: *FLS_CALLBACK_INFO,
FlsListHead: LIST_ENTRY,
FlsBitmap: *RTL_BITMAP,
FlsBitmapBits: [4]ULONG,
FlsHighIndex: ULONG,
// Fields appended in 6.0 (Windows Vista):
WerRegistrationData: PVOID,
WerShipAssertPtr: PVOID,
// Fields appended in 6.1 (Windows 7):
pUnused: PVOID, // previously pContextData
pImageHeaderHash: PVOID,
/// TODO: https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb/tracingflags.htm
TracingFlags: ULONG,
// Fields appended in 6.2 (Windows 8):
CsrServerReadOnlySharedMemoryBase: ULONGLONG,
// Fields appended in 1511:
TppWorkerpListLock: ULONG,
TppWorkerpList: LIST_ENTRY,
WaitOnAddressHashTable: [0x80]PVOID,
// Fields appended in 1709:
TelemetryCoverageHeader: PVOID,
CloudFileFlags: ULONG,
};
/// The `PEB_LDR_DATA` structure is the main record of what modules are loaded in a process.
/// It is essentially the head of three double-linked lists of `LDR_DATA_TABLE_ENTRY` structures which each represent one loaded module.
///
/// Microsoft documentation of this is incomplete, the fields here are taken from various resources including:
/// - https://www.geoffchappell.com/studies/windows/win32/ntdll/structs/peb_ldr_data.htm
pub const PEB_LDR_DATA = extern struct {
// Versions: 3.51 and higher
/// The size in bytes of the structure
Length: ULONG,
/// TRUE if the structure is prepared.
Initialized: BOOLEAN,
SsHandle: PVOID,
InLoadOrderModuleList: LIST_ENTRY,
InMemoryOrderModuleList: LIST_ENTRY,
InInitializationOrderModuleList: LIST_ENTRY,
// Versions: 5.1 and higher
/// No known use of this field is known in Windows 8 and higher.
EntryInProgress: PVOID,
// Versions: 6.0 from Windows Vista SP1, and higher
ShutdownInProgress: BOOLEAN,
/// Though ShutdownThreadId is declared as a HANDLE,
/// it is indeed the thread ID as suggested by its name.
/// It is picked up from the UniqueThread member of the CLIENT_ID in the
/// TEB of the thread that asks to terminate the process.
ShutdownThreadId: HANDLE,
};
pub const RTL_USER_PROCESS_PARAMETERS = extern struct {
AllocationSize: ULONG,
Size: ULONG,
Flags: ULONG,
DebugFlags: ULONG,
ConsoleHandle: HANDLE,
ConsoleFlags: ULONG,
hStdInput: HANDLE,
hStdOutput: HANDLE,
hStdError: HANDLE,
CurrentDirectory: CURDIR,
DllPath: UNICODE_STRING,
ImagePathName: UNICODE_STRING,
CommandLine: UNICODE_STRING,
Environment: [*:0]WCHAR,
dwX: ULONG,
dwY: ULONG,
dwXSize: ULONG,
dwYSize: ULONG,
dwXCountChars: ULONG,
dwYCountChars: ULONG,
dwFillAttribute: ULONG,
dwFlags: ULONG,
dwShowWindow: ULONG,
WindowTitle: UNICODE_STRING,
Desktop: UNICODE_STRING,
ShellInfo: UNICODE_STRING,
RuntimeInfo: UNICODE_STRING,
DLCurrentDirectory: [0x20]RTL_DRIVE_LETTER_CURDIR,
};
pub const RTL_DRIVE_LETTER_CURDIR = extern struct {
Flags: c_ushort,
Length: c_ushort,
TimeStamp: ULONG,
DosPath: UNICODE_STRING,
};
pub const PPS_POST_PROCESS_INIT_ROUTINE = ?fn () callconv(.C) void;
pub const FILE_BOTH_DIR_INFORMATION = extern struct {
NextEntryOffset: ULONG,
FileIndex: ULONG,
CreationTime: LARGE_INTEGER,
LastAccessTime: LARGE_INTEGER,
LastWriteTime: LARGE_INTEGER,
ChangeTime: LARGE_INTEGER,
EndOfFile: LARGE_INTEGER,
AllocationSize: LARGE_INTEGER,
FileAttributes: ULONG,
FileNameLength: ULONG,
EaSize: ULONG,
ShortNameLength: CHAR,
ShortName: [12]WCHAR,
FileName: [1]WCHAR,
};
pub const FILE_BOTH_DIRECTORY_INFORMATION = FILE_BOTH_DIR_INFORMATION;
pub const IO_APC_ROUTINE = fn (PVOID, *IO_STATUS_BLOCK, ULONG) callconv(.C) void;
pub const CURDIR = extern struct {
DosPath: UNICODE_STRING,
Handle: HANDLE,
};
pub const DUPLICATE_SAME_ACCESS = 2;
pub const MODULEINFO = extern struct {
lpBaseOfDll: LPVOID,
SizeOfImage: DWORD,
EntryPoint: LPVOID,
};
pub const PSAPI_WS_WATCH_INFORMATION = extern struct {
FaultingPc: LPVOID,
FaultingVa: LPVOID,
};
pub const PROCESS_MEMORY_COUNTERS = extern struct {
cb: DWORD,
PageFaultCount: DWORD,
PeakWorkingSetSize: SIZE_T,
WorkingSetSize: SIZE_T,
QuotaPeakPagedPoolUsage: SIZE_T,
QuotaPagedPoolUsage: SIZE_T,
QuotaPeakNonPagedPoolUsage: SIZE_T,
QuotaNonPagedPoolUsage: SIZE_T,
PagefileUsage: SIZE_T,
PeakPagefileUsage: SIZE_T,
};
pub const PROCESS_MEMORY_COUNTERS_EX = extern struct {
cb: DWORD,
PageFaultCount: DWORD,
PeakWorkingSetSize: SIZE_T,
WorkingSetSize: SIZE_T,
QuotaPeakPagedPoolUsage: SIZE_T,
QuotaPagedPoolUsage: SIZE_T,
QuotaPeakNonPagedPoolUsage: SIZE_T,
QuotaNonPagedPoolUsage: SIZE_T,
PagefileUsage: SIZE_T,
PeakPagefileUsage: SIZE_T,
PrivateUsage: SIZE_T,
};
pub const PERFORMANCE_INFORMATION = extern struct {
cb: DWORD,
CommitTotal: SIZE_T,
CommitLimit: SIZE_T,
CommitPeak: SIZE_T,
PhysicalTotal: SIZE_T,
PhysicalAvailable: SIZE_T,
SystemCache: SIZE_T,
KernelTotal: SIZE_T,
KernelPaged: SIZE_T,
KernelNonpaged: SIZE_T,
PageSize: SIZE_T,
HandleCount: DWORD,
ProcessCount: DWORD,
ThreadCount: DWORD,
};
pub const ENUM_PAGE_FILE_INFORMATION = extern struct {
cb: DWORD,
Reserved: DWORD,
TotalSize: SIZE_T,
TotalInUse: SIZE_T,
PeakUsage: SIZE_T,
};
pub const PENUM_PAGE_FILE_CALLBACKW = ?fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCWSTR) callconv(.C) BOOL;
pub const PENUM_PAGE_FILE_CALLBACKA = ?fn (?LPVOID, *ENUM_PAGE_FILE_INFORMATION, LPCSTR) callconv(.C) BOOL;
pub const PSAPI_WS_WATCH_INFORMATION_EX = extern struct {
BasicInfo: PSAPI_WS_WATCH_INFORMATION,
FaultingThreadId: ULONG_PTR,
Flags: ULONG_PTR,
};
pub const OSVERSIONINFOW = extern struct {
dwOSVersionInfoSize: ULONG,
dwMajorVersion: ULONG,
dwMinorVersion: ULONG,
dwBuildNumber: ULONG,
dwPlatformId: ULONG,
szCSDVersion: [128]WCHAR,
};
pub const RTL_OSVERSIONINFOW = OSVERSIONINFOW;
pub const REPARSE_DATA_BUFFER = extern struct {
ReparseTag: ULONG,
ReparseDataLength: USHORT,
Reserved: USHORT,
DataBuffer: [1]UCHAR,
};
pub const SYMBOLIC_LINK_REPARSE_BUFFER = extern struct {
SubstituteNameOffset: USHORT,
SubstituteNameLength: USHORT,
PrintNameOffset: USHORT,
PrintNameLength: USHORT,
Flags: ULONG,
PathBuffer: [1]WCHAR,
};
pub const MOUNT_POINT_REPARSE_BUFFER = extern struct {
SubstituteNameOffset: USHORT,
SubstituteNameLength: USHORT,
PrintNameOffset: USHORT,
PrintNameLength: USHORT,
PathBuffer: [1]WCHAR,
};
pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: ULONG = 16 * 1024;
pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4;
pub const FSCTL_GET_REPARSE_POINT: DWORD = 0x900a8;
pub const IO_REPARSE_TAG_SYMLINK: ULONG = 0xa000000c;
pub const IO_REPARSE_TAG_MOUNT_POINT: ULONG = 0xa0000003;
pub const SYMLINK_FLAG_RELATIVE: ULONG = 0x1;
pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 0x1;
pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: DWORD = 0x2;
pub const MOUNTMGR_MOUNT_POINT = extern struct {
SymbolicLinkNameOffset: ULONG,
SymbolicLinkNameLength: USHORT,
Reserved1: USHORT,
UniqueIdOffset: ULONG,
UniqueIdLength: USHORT,
Reserved2: USHORT,
DeviceNameOffset: ULONG,
DeviceNameLength: USHORT,
Reserved3: USHORT,
};
pub const MOUNTMGR_MOUNT_POINTS = extern struct {
Size: ULONG,
NumberOfMountPoints: ULONG,
MountPoints: [1]MOUNTMGR_MOUNT_POINT,
};
pub const IOCTL_MOUNTMGR_QUERY_POINTS: ULONG = 0x6d0008;
pub const OBJECT_INFORMATION_CLASS = enum(c_int) {
ObjectBasicInformation = 0,
ObjectNameInformation = 1,
ObjectTypeInformation = 2,
ObjectTypesInformation = 3,
ObjectHandleFlagInformation = 4,
ObjectSessionInformation = 5,
MaxObjectInfoClass,
};
pub const OBJECT_NAME_INFORMATION = extern struct {
Name: UNICODE_STRING,
};
pub const SRWLOCK = usize;
pub const SRWLOCK_INIT: SRWLOCK = 0;
pub const CONDITION_VARIABLE = usize;
pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = 0;
pub const FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 0x1;
pub const FILE_SKIP_SET_EVENT_ON_HANDLE = 0x2;
pub const CTRL_C_EVENT: DWORD = 0;
pub const CTRL_BREAK_EVENT: DWORD = 1;
pub const CTRL_CLOSE_EVENT: DWORD = 2;
pub const CTRL_LOGOFF_EVENT: DWORD = 5;
pub const CTRL_SHUTDOWN_EVENT: DWORD = 6;
pub const HANDLER_ROUTINE = fn (dwCtrlType: DWORD) callconv(.C) BOOL;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/bpf.zig | const std = @import("../../std.zig");
const errno = getErrno;
const unexpectedErrno = std.os.unexpectedErrno;
const expectEqual = std.testing.expectEqual;
const expectError = std.testing.expectError;
const expect = std.testing.expect;
const linux = std.os.linux;
const fd_t = linux.fd_t;
const pid_t = linux.pid_t;
const getErrno = linux.getErrno;
pub const btf = @import("bpf/btf.zig");
pub const kern = @import("bpf/kern.zig");
// instruction classes
pub const LD = 0x00;
pub const LDX = 0x01;
pub const ST = 0x02;
pub const STX = 0x03;
pub const ALU = 0x04;
pub const JMP = 0x05;
pub const RET = 0x06;
pub const MISC = 0x07;
/// 32-bit
pub const W = 0x00;
/// 16-bit
pub const H = 0x08;
/// 8-bit
pub const B = 0x10;
/// 64-bit
pub const DW = 0x18;
pub const IMM = 0x00;
pub const ABS = 0x20;
pub const IND = 0x40;
pub const MEM = 0x60;
pub const LEN = 0x80;
pub const MSH = 0xa0;
// alu fields
pub const ADD = 0x00;
pub const SUB = 0x10;
pub const MUL = 0x20;
pub const DIV = 0x30;
pub const OR = 0x40;
pub const AND = 0x50;
pub const LSH = 0x60;
pub const RSH = 0x70;
pub const NEG = 0x80;
pub const MOD = 0x90;
pub const XOR = 0xa0;
// jmp fields
pub const JA = 0x00;
pub const JEQ = 0x10;
pub const JGT = 0x20;
pub const JGE = 0x30;
pub const JSET = 0x40;
//#define BPF_SRC(code) ((code) & 0x08)
pub const K = 0x00;
pub const X = 0x08;
pub const MAXINSNS = 4096;
// instruction classes
/// jmp mode in word width
pub const JMP32 = 0x06;
/// alu mode in double word width
pub const ALU64 = 0x07;
// ld/ldx fields
/// exclusive add
pub const XADD = 0xc0;
// alu/jmp fields
/// mov reg to reg
pub const MOV = 0xb0;
/// sign extending arithmetic shift right */
pub const ARSH = 0xc0;
// change endianness of a register
/// flags for endianness conversion:
pub const END = 0xd0;
/// convert to little-endian */
pub const TO_LE = 0x00;
/// convert to big-endian
pub const TO_BE = 0x08;
pub const FROM_LE = TO_LE;
pub const FROM_BE = TO_BE;
// jmp encodings
/// jump != *
pub const JNE = 0x50;
/// LT is unsigned, '<'
pub const JLT = 0xa0;
/// LE is unsigned, '<=' *
pub const JLE = 0xb0;
/// SGT is signed '>', GT in x86
pub const JSGT = 0x60;
/// SGE is signed '>=', GE in x86
pub const JSGE = 0x70;
/// SLT is signed, '<'
pub const JSLT = 0xc0;
/// SLE is signed, '<='
pub const JSLE = 0xd0;
/// function call
pub const CALL = 0x80;
/// function return
pub const EXIT = 0x90;
/// Flag for prog_attach command. If a sub-cgroup installs some bpf program, the
/// program in this cgroup yields to sub-cgroup program.
pub const F_ALLOW_OVERRIDE = 0x1;
/// Flag for prog_attach command. If a sub-cgroup installs some bpf program,
/// that cgroup program gets run in addition to the program in this cgroup.
pub const F_ALLOW_MULTI = 0x2;
/// Flag for prog_attach command.
pub const F_REPLACE = 0x4;
/// If BPF_F_STRICT_ALIGNMENT is used in BPF_PROG_LOAD command, the verifier
/// will perform strict alignment checking as if the kernel has been built with
/// CONFIG_EFFICIENT_UNALIGNED_ACCESS not set, and NET_IP_ALIGN defined to 2.
pub const F_STRICT_ALIGNMENT = 0x1;
/// If BPF_F_ANY_ALIGNMENT is used in BPF_PROF_LOAD command, the verifier will
/// allow any alignment whatsoever. On platforms with strict alignment
/// requirements for loads ands stores (such as sparc and mips) the verifier
/// validates that all loads and stores provably follow this requirement. This
/// flag turns that checking and enforcement off.
///
/// It is mostly used for testing when we want to validate the context and
/// memory access aspects of the verifier, but because of an unaligned access
/// the alignment check would trigger before the one we are interested in.
pub const F_ANY_ALIGNMENT = 0x2;
/// BPF_F_TEST_RND_HI32 is used in BPF_PROG_LOAD command for testing purpose.
/// Verifier does sub-register def/use analysis and identifies instructions
/// whose def only matters for low 32-bit, high 32-bit is never referenced later
/// through implicit zero extension. Therefore verifier notifies JIT back-ends
/// that it is safe to ignore clearing high 32-bit for these instructions. This
/// saves some back-ends a lot of code-gen. However such optimization is not
/// necessary on some arches, for example x86_64, arm64 etc, whose JIT back-ends
/// hence hasn't used verifier's analysis result. But, we really want to have a
/// way to be able to verify the correctness of the described optimization on
/// x86_64 on which testsuites are frequently exercised.
///
/// So, this flag is introduced. Once it is set, verifier will randomize high
/// 32-bit for those instructions who has been identified as safe to ignore
/// them. Then, if verifier is not doing correct analysis, such randomization
/// will regress tests to expose bugs.
pub const F_TEST_RND_HI32 = 0x4;
/// When BPF ldimm64's insn[0].src_reg != 0 then this can have two extensions:
/// insn[0].src_reg: BPF_PSEUDO_MAP_FD BPF_PSEUDO_MAP_VALUE
/// insn[0].imm: map fd map fd
/// insn[1].imm: 0 offset into value
/// insn[0].off: 0 0
/// insn[1].off: 0 0
/// ldimm64 rewrite: address of map address of map[0]+offset
/// verifier type: CONST_PTR_TO_MAP PTR_TO_MAP_VALUE
pub const PSEUDO_MAP_FD = 1;
pub const PSEUDO_MAP_VALUE = 2;
/// when bpf_call->src_reg == BPF_PSEUDO_CALL, bpf_call->imm == pc-relative
/// offset to another bpf function
pub const PSEUDO_CALL = 1;
/// flag for BPF_MAP_UPDATE_ELEM command. create new element or update existing
pub const ANY = 0;
/// flag for BPF_MAP_UPDATE_ELEM command. create new element if it didn't exist
pub const NOEXIST = 1;
/// flag for BPF_MAP_UPDATE_ELEM command. update existing element
pub const EXIST = 2;
/// flag for BPF_MAP_UPDATE_ELEM command. spin_lock-ed map_lookup/map_update
pub const F_LOCK = 4;
/// flag for BPF_MAP_CREATE command */
pub const BPF_F_NO_PREALLOC = 0x1;
/// flag for BPF_MAP_CREATE command. Instead of having one common LRU list in
/// the BPF_MAP_TYPE_LRU_[PERCPU_]HASH map, use a percpu LRU list which can
/// scale and perform better. Note, the LRU nodes (including free nodes) cannot
/// be moved across different LRU lists.
pub const BPF_F_NO_COMMON_LRU = 0x2;
/// flag for BPF_MAP_CREATE command. Specify numa node during map creation
pub const BPF_F_NUMA_NODE = 0x4;
/// flag for BPF_MAP_CREATE command. Flags for BPF object read access from
/// syscall side
pub const BPF_F_RDONLY = 0x8;
/// flag for BPF_MAP_CREATE command. Flags for BPF object write access from
/// syscall side
pub const BPF_F_WRONLY = 0x10;
/// flag for BPF_MAP_CREATE command. Flag for stack_map, store build_id+offset
/// instead of pointer
pub const BPF_F_STACK_BUILD_ID = 0x20;
/// flag for BPF_MAP_CREATE command. Zero-initialize hash function seed. This
/// should only be used for testing.
pub const BPF_F_ZERO_SEED = 0x40;
/// flag for BPF_MAP_CREATE command Flags for accessing BPF object from program
/// side.
pub const BPF_F_RDONLY_PROG = 0x80;
/// flag for BPF_MAP_CREATE command. Flags for accessing BPF object from program
/// side.
pub const BPF_F_WRONLY_PROG = 0x100;
/// flag for BPF_MAP_CREATE command. Clone map from listener for newly accepted
/// socket
pub const BPF_F_CLONE = 0x200;
/// flag for BPF_MAP_CREATE command. Enable memory-mapping BPF map
pub const BPF_F_MMAPABLE = 0x400;
/// These values correspond to "syscalls" within the BPF program's environment,
/// each one is documented in std.os.linux.BPF.kern
pub const Helper = enum(i32) {
unspec,
map_lookup_elem,
map_update_elem,
map_delete_elem,
probe_read,
ktime_get_ns,
trace_printk,
get_prandom_u32,
get_smp_processor_id,
skb_store_bytes,
l3_csum_replace,
l4_csum_replace,
tail_call,
clone_redirect,
get_current_pid_tgid,
get_current_uid_gid,
get_current_comm,
get_cgroup_classid,
skb_vlan_push,
skb_vlan_pop,
skb_get_tunnel_key,
skb_set_tunnel_key,
perf_event_read,
redirect,
get_route_realm,
perf_event_output,
skb_load_bytes,
get_stackid,
csum_diff,
skb_get_tunnel_opt,
skb_set_tunnel_opt,
skb_change_proto,
skb_change_type,
skb_under_cgroup,
get_hash_recalc,
get_current_task,
probe_write_user,
current_task_under_cgroup,
skb_change_tail,
skb_pull_data,
csum_update,
set_hash_invalid,
get_numa_node_id,
skb_change_head,
xdp_adjust_head,
probe_read_str,
get_socket_cookie,
get_socket_uid,
set_hash,
setsockopt,
skb_adjust_room,
redirect_map,
sk_redirect_map,
sock_map_update,
xdp_adjust_meta,
perf_event_read_value,
perf_prog_read_value,
getsockopt,
override_return,
sock_ops_cb_flags_set,
msg_redirect_map,
msg_apply_bytes,
msg_cork_bytes,
msg_pull_data,
bind,
xdp_adjust_tail,
skb_get_xfrm_state,
get_stack,
skb_load_bytes_relative,
fib_lookup,
sock_hash_update,
msg_redirect_hash,
sk_redirect_hash,
lwt_push_encap,
lwt_seg6_store_bytes,
lwt_seg6_adjust_srh,
lwt_seg6_action,
rc_repeat,
rc_keydown,
skb_cgroup_id,
get_current_cgroup_id,
get_local_storage,
sk_select_reuseport,
skb_ancestor_cgroup_id,
sk_lookup_tcp,
sk_lookup_udp,
sk_release,
map_push_elem,
map_pop_elem,
map_peek_elem,
msg_push_data,
msg_pop_data,
rc_pointer_rel,
spin_lock,
spin_unlock,
sk_fullsock,
tcp_sock,
skb_ecn_set_ce,
get_listener_sock,
skc_lookup_tcp,
tcp_check_syncookie,
sysctl_get_name,
sysctl_get_current_value,
sysctl_get_new_value,
sysctl_set_new_value,
strtol,
strtoul,
sk_storage_get,
sk_storage_delete,
send_signal,
tcp_gen_syncookie,
skb_output,
probe_read_user,
probe_read_kernel,
probe_read_user_str,
probe_read_kernel_str,
tcp_send_ack,
send_signal_thread,
jiffies64,
read_branch_records,
get_ns_current_pid_tgid,
xdp_output,
get_netns_cookie,
get_current_ancestor_cgroup_id,
sk_assign,
ktime_get_boot_ns,
seq_printf,
seq_write,
sk_cgroup_id,
sk_ancestor_cgroup_id,
ringbuf_output,
ringbuf_reserve,
ringbuf_submit,
ringbuf_discard,
ringbuf_query,
csum_level,
skc_to_tcp6_sock,
skc_to_tcp_sock,
skc_to_tcp_timewait_sock,
skc_to_tcp_request_sock,
skc_to_udp6_sock,
get_task_stack,
_,
};
// TODO: determine that this is the expected bit layout for both little and big
// endian systems
/// a single BPF instruction
pub const Insn = packed struct {
code: u8,
dst: u4,
src: u4,
off: i16,
imm: i32,
/// r0 - r9 are general purpose 64-bit registers, r10 points to the stack
/// frame
pub const Reg = enum(u4) { r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10 };
const Source = enum(u1) { reg, imm };
const Mode = enum(u8) {
imm = IMM,
abs = ABS,
ind = IND,
mem = MEM,
len = LEN,
msh = MSH,
};
const AluOp = enum(u8) {
add = ADD,
sub = SUB,
mul = MUL,
div = DIV,
alu_or = OR,
alu_and = AND,
lsh = LSH,
rsh = RSH,
neg = NEG,
mod = MOD,
xor = XOR,
mov = MOV,
arsh = ARSH,
};
pub const Size = enum(u8) {
byte = B,
half_word = H,
word = W,
double_word = DW,
};
const JmpOp = enum(u8) {
ja = JA,
jeq = JEQ,
jgt = JGT,
jge = JGE,
jset = JSET,
jlt = JLT,
jle = JLE,
jne = JNE,
jsgt = JSGT,
jsge = JSGE,
jslt = JSLT,
jsle = JSLE,
};
const ImmOrReg = union(Source) {
imm: i32,
reg: Reg,
};
fn imm_reg(code: u8, dst: Reg, src: anytype, off: i16) Insn {
const imm_or_reg = if (@typeInfo(@TypeOf(src)) == .EnumLiteral)
ImmOrReg{ .reg = @as(Reg, src) }
else
ImmOrReg{ .imm = src };
const src_type = switch (imm_or_reg) {
.imm => K,
.reg => X,
};
return Insn{
.code = code | src_type,
.dst = @intFromEnum(dst),
.src = switch (imm_or_reg) {
.imm => 0,
.reg => |r| @intFromEnum(r),
},
.off = off,
.imm = switch (imm_or_reg) {
.imm => |i| i,
.reg => 0,
},
};
}
fn alu(comptime width: comptime_int, op: AluOp, dst: Reg, src: anytype) Insn {
const width_bitfield = switch (width) {
32 => ALU,
64 => ALU64,
else => @compileError("width must be 32 or 64"),
};
return imm_reg(width_bitfield | @intFromEnum(op), dst, src, 0);
}
pub fn mov(dst: Reg, src: anytype) Insn {
return alu(64, .mov, dst, src);
}
pub fn add(dst: Reg, src: anytype) Insn {
return alu(64, .add, dst, src);
}
pub fn sub(dst: Reg, src: anytype) Insn {
return alu(64, .sub, dst, src);
}
pub fn mul(dst: Reg, src: anytype) Insn {
return alu(64, .mul, dst, src);
}
pub fn div(dst: Reg, src: anytype) Insn {
return alu(64, .div, dst, src);
}
pub fn alu_or(dst: Reg, src: anytype) Insn {
return alu(64, .alu_or, dst, src);
}
pub fn alu_and(dst: Reg, src: anytype) Insn {
return alu(64, .alu_and, dst, src);
}
pub fn lsh(dst: Reg, src: anytype) Insn {
return alu(64, .lsh, dst, src);
}
pub fn rsh(dst: Reg, src: anytype) Insn {
return alu(64, .rsh, dst, src);
}
pub fn neg(dst: Reg) Insn {
return alu(64, .neg, dst, 0);
}
pub fn mod(dst: Reg, src: anytype) Insn {
return alu(64, .mod, dst, src);
}
pub fn xor(dst: Reg, src: anytype) Insn {
return alu(64, .xor, dst, src);
}
pub fn arsh(dst: Reg, src: anytype) Insn {
return alu(64, .arsh, dst, src);
}
fn jmp(op: JmpOp, dst: Reg, src: anytype, off: i16) Insn {
return imm_reg(JMP | @intFromEnum(op), dst, src, off);
}
pub fn ja(off: i16) Insn {
return jmp(.ja, .r0, 0, off);
}
pub fn jeq(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jeq, dst, src, off);
}
pub fn jgt(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jgt, dst, src, off);
}
pub fn jge(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jge, dst, src, off);
}
pub fn jlt(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jlt, dst, src, off);
}
pub fn jle(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jle, dst, src, off);
}
pub fn jset(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jset, dst, src, off);
}
pub fn jne(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jne, dst, src, off);
}
pub fn jsgt(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jsgt, dst, src, off);
}
pub fn jsge(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jsge, dst, src, off);
}
pub fn jslt(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jslt, dst, src, off);
}
pub fn jsle(dst: Reg, src: anytype, off: i16) Insn {
return jmp(.jsle, dst, src, off);
}
pub fn xadd(dst: Reg, src: Reg) Insn {
return Insn{
.code = STX | XADD | DW,
.dst = @intFromEnum(dst),
.src = @intFromEnum(src),
.off = 0,
.imm = 0,
};
}
fn ld(mode: Mode, size: Size, dst: Reg, src: Reg, imm: i32) Insn {
return Insn{
.code = @intFromEnum(mode) | @intFromEnum(size) | LD,
.dst = @intFromEnum(dst),
.src = @intFromEnum(src),
.off = 0,
.imm = imm,
};
}
pub fn ld_abs(size: Size, dst: Reg, src: Reg, imm: i32) Insn {
return ld(.abs, size, dst, src, imm);
}
pub fn ld_ind(size: Size, dst: Reg, src: Reg, imm: i32) Insn {
return ld(.ind, size, dst, src, imm);
}
pub fn ldx(size: Size, dst: Reg, src: Reg, off: i16) Insn {
return Insn{
.code = MEM | @intFromEnum(size) | LDX,
.dst = @intFromEnum(dst),
.src = @intFromEnum(src),
.off = off,
.imm = 0,
};
}
fn ld_imm_impl1(dst: Reg, src: Reg, imm: u64) Insn {
return Insn{
.code = LD | DW | IMM,
.dst = @intFromEnum(dst),
.src = @intFromEnum(src),
.off = 0,
.imm = @as(i32, @intCast(@as(u32, @truncate(imm)))),
};
}
fn ld_imm_impl2(imm: u64) Insn {
return Insn{
.code = 0,
.dst = 0,
.src = 0,
.off = 0,
.imm = @as(i32, @intCast(@as(u32, @truncate(imm >> 32)))),
};
}
pub fn ld_dw1(dst: Reg, imm: u64) Insn {
return ld_imm_impl1(dst, .r0, imm);
}
pub fn ld_dw2(imm: u64) Insn {
return ld_imm_impl2(imm);
}
pub fn ld_map_fd1(dst: Reg, map_fd: fd_t) Insn {
return ld_imm_impl1(dst, @as(Reg, @enumFromInt(PSEUDO_MAP_FD)), @as(u64, @intCast(map_fd)));
}
pub fn ld_map_fd2(map_fd: fd_t) Insn {
return ld_imm_impl2(@as(u64, @intCast(map_fd)));
}
pub fn st(comptime size: Size, dst: Reg, off: i16, imm: i32) Insn {
if (size == .double_word) @compileError("TODO: need to determine how to correctly handle double words");
return Insn{
.code = MEM | @intFromEnum(size) | ST,
.dst = @intFromEnum(dst),
.src = 0,
.off = off,
.imm = imm,
};
}
pub fn stx(size: Size, dst: Reg, off: i16, src: Reg) Insn {
return Insn{
.code = MEM | @intFromEnum(size) | STX,
.dst = @intFromEnum(dst),
.src = @intFromEnum(src),
.off = off,
.imm = 0,
};
}
fn endian_swap(endian: std.builtin.Endian, comptime size: Size, dst: Reg) Insn {
return Insn{
.code = switch (endian) {
.Big => 0xdc,
.Little => 0xd4,
},
.dst = @intFromEnum(dst),
.src = 0,
.off = 0,
.imm = switch (size) {
.byte => @compileError("can't swap a single byte"),
.half_word => 16,
.word => 32,
.double_word => 64,
},
};
}
pub fn le(comptime size: Size, dst: Reg) Insn {
return endian_swap(.Little, size, dst);
}
pub fn be(comptime size: Size, dst: Reg) Insn {
return endian_swap(.Big, size, dst);
}
pub fn call(helper: Helper) Insn {
return Insn{
.code = JMP | CALL,
.dst = 0,
.src = 0,
.off = 0,
.imm = @intFromEnum(helper),
};
}
/// exit BPF program
pub fn exit() Insn {
return Insn{
.code = JMP | EXIT,
.dst = 0,
.src = 0,
.off = 0,
.imm = 0,
};
}
};
test "insn bitsize" {
try expectEqual(@bitSizeOf(Insn), 64);
}
fn expect_opcode(code: u8, insn: Insn) !void {
try expectEqual(code, insn.code);
}
// The opcodes were grabbed from https://github.com/iovisor/bpf-docs/blob/master/eBPF.md
test "opcodes" {
// instructions that have a name that end with 1 or 2 are consecutive for
// loading 64-bit immediates (imm is only 32 bits wide)
// alu instructions
try expect_opcode(0x07, Insn.add(.r1, 0));
try expect_opcode(0x0f, Insn.add(.r1, .r2));
try expect_opcode(0x17, Insn.sub(.r1, 0));
try expect_opcode(0x1f, Insn.sub(.r1, .r2));
try expect_opcode(0x27, Insn.mul(.r1, 0));
try expect_opcode(0x2f, Insn.mul(.r1, .r2));
try expect_opcode(0x37, Insn.div(.r1, 0));
try expect_opcode(0x3f, Insn.div(.r1, .r2));
try expect_opcode(0x47, Insn.alu_or(.r1, 0));
try expect_opcode(0x4f, Insn.alu_or(.r1, .r2));
try expect_opcode(0x57, Insn.alu_and(.r1, 0));
try expect_opcode(0x5f, Insn.alu_and(.r1, .r2));
try expect_opcode(0x67, Insn.lsh(.r1, 0));
try expect_opcode(0x6f, Insn.lsh(.r1, .r2));
try expect_opcode(0x77, Insn.rsh(.r1, 0));
try expect_opcode(0x7f, Insn.rsh(.r1, .r2));
try expect_opcode(0x87, Insn.neg(.r1));
try expect_opcode(0x97, Insn.mod(.r1, 0));
try expect_opcode(0x9f, Insn.mod(.r1, .r2));
try expect_opcode(0xa7, Insn.xor(.r1, 0));
try expect_opcode(0xaf, Insn.xor(.r1, .r2));
try expect_opcode(0xb7, Insn.mov(.r1, 0));
try expect_opcode(0xbf, Insn.mov(.r1, .r2));
try expect_opcode(0xc7, Insn.arsh(.r1, 0));
try expect_opcode(0xcf, Insn.arsh(.r1, .r2));
// atomic instructions: might be more of these not documented in the wild
try expect_opcode(0xdb, Insn.xadd(.r1, .r2));
// TODO: byteswap instructions
try expect_opcode(0xd4, Insn.le(.half_word, .r1));
try expectEqual(@as(i32, @intCast(16)), Insn.le(.half_word, .r1).imm);
try expect_opcode(0xd4, Insn.le(.word, .r1));
try expectEqual(@as(i32, @intCast(32)), Insn.le(.word, .r1).imm);
try expect_opcode(0xd4, Insn.le(.double_word, .r1));
try expectEqual(@as(i32, @intCast(64)), Insn.le(.double_word, .r1).imm);
try expect_opcode(0xdc, Insn.be(.half_word, .r1));
try expectEqual(@as(i32, @intCast(16)), Insn.be(.half_word, .r1).imm);
try expect_opcode(0xdc, Insn.be(.word, .r1));
try expectEqual(@as(i32, @intCast(32)), Insn.be(.word, .r1).imm);
try expect_opcode(0xdc, Insn.be(.double_word, .r1));
try expectEqual(@as(i32, @intCast(64)), Insn.be(.double_word, .r1).imm);
// memory instructions
try expect_opcode(0x18, Insn.ld_dw1(.r1, 0));
try expect_opcode(0x00, Insn.ld_dw2(0));
// loading a map fd
try expect_opcode(0x18, Insn.ld_map_fd1(.r1, 0));
try expectEqual(@as(u4, @intCast(PSEUDO_MAP_FD)), Insn.ld_map_fd1(.r1, 0).src);
try expect_opcode(0x00, Insn.ld_map_fd2(0));
try expect_opcode(0x38, Insn.ld_abs(.double_word, .r1, .r2, 0));
try expect_opcode(0x20, Insn.ld_abs(.word, .r1, .r2, 0));
try expect_opcode(0x28, Insn.ld_abs(.half_word, .r1, .r2, 0));
try expect_opcode(0x30, Insn.ld_abs(.byte, .r1, .r2, 0));
try expect_opcode(0x58, Insn.ld_ind(.double_word, .r1, .r2, 0));
try expect_opcode(0x40, Insn.ld_ind(.word, .r1, .r2, 0));
try expect_opcode(0x48, Insn.ld_ind(.half_word, .r1, .r2, 0));
try expect_opcode(0x50, Insn.ld_ind(.byte, .r1, .r2, 0));
try expect_opcode(0x79, Insn.ldx(.double_word, .r1, .r2, 0));
try expect_opcode(0x61, Insn.ldx(.word, .r1, .r2, 0));
try expect_opcode(0x69, Insn.ldx(.half_word, .r1, .r2, 0));
try expect_opcode(0x71, Insn.ldx(.byte, .r1, .r2, 0));
try expect_opcode(0x62, Insn.st(.word, .r1, 0, 0));
try expect_opcode(0x6a, Insn.st(.half_word, .r1, 0, 0));
try expect_opcode(0x72, Insn.st(.byte, .r1, 0, 0));
try expect_opcode(0x63, Insn.stx(.word, .r1, 0, .r2));
try expect_opcode(0x6b, Insn.stx(.half_word, .r1, 0, .r2));
try expect_opcode(0x73, Insn.stx(.byte, .r1, 0, .r2));
try expect_opcode(0x7b, Insn.stx(.double_word, .r1, 0, .r2));
// branch instructions
try expect_opcode(0x05, Insn.ja(0));
try expect_opcode(0x15, Insn.jeq(.r1, 0, 0));
try expect_opcode(0x1d, Insn.jeq(.r1, .r2, 0));
try expect_opcode(0x25, Insn.jgt(.r1, 0, 0));
try expect_opcode(0x2d, Insn.jgt(.r1, .r2, 0));
try expect_opcode(0x35, Insn.jge(.r1, 0, 0));
try expect_opcode(0x3d, Insn.jge(.r1, .r2, 0));
try expect_opcode(0xa5, Insn.jlt(.r1, 0, 0));
try expect_opcode(0xad, Insn.jlt(.r1, .r2, 0));
try expect_opcode(0xb5, Insn.jle(.r1, 0, 0));
try expect_opcode(0xbd, Insn.jle(.r1, .r2, 0));
try expect_opcode(0x45, Insn.jset(.r1, 0, 0));
try expect_opcode(0x4d, Insn.jset(.r1, .r2, 0));
try expect_opcode(0x55, Insn.jne(.r1, 0, 0));
try expect_opcode(0x5d, Insn.jne(.r1, .r2, 0));
try expect_opcode(0x65, Insn.jsgt(.r1, 0, 0));
try expect_opcode(0x6d, Insn.jsgt(.r1, .r2, 0));
try expect_opcode(0x75, Insn.jsge(.r1, 0, 0));
try expect_opcode(0x7d, Insn.jsge(.r1, .r2, 0));
try expect_opcode(0xc5, Insn.jslt(.r1, 0, 0));
try expect_opcode(0xcd, Insn.jslt(.r1, .r2, 0));
try expect_opcode(0xd5, Insn.jsle(.r1, 0, 0));
try expect_opcode(0xdd, Insn.jsle(.r1, .r2, 0));
try expect_opcode(0x85, Insn.call(.unspec));
try expect_opcode(0x95, Insn.exit());
}
pub const Cmd = enum(usize) {
/// Create a map and return a file descriptor that refers to the map. The
/// close-on-exec file descriptor flag is automatically enabled for the new
/// file descriptor.
///
/// uses MapCreateAttr
map_create,
/// Look up an element by key in a specified map and return its value.
///
/// uses MapElemAttr
map_lookup_elem,
/// Create or update an element (key/value pair) in a specified map.
///
/// uses MapElemAttr
map_update_elem,
/// Look up and delete an element by key in a specified map.
///
/// uses MapElemAttr
map_delete_elem,
/// Look up an element by key in a specified map and return the key of the
/// next element.
map_get_next_key,
/// Verify and load an eBPF program, returning a new file descriptor
/// associated with the program. The close-on-exec file descriptor flag
/// is automatically enabled for the new file descriptor.
///
/// uses ProgLoadAttr
prog_load,
/// Pin a map or eBPF program to a path within the minimal BPF filesystem
///
/// uses ObjAttr
obj_pin,
/// Get the file descriptor of a BPF object pinned to a certain path
///
/// uses ObjAttr
obj_get,
/// uses ProgAttachAttr
prog_attach,
/// uses ProgAttachAttr
prog_detach,
/// uses TestRunAttr
prog_test_run,
/// uses GetIdAttr
prog_get_next_id,
/// uses GetIdAttr
map_get_next_id,
/// uses GetIdAttr
prog_get_fd_by_id,
/// uses GetIdAttr
map_get_fd_by_id,
/// uses InfoAttr
obj_get_info_by_fd,
/// uses QueryAttr
prog_query,
/// uses RawTracepointAttr
raw_tracepoint_open,
/// uses BtfLoadAttr
btf_load,
/// uses GetIdAttr
btf_get_fd_by_id,
/// uses TaskFdQueryAttr
task_fd_query,
/// uses MapElemAttr
map_lookup_and_delete_elem,
map_freeze,
/// uses GetIdAttr
btf_get_next_id,
/// uses MapBatchAttr
map_lookup_batch,
/// uses MapBatchAttr
map_lookup_and_delete_batch,
/// uses MapBatchAttr
map_update_batch,
/// uses MapBatchAttr
map_delete_batch,
/// uses LinkCreateAttr
link_create,
/// uses LinkUpdateAttr
link_update,
/// uses GetIdAttr
link_get_fd_by_id,
/// uses GetIdAttr
link_get_next_id,
/// uses EnableStatsAttr
enable_stats,
/// uses IterCreateAttr
iter_create,
link_detach,
_,
};
pub const MapType = enum(u32) {
unspec,
hash,
array,
prog_array,
perf_event_array,
percpu_hash,
percpu_array,
stack_trace,
cgroup_array,
lru_hash,
lru_percpu_hash,
lpm_trie,
array_of_maps,
hash_of_maps,
devmap,
sockmap,
cpumap,
xskmap,
sockhash,
cgroup_storage,
reuseport_sockarray,
percpu_cgroup_storage,
queue,
stack,
sk_storage,
devmap_hash,
struct_ops,
/// An ordered and shared CPU version of perf_event_array. They have
/// similar semantics:
/// - variable length records
/// - no blocking: when full, reservation fails
/// - memory mappable for ease and speed
/// - epoll notifications for new data, but can busy poll
///
/// Ringbufs give BPF programs two sets of APIs:
/// - ringbuf_output() allows copy data from one place to a ring
/// buffer, similar to bpf_perf_event_output()
/// - ringbuf_reserve()/ringbuf_commit()/ringbuf_discard() split the
/// process into two steps. First a fixed amount of space is reserved,
/// if that is successful then the program gets a pointer to a chunk of
/// memory and can be submitted with commit() or discarded with
/// discard()
///
/// ringbuf_output() will incurr an extra memory copy, but allows to submit
/// records of the length that's not known beforehand, and is an easy
/// replacement for perf_event_outptu().
///
/// ringbuf_reserve() avoids the extra memory copy but requires a known size
/// of memory beforehand.
///
/// ringbuf_query() allows to query properties of the map, 4 are currently
/// supported:
/// - BPF_RB_AVAIL_DATA: amount of unconsumed data in ringbuf
/// - BPF_RB_RING_SIZE: returns size of ringbuf
/// - BPF_RB_CONS_POS/BPF_RB_PROD_POS returns current logical position
/// of consumer and producer respectively
///
/// key size: 0
/// value size: 0
/// max entries: size of ringbuf, must be power of 2
ringbuf,
_,
};
pub const ProgType = enum(u32) {
unspec,
/// context type: __sk_buff
socket_filter,
/// context type: bpf_user_pt_regs_t
kprobe,
/// context type: __sk_buff
sched_cls,
/// context type: __sk_buff
sched_act,
/// context type: u64
tracepoint,
/// context type: xdp_md
xdp,
/// context type: bpf_perf_event_data
perf_event,
/// context type: __sk_buff
cgroup_skb,
/// context type: bpf_sock
cgroup_sock,
/// context type: __sk_buff
lwt_in,
/// context type: __sk_buff
lwt_out,
/// context type: __sk_buff
lwt_xmit,
/// context type: bpf_sock_ops
sock_ops,
/// context type: __sk_buff
sk_skb,
/// context type: bpf_cgroup_dev_ctx
cgroup_device,
/// context type: sk_msg_md
sk_msg,
/// context type: bpf_raw_tracepoint_args
raw_tracepoint,
/// context type: bpf_sock_addr
cgroup_sock_addr,
/// context type: __sk_buff
lwt_seg6local,
/// context type: u32
lirc_mode2,
/// context type: sk_reuseport_md
sk_reuseport,
/// context type: __sk_buff
flow_dissector,
/// context type: bpf_sysctl
cgroup_sysctl,
/// context type: bpf_raw_tracepoint_args
raw_tracepoint_writable,
/// context type: bpf_sockopt
cgroup_sockopt,
/// context type: void *
tracing,
/// context type: void *
struct_ops,
/// context type: void *
ext,
/// context type: void *
lsm,
/// context type: bpf_sk_lookup
sk_lookup,
_,
};
pub const AttachType = enum(u32) {
cgroup_inet_ingress,
cgroup_inet_egress,
cgroup_inet_sock_create,
cgroup_sock_ops,
sk_skb_stream_parser,
sk_skb_stream_verdict,
cgroup_device,
sk_msg_verdict,
cgroup_inet4_bind,
cgroup_inet6_bind,
cgroup_inet4_connect,
cgroup_inet6_connect,
cgroup_inet4_post_bind,
cgroup_inet6_post_bind,
cgroup_udp4_sendmsg,
cgroup_udp6_sendmsg,
lirc_mode2,
flow_dissector,
cgroup_sysctl,
cgroup_udp4_recvmsg,
cgroup_udp6_recvmsg,
cgroup_getsockopt,
cgroup_setsockopt,
trace_raw_tp,
trace_fentry,
trace_fexit,
modify_return,
lsm_mac,
trace_iter,
cgroup_inet4_getpeername,
cgroup_inet6_getpeername,
cgroup_inet4_getsockname,
cgroup_inet6_getsockname,
xdp_devmap,
cgroup_inet_sock_release,
xdp_cpumap,
sk_lookup,
xdp,
_,
};
const obj_name_len = 16;
/// struct used by Cmd.map_create command
pub const MapCreateAttr = extern struct {
/// one of MapType
map_type: u32,
/// size of key in bytes
key_size: u32,
/// size of value in bytes
value_size: u32,
/// max number of entries in a map
max_entries: u32,
/// .map_create related flags
map_flags: u32,
/// fd pointing to the inner map
inner_map_fd: fd_t,
/// numa node (effective only if MapCreateFlags.numa_node is set)
numa_node: u32,
map_name: [obj_name_len]u8,
/// ifindex of netdev to create on
map_ifindex: u32,
/// fd pointing to a BTF type data
btf_fd: fd_t,
/// BTF type_id of the key
btf_key_type_id: u32,
/// BTF type_id of the value
bpf_value_type_id: u32,
/// BTF type_id of a kernel struct stored as the map value
btf_vmlinux_value_type_id: u32,
};
/// struct used by Cmd.map_*_elem commands
pub const MapElemAttr = extern struct {
map_fd: fd_t,
key: u64,
result: extern union {
value: u64,
next_key: u64,
},
flags: u64,
};
/// struct used by Cmd.map_*_batch commands
pub const MapBatchAttr = extern struct {
/// start batch, NULL to start from beginning
in_batch: u64,
/// output: next start batch
out_batch: u64,
keys: u64,
values: u64,
/// input/output:
/// input: # of key/value elements
/// output: # of filled elements
count: u32,
map_fd: fd_t,
elem_flags: u64,
flags: u64,
};
/// struct used by Cmd.prog_load command
pub const ProgLoadAttr = extern struct {
/// one of ProgType
prog_type: u32,
insn_cnt: u32,
insns: u64,
license: u64,
/// verbosity level of verifier
log_level: u32,
/// size of user buffer
log_size: u32,
/// user supplied buffer
log_buf: u64,
/// not used
kern_version: u32,
prog_flags: u32,
prog_name: [obj_name_len]u8,
/// ifindex of netdev to prep for.
prog_ifindex: u32,
/// For some prog types expected attach type must be known at load time to
/// verify attach type specific parts of prog (context accesses, allowed
/// helpers, etc).
expected_attach_type: u32,
/// fd pointing to BTF type data
prog_btf_fd: fd_t,
/// userspace bpf_func_info size
func_info_rec_size: u32,
func_info: u64,
/// number of bpf_func_info records
func_info_cnt: u32,
/// userspace bpf_line_info size
line_info_rec_size: u32,
line_info: u64,
/// number of bpf_line_info records
line_info_cnt: u32,
/// in-kernel BTF type id to attach to
attact_btf_id: u32,
/// 0 to attach to vmlinux
attach_prog_id: u32,
};
/// struct used by Cmd.obj_* commands
pub const ObjAttr = extern struct {
pathname: u64,
bpf_fd: fd_t,
file_flags: u32,
};
/// struct used by Cmd.prog_attach/detach commands
pub const ProgAttachAttr = extern struct {
/// container object to attach to
target_fd: fd_t,
/// eBPF program to attach
attach_bpf_fd: fd_t,
attach_type: u32,
attach_flags: u32,
// TODO: BPF_F_REPLACE flags
/// previously attached eBPF program to replace if .replace is used
replace_bpf_fd: fd_t,
};
/// struct used by Cmd.prog_test_run command
pub const TestRunAttr = extern struct {
prog_fd: fd_t,
retval: u32,
/// input: len of data_in
data_size_in: u32,
/// input/output: len of data_out. returns ENOSPC if data_out is too small.
data_size_out: u32,
data_in: u64,
data_out: u64,
repeat: u32,
duration: u32,
/// input: len of ctx_in
ctx_size_in: u32,
/// input/output: len of ctx_out. returns ENOSPC if ctx_out is too small.
ctx_size_out: u32,
ctx_in: u64,
ctx_out: u64,
};
/// struct used by Cmd.*_get_*_id commands
pub const GetIdAttr = extern struct {
id: extern union {
start_id: u32,
prog_id: u32,
map_id: u32,
btf_id: u32,
link_id: u32,
},
next_id: u32,
open_flags: u32,
};
/// struct used by Cmd.obj_get_info_by_fd command
pub const InfoAttr = extern struct {
bpf_fd: fd_t,
info_len: u32,
info: u64,
};
/// struct used by Cmd.prog_query command
pub const QueryAttr = extern struct {
/// container object to query
target_fd: fd_t,
attach_type: u32,
query_flags: u32,
attach_flags: u32,
prog_ids: u64,
prog_cnt: u32,
};
/// struct used by Cmd.raw_tracepoint_open command
pub const RawTracepointAttr = extern struct {
name: u64,
prog_fd: fd_t,
};
/// struct used by Cmd.btf_load command
pub const BtfLoadAttr = extern struct {
btf: u64,
btf_log_buf: u64,
btf_size: u32,
btf_log_size: u32,
btf_log_level: u32,
};
/// struct used by Cmd.task_fd_query
pub const TaskFdQueryAttr = extern struct {
/// input: pid
pid: pid_t,
/// input: fd
fd: fd_t,
/// input: flags
flags: u32,
/// input/output: buf len
buf_len: u32,
/// input/output:
/// tp_name for tracepoint
/// symbol for kprobe
/// filename for uprobe
buf: u64,
/// output: prod_id
prog_id: u32,
/// output: BPF_FD_TYPE
fd_type: u32,
/// output: probe_offset
probe_offset: u64,
/// output: probe_addr
probe_addr: u64,
};
/// struct used by Cmd.link_create command
pub const LinkCreateAttr = extern struct {
/// eBPF program to attach
prog_fd: fd_t,
/// object to attach to
target_fd: fd_t,
attach_type: u32,
/// extra flags
flags: u32,
};
/// struct used by Cmd.link_update command
pub const LinkUpdateAttr = extern struct {
link_fd: fd_t,
/// new program to update link with
new_prog_fd: fd_t,
/// extra flags
flags: u32,
/// expected link's program fd, it is specified only if BPF_F_REPLACE is
/// set in flags
old_prog_fd: fd_t,
};
/// struct used by Cmd.enable_stats command
pub const EnableStatsAttr = extern struct {
type: u32,
};
/// struct used by Cmd.iter_create command
pub const IterCreateAttr = extern struct {
link_fd: fd_t,
flags: u32,
};
/// Mega struct that is passed to the bpf() syscall
pub const Attr = extern union {
map_create: MapCreateAttr,
map_elem: MapElemAttr,
map_batch: MapBatchAttr,
prog_load: ProgLoadAttr,
obj: ObjAttr,
prog_attach: ProgAttachAttr,
test_run: TestRunAttr,
get_id: GetIdAttr,
info: InfoAttr,
query: QueryAttr,
raw_tracepoint: RawTracepointAttr,
btf_load: BtfLoadAttr,
task_fd_query: TaskFdQueryAttr,
link_create: LinkCreateAttr,
link_update: LinkUpdateAttr,
enable_stats: EnableStatsAttr,
iter_create: IterCreateAttr,
};
pub const Log = struct {
level: u32,
buf: []u8,
};
pub fn map_create(map_type: MapType, key_size: u32, value_size: u32, max_entries: u32) !fd_t {
var attr = Attr{
.map_create = std.mem.zeroes(MapCreateAttr),
};
attr.map_create.map_type = @intFromEnum(map_type);
attr.map_create.key_size = key_size;
attr.map_create.value_size = value_size;
attr.map_create.max_entries = max_entries;
const rc = linux.bpf(.map_create, &attr, @sizeOf(MapCreateAttr));
switch (errno(rc)) {
.SUCCESS => return @as(fd_t, @intCast(rc)),
.INVAL => return error.MapTypeOrAttrInvalid,
.NOMEM => return error.SystemResources,
.PERM => return error.AccessDenied,
else => |err| return unexpectedErrno(err),
}
}
test "map_create" {
const map = try map_create(.hash, 4, 4, 32);
defer std.os.close(map);
}
pub fn map_lookup_elem(fd: fd_t, key: []const u8, value: []u8) !void {
var attr = Attr{
.map_elem = std.mem.zeroes(MapElemAttr),
};
attr.map_elem.map_fd = fd;
attr.map_elem.key = @intFromPtr(key.ptr);
attr.map_elem.result.value = @intFromPtr(value.ptr);
const rc = linux.bpf(.map_lookup_elem, &attr, @sizeOf(MapElemAttr));
switch (errno(rc)) {
.SUCCESS => return,
.BADF => return error.BadFd,
.FAULT => unreachable,
.INVAL => return error.FieldInAttrNeedsZeroing,
.NOENT => return error.NotFound,
.PERM => return error.AccessDenied,
else => |err| return unexpectedErrno(err),
}
}
pub fn map_update_elem(fd: fd_t, key: []const u8, value: []const u8, flags: u64) !void {
var attr = Attr{
.map_elem = std.mem.zeroes(MapElemAttr),
};
attr.map_elem.map_fd = fd;
attr.map_elem.key = @intFromPtr(key.ptr);
attr.map_elem.result = .{ .value = @intFromPtr(value.ptr) };
attr.map_elem.flags = flags;
const rc = linux.bpf(.map_update_elem, &attr, @sizeOf(MapElemAttr));
switch (errno(rc)) {
.SUCCESS => return,
.@"2BIG" => return error.ReachedMaxEntries,
.BADF => return error.BadFd,
.FAULT => unreachable,
.INVAL => return error.FieldInAttrNeedsZeroing,
.NOMEM => return error.SystemResources,
.PERM => return error.AccessDenied,
else => |err| return unexpectedErrno(err),
}
}
pub fn map_delete_elem(fd: fd_t, key: []const u8) !void {
var attr = Attr{
.map_elem = std.mem.zeroes(MapElemAttr),
};
attr.map_elem.map_fd = fd;
attr.map_elem.key = @intFromPtr(key.ptr);
const rc = linux.bpf(.map_delete_elem, &attr, @sizeOf(MapElemAttr));
switch (errno(rc)) {
.SUCCESS => return,
.BADF => return error.BadFd,
.FAULT => unreachable,
.INVAL => return error.FieldInAttrNeedsZeroing,
.NOENT => return error.NotFound,
.PERM => return error.AccessDenied,
else => |err| return unexpectedErrno(err),
}
}
test "map lookup, update, and delete" {
const key_size = 4;
const value_size = 4;
const map = try map_create(.hash, key_size, value_size, 1);
defer std.os.close(map);
const key = std.mem.zeroes([key_size]u8);
var value = std.mem.zeroes([value_size]u8);
// fails looking up value that doesn't exist
try expectError(error.NotFound, map_lookup_elem(map, &key, &value));
// succeed at updating and looking up element
try map_update_elem(map, &key, &value, 0);
try map_lookup_elem(map, &key, &value);
// fails inserting more than max entries
const second_key = [key_size]u8{ 0, 0, 0, 1 };
try expectError(error.ReachedMaxEntries, map_update_elem(map, &second_key, &value, 0));
// succeed at deleting an existing elem
try map_delete_elem(map, &key);
try expectError(error.NotFound, map_lookup_elem(map, &key, &value));
// fail at deleting a non-existing elem
try expectError(error.NotFound, map_delete_elem(map, &key));
}
pub fn prog_load(
prog_type: ProgType,
insns: []const Insn,
log: ?*Log,
license: []const u8,
kern_version: u32,
) !fd_t {
var attr = Attr{
.prog_load = std.mem.zeroes(ProgLoadAttr),
};
attr.prog_load.prog_type = @intFromEnum(prog_type);
attr.prog_load.insns = @intFromPtr(insns.ptr);
attr.prog_load.insn_cnt = @as(u32, @intCast(insns.len));
attr.prog_load.license = @intFromPtr(license.ptr);
attr.prog_load.kern_version = kern_version;
if (log) |l| {
attr.prog_load.log_buf = @intFromPtr(l.buf.ptr);
attr.prog_load.log_size = @as(u32, @intCast(l.buf.len));
attr.prog_load.log_level = l.level;
}
const rc = linux.bpf(.prog_load, &attr, @sizeOf(ProgLoadAttr));
return switch (errno(rc)) {
.SUCCESS => @as(fd_t, @intCast(rc)),
.ACCES => error.UnsafeProgram,
.FAULT => unreachable,
.INVAL => error.InvalidProgram,
.PERM => error.AccessDenied,
else => |err| unexpectedErrno(err),
};
}
test "prog_load" {
// this should fail because it does not set r0 before exiting
const bad_prog = [_]Insn{
Insn.exit(),
};
const good_prog = [_]Insn{
Insn.mov(.r0, 0),
Insn.exit(),
};
const prog = try prog_load(.socket_filter, &good_prog, null, "MIT", 0);
defer std.os.close(prog);
try expectError(error.UnsafeProgram, prog_load(.socket_filter, &bad_prog, null, "MIT", 0));
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/i386.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const sockaddr = linux.sockaddr;
const timespec = linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
: "memory"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
[arg1] "{ebx}" (arg1),
: "memory"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
[arg1] "{ebx}" (arg1),
[arg2] "{ecx}" (arg2),
: "memory"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
[arg1] "{ebx}" (arg1),
[arg2] "{ecx}" (arg2),
[arg3] "{edx}" (arg3),
: "memory"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
[arg1] "{ebx}" (arg1),
[arg2] "{ecx}" (arg2),
[arg3] "{edx}" (arg3),
[arg4] "{esi}" (arg4),
: "memory"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
[arg1] "{ebx}" (arg1),
[arg2] "{ecx}" (arg2),
[arg3] "{edx}" (arg3),
[arg4] "{esi}" (arg4),
[arg5] "{edi}" (arg5),
: "memory"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
// The 6th argument is passed via memory as we're out of registers if ebp is
// used as frame pointer. We push arg6 value on the stack before changing
// ebp or esp as the compiler may reference it as an offset relative to one
// of those two registers.
return asm volatile (
\\ push %[arg6]
\\ push %%ebp
\\ mov 4(%%esp), %%ebp
\\ int $0x80
\\ pop %%ebp
\\ add $4, %%esp
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(number)),
[arg1] "{ebx}" (arg1),
[arg2] "{ecx}" (arg2),
[arg3] "{edx}" (arg3),
[arg4] "{esi}" (arg4),
[arg5] "{edi}" (arg5),
[arg6] "rm" (arg6),
: "memory"
);
}
pub fn socketcall(call: usize, args: [*]usize) usize {
return asm volatile ("int $0x80"
: [ret] "={eax}" (-> usize),
: [number] "{eax}" (@intFromEnum(SYS.socketcall)),
[arg1] "{ebx}" (call),
[arg2] "{ecx}" (@intFromPtr(args)),
: "memory"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub fn restore() callconv(.Naked) void {
return asm volatile ("int $0x80"
:
: [number] "{eax}" (@intFromEnum(SYS.sigreturn)),
: "memory"
);
}
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("int $0x80"
:
: [number] "{eax}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory"
);
}
pub const SYS = enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
waitpid = 7,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
time = 13,
mknod = 14,
chmod = 15,
lchown = 16,
@"break" = 17,
oldstat = 18,
lseek = 19,
getpid = 20,
mount = 21,
umount = 22,
setuid = 23,
getuid = 24,
stime = 25,
ptrace = 26,
alarm = 27,
oldfstat = 28,
pause = 29,
utime = 30,
stty = 31,
gtty = 32,
access = 33,
nice = 34,
ftime = 35,
sync = 36,
kill = 37,
rename = 38,
mkdir = 39,
rmdir = 40,
dup = 41,
pipe = 42,
times = 43,
prof = 44,
brk = 45,
setgid = 46,
getgid = 47,
signal = 48,
geteuid = 49,
getegid = 50,
acct = 51,
umount2 = 52,
lock = 53,
ioctl = 54,
fcntl = 55,
mpx = 56,
setpgid = 57,
ulimit = 58,
oldolduname = 59,
umask = 60,
chroot = 61,
ustat = 62,
dup2 = 63,
getppid = 64,
getpgrp = 65,
setsid = 66,
sigaction = 67,
sgetmask = 68,
ssetmask = 69,
setreuid = 70,
setregid = 71,
sigsuspend = 72,
sigpending = 73,
sethostname = 74,
setrlimit = 75,
getrlimit = 76,
getrusage = 77,
gettimeofday = 78,
settimeofday = 79,
getgroups = 80,
setgroups = 81,
select = 82,
symlink = 83,
oldlstat = 84,
readlink = 85,
uselib = 86,
swapon = 87,
reboot = 88,
readdir = 89,
mmap = 90,
munmap = 91,
truncate = 92,
ftruncate = 93,
fchmod = 94,
fchown = 95,
getpriority = 96,
setpriority = 97,
profil = 98,
statfs = 99,
fstatfs = 100,
ioperm = 101,
socketcall = 102,
syslog = 103,
setitimer = 104,
getitimer = 105,
stat = 106,
lstat = 107,
fstat = 108,
olduname = 109,
iopl = 110,
vhangup = 111,
idle = 112,
vm86old = 113,
wait4 = 114,
swapoff = 115,
sysinfo = 116,
ipc = 117,
fsync = 118,
sigreturn = 119,
clone = 120,
setdomainname = 121,
uname = 122,
modify_ldt = 123,
adjtimex = 124,
mprotect = 125,
sigprocmask = 126,
create_module = 127,
init_module = 128,
delete_module = 129,
get_kernel_syms = 130,
quotactl = 131,
getpgid = 132,
fchdir = 133,
bdflush = 134,
sysfs = 135,
personality = 136,
afs_syscall = 137,
setfsuid = 138,
setfsgid = 139,
_llseek = 140,
getdents = 141,
_newselect = 142,
flock = 143,
msync = 144,
readv = 145,
writev = 146,
getsid = 147,
fdatasync = 148,
_sysctl = 149,
mlock = 150,
munlock = 151,
mlockall = 152,
munlockall = 153,
sched_setparam = 154,
sched_getparam = 155,
sched_setscheduler = 156,
sched_getscheduler = 157,
sched_yield = 158,
sched_get_priority_max = 159,
sched_get_priority_min = 160,
sched_rr_get_interval = 161,
nanosleep = 162,
mremap = 163,
setresuid = 164,
getresuid = 165,
vm86 = 166,
query_module = 167,
poll = 168,
nfsservctl = 169,
setresgid = 170,
getresgid = 171,
prctl = 172,
rt_sigreturn = 173,
rt_sigaction = 174,
rt_sigprocmask = 175,
rt_sigpending = 176,
rt_sigtimedwait = 177,
rt_sigqueueinfo = 178,
rt_sigsuspend = 179,
pread64 = 180,
pwrite64 = 181,
chown = 182,
getcwd = 183,
capget = 184,
capset = 185,
sigaltstack = 186,
sendfile = 187,
getpmsg = 188,
putpmsg = 189,
vfork = 190,
ugetrlimit = 191,
mmap2 = 192,
truncate64 = 193,
ftruncate64 = 194,
stat64 = 195,
lstat64 = 196,
fstat64 = 197,
lchown32 = 198,
getuid32 = 199,
getgid32 = 200,
geteuid32 = 201,
getegid32 = 202,
setreuid32 = 203,
setregid32 = 204,
getgroups32 = 205,
setgroups32 = 206,
fchown32 = 207,
setresuid32 = 208,
getresuid32 = 209,
setresgid32 = 210,
getresgid32 = 211,
chown32 = 212,
setuid32 = 213,
setgid32 = 214,
setfsuid32 = 215,
setfsgid32 = 216,
pivot_root = 217,
mincore = 218,
madvise = 219,
getdents64 = 220,
fcntl64 = 221,
gettid = 224,
readahead = 225,
setxattr = 226,
lsetxattr = 227,
fsetxattr = 228,
getxattr = 229,
lgetxattr = 230,
fgetxattr = 231,
listxattr = 232,
llistxattr = 233,
flistxattr = 234,
removexattr = 235,
lremovexattr = 236,
fremovexattr = 237,
tkill = 238,
sendfile64 = 239,
futex = 240,
sched_setaffinity = 241,
sched_getaffinity = 242,
set_thread_area = 243,
get_thread_area = 244,
io_setup = 245,
io_destroy = 246,
io_getevents = 247,
io_submit = 248,
io_cancel = 249,
fadvise64 = 250,
exit_group = 252,
lookup_dcookie = 253,
epoll_create = 254,
epoll_ctl = 255,
epoll_wait = 256,
remap_file_pages = 257,
set_tid_address = 258,
timer_create = 259,
timer_settime, // SYS_timer_create + 1
timer_gettime, // SYS_timer_create + 2
timer_getoverrun, // SYS_timer_create + 3
timer_delete, // SYS_timer_create + 4
clock_settime, // SYS_timer_create + 5
clock_gettime, // SYS_timer_create + 6
clock_getres, // SYS_timer_create + 7
clock_nanosleep, // SYS_timer_create + 8
statfs64 = 268,
fstatfs64 = 269,
tgkill = 270,
utimes = 271,
fadvise64_64 = 272,
vserver = 273,
mbind = 274,
get_mempolicy = 275,
set_mempolicy = 276,
mq_open = 277,
mq_unlink, // SYS_mq_open + 1
mq_timedsend, // SYS_mq_open + 2
mq_timedreceive, // SYS_mq_open + 3
mq_notify, // SYS_mq_open + 4
mq_getsetattr, // SYS_mq_open + 5
kexec_load = 283,
waitid = 284,
add_key = 286,
request_key = 287,
keyctl = 288,
ioprio_set = 289,
ioprio_get = 290,
inotify_init = 291,
inotify_add_watch = 292,
inotify_rm_watch = 293,
migrate_pages = 294,
openat = 295,
mkdirat = 296,
mknodat = 297,
fchownat = 298,
futimesat = 299,
fstatat64 = 300,
unlinkat = 301,
renameat = 302,
linkat = 303,
symlinkat = 304,
readlinkat = 305,
fchmodat = 306,
faccessat = 307,
pselect6 = 308,
ppoll = 309,
unshare = 310,
set_robust_list = 311,
get_robust_list = 312,
splice = 313,
sync_file_range = 314,
tee = 315,
vmsplice = 316,
move_pages = 317,
getcpu = 318,
epoll_pwait = 319,
utimensat = 320,
signalfd = 321,
timerfd_create = 322,
eventfd = 323,
fallocate = 324,
timerfd_settime = 325,
timerfd_gettime = 326,
signalfd4 = 327,
eventfd2 = 328,
epoll_create1 = 329,
dup3 = 330,
pipe2 = 331,
inotify_init1 = 332,
preadv = 333,
pwritev = 334,
rt_tgsigqueueinfo = 335,
perf_event_open = 336,
recvmmsg = 337,
fanotify_init = 338,
fanotify_mark = 339,
prlimit64 = 340,
name_to_handle_at = 341,
open_by_handle_at = 342,
clock_adjtime = 343,
syncfs = 344,
sendmmsg = 345,
setns = 346,
process_vm_readv = 347,
process_vm_writev = 348,
kcmp = 349,
finit_module = 350,
sched_setattr = 351,
sched_getattr = 352,
renameat2 = 353,
seccomp = 354,
getrandom = 355,
memfd_create = 356,
bpf = 357,
execveat = 358,
socket = 359,
socketpair = 360,
bind = 361,
connect = 362,
listen = 363,
accept4 = 364,
getsockopt = 365,
setsockopt = 366,
getsockname = 367,
getpeername = 368,
sendto = 369,
sendmsg = 370,
recvfrom = 371,
recvmsg = 372,
shutdown = 373,
userfaultfd = 374,
membarrier = 375,
mlock2 = 376,
copy_file_range = 377,
preadv2 = 378,
pwritev2 = 379,
pkey_mprotect = 380,
pkey_alloc = 381,
pkey_free = 382,
statx = 383,
arch_prctl = 384,
io_pgetevents = 385,
rseq = 386,
semget = 393,
semctl = 394,
shmget = 395,
shmctl = 396,
shmat = 397,
shmdt = 398,
msgget = 399,
msgsnd = 400,
msgrcv = 401,
msgctl = 402,
clock_gettime64 = 403,
clock_settime64 = 404,
clock_adjtime64 = 405,
clock_getres_time64 = 406,
clock_nanosleep_time64 = 407,
timer_gettime64 = 408,
timer_settime64 = 409,
timerfd_gettime64 = 410,
timerfd_settime64 = 411,
utimensat_time64 = 412,
pselect6_time64 = 413,
ppoll_time64 = 414,
io_pgetevents_time64 = 416,
recvmmsg_time64 = 417,
mq_timedsend_time64 = 418,
mq_timedreceive_time64 = 419,
semtimedop_time64 = 420,
rt_sigtimedwait_time64 = 421,
futex_time64 = 422,
sched_rr_get_interval_time64 = 423,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
memfd_secret = 447,
_,
};
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o200000;
pub const NOFOLLOW = 0o400000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o40000;
pub const LARGEFILE = 0o100000;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20200000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const GETLK = 12;
pub const SETLK = 13;
pub const SETLKW = 14;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const NB = 4;
pub const UN = 8;
};
pub const MAP = struct {
pub const NORESERVE = 0x4000;
pub const GROWSDOWN = 0x0100;
pub const DENYWRITE = 0x0800;
pub const EXECUTABLE = 0x1000;
pub const LOCKED = 0x2000;
pub const @"32BIT" = 0x40;
};
pub const MMAP2_UNIT = 4096;
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
};
pub const ARCH = struct {};
pub const Flock = extern struct {
type: i16,
whence: i16,
start: off_t,
len: off_t,
pid: pid_t,
};
pub const msghdr = extern struct {
name: ?*sockaddr,
namelen: socklen_t,
iov: [*]iovec,
iovlen: i32,
control: ?*anyopaque,
controllen: socklen_t,
flags: i32,
};
pub const msghdr_const = extern struct {
name: ?*const sockaddr,
namelen: socklen_t,
iov: [*]iovec_const,
iovlen: i32,
control: ?*anyopaque,
controllen: socklen_t,
flags: i32,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = isize;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
__dev_padding: u32,
__ino_truncated: u32,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__rdev_padding: u32,
size: off_t,
blksize: blksize_t,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
ino: ino_t,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: i32,
tv_usec: i32,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const mcontext_t = extern struct {
gregs: [19]usize,
fpregs: [*]u8,
oldmask: usize,
cr2: usize,
};
pub const REG = struct {
pub const GS = 0;
pub const FS = 1;
pub const ES = 2;
pub const DS = 3;
pub const EDI = 4;
pub const ESI = 5;
pub const EBP = 6;
pub const ESP = 7;
pub const EBX = 8;
pub const EDX = 9;
pub const ECX = 10;
pub const EAX = 11;
pub const TRAPNO = 12;
pub const ERR = 13;
pub const EIP = 14;
pub const CS = 15;
pub const EFL = 16;
pub const UESP = 17;
pub const SS = 18;
};
pub const ucontext_t = extern struct {
flags: usize,
link: *ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
sigmask: sigset_t,
regspace: [64]u64,
};
pub const Elf_Symndx = u32;
pub const user_desc = packed struct {
entry_number: u32,
base_addr: u32,
limit: u32,
seg_32bit: u1,
contents: u2,
read_exec_only: u1,
limit_in_pages: u1,
seg_not_present: u1,
useable: u1,
};
/// socketcall() call numbers
pub const SC = struct {
pub const socket = 1;
pub const bind = 2;
pub const connect = 3;
pub const listen = 4;
pub const accept = 5;
pub const getsockname = 6;
pub const getpeername = 7;
pub const socketpair = 8;
pub const send = 9;
pub const recv = 10;
pub const sendto = 11;
pub const recvfrom = 12;
pub const shutdown = 13;
pub const setsockopt = 14;
pub const getsockopt = 15;
pub const sendmsg = 16;
pub const recvmsg = 17;
pub const accept4 = 18;
pub const recvmmsg = 19;
pub const sendmmsg = 20;
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/arm-eabi.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
const socklen_t = linux.socklen_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const sockaddr = linux.sockaddr;
const timespec = linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
: "memory"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
[arg1] "{r0}" (arg1),
: "memory"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
: "memory"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
: "memory"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
[arg4] "{r3}" (arg4),
: "memory"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
[arg4] "{r3}" (arg4),
[arg5] "{r4}" (arg5),
: "memory"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile ("svc #0"
: [ret] "={r0}" (-> usize),
: [number] "{r7}" (@intFromEnum(number)),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
[arg4] "{r3}" (arg4),
[arg5] "{r4}" (arg5),
[arg6] "{r5}" (arg6),
: "memory"
);
}
/// This matches the libc clone function.
pub extern fn clone(
func: fn (arg: usize) callconv(.C) u8,
stack: usize,
flags: u32,
arg: usize,
ptid: *i32,
tls: usize,
ctid: *i32,
) usize;
pub fn restore() callconv(.Naked) void {
return asm volatile ("svc #0"
:
: [number] "{r7}" (@intFromEnum(SYS.sigreturn)),
: "memory"
);
}
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("svc #0"
:
: [number] "{r7}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory"
);
}
pub const SYS = enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
mknod = 14,
chmod = 15,
lchown = 16,
lseek = 19,
getpid = 20,
mount = 21,
setuid = 23,
getuid = 24,
ptrace = 26,
pause = 29,
access = 33,
nice = 34,
sync = 36,
kill = 37,
rename = 38,
mkdir = 39,
rmdir = 40,
dup = 41,
pipe = 42,
times = 43,
brk = 45,
setgid = 46,
getgid = 47,
geteuid = 49,
getegid = 50,
acct = 51,
umount2 = 52,
ioctl = 54,
fcntl = 55,
setpgid = 57,
umask = 60,
chroot = 61,
ustat = 62,
dup2 = 63,
getppid = 64,
getpgrp = 65,
setsid = 66,
sigaction = 67,
setreuid = 70,
setregid = 71,
sigsuspend = 72,
sigpending = 73,
sethostname = 74,
setrlimit = 75,
getrusage = 77,
gettimeofday = 78,
settimeofday = 79,
getgroups = 80,
setgroups = 81,
symlink = 83,
readlink = 85,
uselib = 86,
swapon = 87,
reboot = 88,
munmap = 91,
truncate = 92,
ftruncate = 93,
fchmod = 94,
fchown = 95,
getpriority = 96,
setpriority = 97,
statfs = 99,
fstatfs = 100,
syslog = 103,
setitimer = 104,
getitimer = 105,
stat = 106,
lstat = 107,
fstat = 108,
vhangup = 111,
wait4 = 114,
swapoff = 115,
sysinfo = 116,
fsync = 118,
sigreturn = 119,
clone = 120,
setdomainname = 121,
uname = 122,
adjtimex = 124,
mprotect = 125,
sigprocmask = 126,
init_module = 128,
delete_module = 129,
quotactl = 131,
getpgid = 132,
fchdir = 133,
bdflush = 134,
sysfs = 135,
personality = 136,
setfsuid = 138,
setfsgid = 139,
_llseek = 140,
getdents = 141,
_newselect = 142,
flock = 143,
msync = 144,
readv = 145,
writev = 146,
getsid = 147,
fdatasync = 148,
_sysctl = 149,
mlock = 150,
munlock = 151,
mlockall = 152,
munlockall = 153,
sched_setparam = 154,
sched_getparam = 155,
sched_setscheduler = 156,
sched_getscheduler = 157,
sched_yield = 158,
sched_get_priority_max = 159,
sched_get_priority_min = 160,
sched_rr_get_interval = 161,
nanosleep = 162,
mremap = 163,
setresuid = 164,
getresuid = 165,
poll = 168,
nfsservctl = 169,
setresgid = 170,
getresgid = 171,
prctl = 172,
rt_sigreturn = 173,
rt_sigaction = 174,
rt_sigprocmask = 175,
rt_sigpending = 176,
rt_sigtimedwait = 177,
rt_sigqueueinfo = 178,
rt_sigsuspend = 179,
pread64 = 180,
pwrite64 = 181,
chown = 182,
getcwd = 183,
capget = 184,
capset = 185,
sigaltstack = 186,
sendfile = 187,
vfork = 190,
ugetrlimit = 191,
mmap2 = 192,
truncate64 = 193,
ftruncate64 = 194,
stat64 = 195,
lstat64 = 196,
fstat64 = 197,
lchown32 = 198,
getuid32 = 199,
getgid32 = 200,
geteuid32 = 201,
getegid32 = 202,
setreuid32 = 203,
setregid32 = 204,
getgroups32 = 205,
setgroups32 = 206,
fchown32 = 207,
setresuid32 = 208,
getresuid32 = 209,
setresgid32 = 210,
getresgid32 = 211,
chown32 = 212,
setuid32 = 213,
setgid32 = 214,
setfsuid32 = 215,
setfsgid32 = 216,
getdents64 = 217,
pivot_root = 218,
mincore = 219,
madvise = 220,
fcntl64 = 221,
gettid = 224,
readahead = 225,
setxattr = 226,
lsetxattr = 227,
fsetxattr = 228,
getxattr = 229,
lgetxattr = 230,
fgetxattr = 231,
listxattr = 232,
llistxattr = 233,
flistxattr = 234,
removexattr = 235,
lremovexattr = 236,
fremovexattr = 237,
tkill = 238,
sendfile64 = 239,
futex = 240,
sched_setaffinity = 241,
sched_getaffinity = 242,
io_setup = 243,
io_destroy = 244,
io_getevents = 245,
io_submit = 246,
io_cancel = 247,
exit_group = 248,
lookup_dcookie = 249,
epoll_create = 250,
epoll_ctl = 251,
epoll_wait = 252,
remap_file_pages = 253,
set_tid_address = 256,
timer_create = 257,
timer_settime = 258,
timer_gettime = 259,
timer_getoverrun = 260,
timer_delete = 261,
clock_settime = 262,
clock_gettime = 263,
clock_getres = 264,
clock_nanosleep = 265,
statfs64 = 266,
fstatfs64 = 267,
tgkill = 268,
utimes = 269,
fadvise64_64 = 270,
pciconfig_iobase = 271,
pciconfig_read = 272,
pciconfig_write = 273,
mq_open = 274,
mq_unlink = 275,
mq_timedsend = 276,
mq_timedreceive = 277,
mq_notify = 278,
mq_getsetattr = 279,
waitid = 280,
socket = 281,
bind = 282,
connect = 283,
listen = 284,
accept = 285,
getsockname = 286,
getpeername = 287,
socketpair = 288,
send = 289,
sendto = 290,
recv = 291,
recvfrom = 292,
shutdown = 293,
setsockopt = 294,
getsockopt = 295,
sendmsg = 296,
recvmsg = 297,
semop = 298,
semget = 299,
semctl = 300,
msgsnd = 301,
msgrcv = 302,
msgget = 303,
msgctl = 304,
shmat = 305,
shmdt = 306,
shmget = 307,
shmctl = 308,
add_key = 309,
request_key = 310,
keyctl = 311,
semtimedop = 312,
vserver = 313,
ioprio_set = 314,
ioprio_get = 315,
inotify_init = 316,
inotify_add_watch = 317,
inotify_rm_watch = 318,
mbind = 319,
get_mempolicy = 320,
set_mempolicy = 321,
openat = 322,
mkdirat = 323,
mknodat = 324,
fchownat = 325,
futimesat = 326,
fstatat64 = 327,
unlinkat = 328,
renameat = 329,
linkat = 330,
symlinkat = 331,
readlinkat = 332,
fchmodat = 333,
faccessat = 334,
pselect6 = 335,
ppoll = 336,
unshare = 337,
set_robust_list = 338,
get_robust_list = 339,
splice = 340,
sync_file_range = 341,
tee = 342,
vmsplice = 343,
move_pages = 344,
getcpu = 345,
epoll_pwait = 346,
kexec_load = 347,
utimensat = 348,
signalfd = 349,
timerfd_create = 350,
eventfd = 351,
fallocate = 352,
timerfd_settime = 353,
timerfd_gettime = 354,
signalfd4 = 355,
eventfd2 = 356,
epoll_create1 = 357,
dup3 = 358,
pipe2 = 359,
inotify_init1 = 360,
preadv = 361,
pwritev = 362,
rt_tgsigqueueinfo = 363,
perf_event_open = 364,
recvmmsg = 365,
accept4 = 366,
fanotify_init = 367,
fanotify_mark = 368,
prlimit64 = 369,
name_to_handle_at = 370,
open_by_handle_at = 371,
clock_adjtime = 372,
syncfs = 373,
sendmmsg = 374,
setns = 375,
process_vm_readv = 376,
process_vm_writev = 377,
kcmp = 378,
finit_module = 379,
sched_setattr = 380,
sched_getattr = 381,
renameat2 = 382,
seccomp = 383,
getrandom = 384,
memfd_create = 385,
bpf = 386,
execveat = 387,
userfaultfd = 388,
membarrier = 389,
mlock2 = 390,
copy_file_range = 391,
preadv2 = 392,
pwritev2 = 393,
pkey_mprotect = 394,
pkey_alloc = 395,
pkey_free = 396,
statx = 397,
rseq = 398,
io_pgetevents = 399,
migrate_pages = 400,
kexec_file_load = 401,
clock_gettime64 = 403,
clock_settime64 = 404,
clock_adjtime64 = 405,
clock_getres_time64 = 406,
clock_nanosleep_time64 = 407,
timer_gettime64 = 408,
timer_settime64 = 409,
timerfd_gettime64 = 410,
timerfd_settime64 = 411,
utimensat_time64 = 412,
pselect6_time64 = 413,
ppoll_time64 = 414,
io_pgetevents_time64 = 416,
recvmmsg_time64 = 417,
mq_timedsend_time64 = 418,
mq_timedreceive_time64 = 419,
semtimedop_time64 = 420,
rt_sigtimedwait_time64 = 421,
futex_time64 = 422,
sched_rr_get_interval_time64 = 423,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
breakpoint = 0x0f0001,
cacheflush = 0x0f0002,
usr26 = 0x0f0003,
usr32 = 0x0f0004,
set_tls = 0x0f0005,
get_tls = 0x0f0006,
_,
};
pub const MMAP2_UNIT = 4096;
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o40000;
pub const NOFOLLOW = 0o100000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o200000;
pub const LARGEFILE = 0o400000;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20040000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const GETLK = 12;
pub const SETLK = 13;
pub const SETLKW = 14;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const UN = 8;
pub const NB = 4;
};
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x2000;
/// don't check for reservations
pub const NORESERVE = 0x4000;
};
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
};
pub const HWCAP = struct {
pub const SWP = 1 << 0;
pub const HALF = 1 << 1;
pub const THUMB = 1 << 2;
pub const @"26BIT" = 1 << 3;
pub const FAST_MULT = 1 << 4;
pub const FPA = 1 << 5;
pub const VFP = 1 << 6;
pub const EDSP = 1 << 7;
pub const JAVA = 1 << 8;
pub const IWMMXT = 1 << 9;
pub const CRUNCH = 1 << 10;
pub const THUMBEE = 1 << 11;
pub const NEON = 1 << 12;
pub const VFPv3 = 1 << 13;
pub const VFPv3D16 = 1 << 14;
pub const TLS = 1 << 15;
pub const VFPv4 = 1 << 16;
pub const IDIVA = 1 << 17;
pub const IDIVT = 1 << 18;
pub const VFPD32 = 1 << 19;
pub const IDIV = IDIVA | IDIVT;
pub const LPAE = 1 << 20;
pub const EVTSTRM = 1 << 21;
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
__pad0: [4]u8,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
__unused: [4]u8,
};
pub const msghdr = extern struct {
msg_name: ?*sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec,
msg_iovlen: i32,
msg_control: ?*anyopaque,
msg_controllen: socklen_t,
msg_flags: i32,
};
pub const msghdr_const = extern struct {
msg_name: ?*const sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec_const,
msg_iovlen: i32,
msg_control: ?*anyopaque,
msg_controllen: socklen_t,
msg_flags: i32,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = isize;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
__dev_padding: u32,
__ino_truncated: u32,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__rdev_padding: u32,
size: off_t,
blksize: blksize_t,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
ino: ino_t,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: i32,
tv_usec: i32,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const mcontext_t = extern struct {
trap_no: usize,
error_code: usize,
oldmask: usize,
arm_r0: usize,
arm_r1: usize,
arm_r2: usize,
arm_r3: usize,
arm_r4: usize,
arm_r5: usize,
arm_r6: usize,
arm_r7: usize,
arm_r8: usize,
arm_r9: usize,
arm_r10: usize,
arm_fp: usize,
arm_ip: usize,
arm_sp: usize,
arm_lr: usize,
arm_pc: usize,
arm_cpsr: usize,
fault_address: usize,
};
pub const ucontext_t = extern struct {
flags: usize,
link: *ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
sigmask: sigset_t,
regspace: [64]u64,
};
pub const Elf_Symndx = u32;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/tls.zig | const std = @import("std");
const os = std.os;
const mem = std.mem;
const elf = std.elf;
const math = std.math;
const assert = std.debug.assert;
const native_arch = @import("builtin").cpu.arch;
// This file implements the two TLS variants [1] used by ELF-based systems.
//
// The variant I has the following layout in memory:
// -------------------------------------------------------
// | DTV | Zig | DTV | Alignment | TLS |
// | storage | thread data | pointer | | block |
// ------------------------^------------------------------
// `-- The thread pointer register points here
//
// In this case we allocate additional space for our control structure that's
// placed _before_ the DTV pointer together with the DTV.
//
// NOTE: Some systems such as power64 or mips use this variant with a twist: the
// alignment is not present and the tp and DTV addresses are offset by a
// constant.
//
// On the other hand the variant II has the following layout in memory:
// ---------------------------------------
// | TLS | TCB | Zig | DTV |
// | block | | thread data | storage |
// --------^------------------------------
// `-- The thread pointer register points here
//
// The structure of the TCB is not defined by the ABI so we reserve enough space
// for a single pointer as some architectures such as i386 and x86_64 need a
// pointer to the TCB block itself at the address pointed by the tp.
//
// In this case the control structure and DTV are placed one after another right
// after the TLS block data.
//
// At the moment the DTV is very simple since we only support static TLS, all we
// need is a two word vector to hold the number of entries (1) and the address
// of the first TLS block.
//
// [1] https://www.akkadia.org/drepper/tls.pdf
const TLSVariant = enum {
VariantI,
VariantII,
};
const tls_variant = switch (native_arch) {
.arm, .armeb, .thumb, .aarch64, .aarch64_be, .riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => TLSVariant.VariantI,
.x86_64, .i386, .sparcv9 => TLSVariant.VariantII,
else => @compileError("undefined tls_variant for this architecture"),
};
// Controls how many bytes are reserved for the Thread Control Block
const tls_tcb_size = switch (native_arch) {
// ARM EABI mandates enough space for two pointers: the first one points to
// the DTV while the second one is unspecified but reserved
.arm, .armeb, .thumb, .aarch64, .aarch64_be => 2 * @sizeOf(usize),
// One pointer-sized word that points either to the DTV or the TCB itself
else => @sizeOf(usize),
};
// Controls if the TP points to the end of the TCB instead of its beginning
const tls_tp_points_past_tcb = switch (native_arch) {
.riscv32, .riscv64, .mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => true,
else => false,
};
// Some architectures add some offset to the tp and dtv addresses in order to
// make the generated code more efficient
const tls_tp_offset = switch (native_arch) {
.mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => 0x7000,
else => 0,
};
const tls_dtv_offset = switch (native_arch) {
.mips, .mipsel, .powerpc, .powerpc64, .powerpc64le => 0x8000,
.riscv32, .riscv64 => 0x800,
else => 0,
};
// Per-thread storage for Zig's use
const CustomData = struct {
dummy: usize,
};
// Dynamic Thread Vector
const DTV = extern struct {
entries: usize,
tls_block: [1][*]u8,
};
// Holds all the information about the process TLS image
const TLSImage = struct {
init_data: []const u8,
alloc_size: usize,
alloc_align: usize,
tcb_offset: usize,
dtv_offset: usize,
data_offset: usize,
data_size: usize,
// Only used on the i386 architecture
gdt_entry_number: usize,
};
pub var tls_image: TLSImage = undefined;
pub fn setThreadPointer(addr: usize) void {
switch (native_arch) {
.i386 => {
var user_desc = std.os.linux.user_desc{
.entry_number = tls_image.gdt_entry_number,
.base_addr = addr,
.limit = 0xfffff,
.seg_32bit = 1,
.contents = 0, // Data
.read_exec_only = 0,
.limit_in_pages = 1,
.seg_not_present = 0,
.useable = 1,
};
const rc = std.os.linux.syscall1(.set_thread_area, @intFromPtr(&user_desc));
assert(rc == 0);
const gdt_entry_number = user_desc.entry_number;
// We have to keep track of our slot as it's also needed for clone()
tls_image.gdt_entry_number = gdt_entry_number;
// Update the %gs selector
asm volatile ("movl %[gs_val], %%gs"
:
: [gs_val] "r" (gdt_entry_number << 3 | 3),
);
},
.x86_64 => {
const rc = std.os.linux.syscall2(.arch_prctl, std.os.linux.ARCH.SET_FS, addr);
assert(rc == 0);
},
.aarch64 => {
asm volatile (
\\ msr tpidr_el0, %[addr]
:
: [addr] "r" (addr),
);
},
.arm, .thumb => {
const rc = std.os.linux.syscall1(.set_tls, addr);
assert(rc == 0);
},
.riscv64 => {
asm volatile (
\\ mv tp, %[addr]
:
: [addr] "r" (addr),
);
},
.mips, .mipsel => {
const rc = std.os.linux.syscall1(.set_thread_area, addr);
assert(rc == 0);
},
.powerpc => {
asm volatile (
\\ mr 2, %[addr]
:
: [addr] "r" (addr),
);
},
.powerpc64, .powerpc64le => {
asm volatile (
\\ mr 13, %[addr]
:
: [addr] "r" (addr),
);
},
.sparcv9 => {
asm volatile (
\\ mov %[addr], %%g7
:
: [addr] "r" (addr),
);
},
else => @compileError("Unsupported architecture"),
}
}
fn initTLS(phdrs: []elf.Phdr) void {
var tls_phdr: ?*elf.Phdr = null;
var img_base: usize = 0;
for (phdrs) |*phdr| {
switch (phdr.p_type) {
elf.PT_PHDR => img_base = @intFromPtr(phdrs.ptr) - phdr.p_vaddr,
elf.PT_TLS => tls_phdr = phdr,
else => {},
}
}
var tls_align_factor: usize = undefined;
var tls_data: []const u8 = undefined;
var tls_data_alloc_size: usize = undefined;
if (tls_phdr) |phdr| {
// The effective size in memory is represented by p_memsz, the length of
// the data stored in the PT_TLS segment is p_filesz and may be less
// than the former
tls_align_factor = phdr.p_align;
tls_data = @as([*]u8, @ptrFromInt(img_base + phdr.p_vaddr))[0..phdr.p_filesz];
tls_data_alloc_size = phdr.p_memsz;
} else {
tls_align_factor = @alignOf(usize);
tls_data = &[_]u8{};
tls_data_alloc_size = 0;
}
// Offsets into the allocated TLS area
var tcb_offset: usize = undefined;
var dtv_offset: usize = undefined;
var data_offset: usize = undefined;
// Compute the total size of the ABI-specific data plus our own control
// structures. All the offset calculated here assume a well-aligned base
// address.
const alloc_size = switch (tls_variant) {
.VariantI => blk: {
var l: usize = 0;
dtv_offset = l;
l += @sizeOf(DTV);
// Add some padding here so that the thread pointer (tcb_offset) is
// aligned to p_align and the CustomData structure can be found by
// simply subtracting its @sizeOf from the tp value
const delta = (l + @sizeOf(CustomData)) & (tls_align_factor - 1);
if (delta > 0)
l += tls_align_factor - delta;
l += @sizeOf(CustomData);
tcb_offset = l;
l += mem.alignForward(tls_tcb_size, tls_align_factor);
data_offset = l;
l += tls_data_alloc_size;
break :blk l;
},
.VariantII => blk: {
var l: usize = 0;
data_offset = l;
l += mem.alignForward(tls_data_alloc_size, tls_align_factor);
// The thread pointer is aligned to p_align
tcb_offset = l;
l += tls_tcb_size;
// The CustomData structure is right after the TCB with no padding
// in between so it can be easily found
l += @sizeOf(CustomData);
l = mem.alignForward(l, @alignOf(DTV));
dtv_offset = l;
l += @sizeOf(DTV);
break :blk l;
},
};
tls_image = TLSImage{
.init_data = tls_data,
.alloc_size = alloc_size,
.alloc_align = tls_align_factor,
.tcb_offset = tcb_offset,
.dtv_offset = dtv_offset,
.data_offset = data_offset,
.data_size = tls_data_alloc_size,
.gdt_entry_number = @as(usize, @bitCast(@as(isize, -1))),
};
}
inline fn alignPtrCast(comptime T: type, ptr: [*]u8) *T {
return @ptrCast(@alignCast(ptr));
}
/// Initializes all the fields of the static TLS area and returns the computed
/// architecture-specific value of the thread-pointer register
pub fn prepareTLS(area: []u8) usize {
// Clear the area we're going to use, just to be safe
mem.set(u8, area, 0);
// Prepare the DTV
const dtv = alignPtrCast(DTV, area.ptr + tls_image.dtv_offset);
dtv.entries = 1;
dtv.tls_block[0] = area.ptr + tls_dtv_offset + tls_image.data_offset;
// Prepare the TCB
const tcb_ptr = alignPtrCast([*]u8, area.ptr + tls_image.tcb_offset);
tcb_ptr.* = switch (tls_variant) {
.VariantI => area.ptr + tls_image.dtv_offset,
.VariantII => area.ptr + tls_image.tcb_offset,
};
// Copy the data
mem.copy(u8, area[tls_image.data_offset..], tls_image.init_data);
// Return the corrected value (if needed) for the tp register.
// Overflow here is not a problem, the pointer arithmetic involving the tp
// is done with wrapping semantics.
return @intFromPtr(area.ptr) +% tls_tp_offset +%
if (tls_tp_points_past_tcb) tls_image.data_offset else tls_image.tcb_offset;
}
// The main motivation for the size chosen here is this is how much ends up being
// requested for the thread local variables of the std.crypto.random implementation.
// I'm not sure why it ends up being so much; the struct itself is only 64 bytes.
// I think it has to do with being page aligned and LLVM or LLD is not smart enough
// to lay out the TLS data in a space conserving way. Anyway I think it's fine
// because it's less than 3 pages of memory, and putting it in the ELF like this
// is equivalent to moving the mmap call below into the kernel, avoiding syscall
// overhead.
var main_thread_tls_buffer: [0x2100]u8 align(mem.page_size) = undefined;
pub fn initStaticTLS(phdrs: []elf.Phdr) void {
initTLS(phdrs);
const tls_area = blk: {
// Fast path for the common case where the TLS data is really small,
// avoid an allocation and use our local buffer.
if (tls_image.alloc_align <= mem.page_size and
tls_image.alloc_size <= main_thread_tls_buffer.len)
{
break :blk main_thread_tls_buffer[0..tls_image.alloc_size];
}
const alloc_tls_area = os.mmap(
null,
tls_image.alloc_size + tls_image.alloc_align - 1,
os.PROT.READ | os.PROT.WRITE,
os.MAP.PRIVATE | os.MAP.ANONYMOUS,
-1,
0,
) catch os.abort();
// Make sure the slice is correctly aligned.
const begin_addr = @intFromPtr(alloc_tls_area.ptr);
const begin_aligned_addr = mem.alignForward(begin_addr, tls_image.alloc_align);
const start = begin_aligned_addr - begin_addr;
break :blk alloc_tls_area[start .. start + tls_image.alloc_size];
};
const tp_value = prepareTLS(tls_area);
setThreadPointer(tp_value);
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/start_pie.zig | const std = @import("std");
const builtin = @import("builtin");
const elf = std.elf;
const assert = std.debug.assert;
const R_AMD64_RELATIVE = 8;
const R_386_RELATIVE = 8;
const R_ARM_RELATIVE = 23;
const R_AARCH64_RELATIVE = 1027;
const R_RISCV_RELATIVE = 3;
const R_SPARC_RELATIVE = 22;
const R_RELATIVE = switch (builtin.cpu.arch) {
.i386 => R_386_RELATIVE,
.x86_64 => R_AMD64_RELATIVE,
.arm => R_ARM_RELATIVE,
.aarch64 => R_AARCH64_RELATIVE,
.riscv64 => R_RISCV_RELATIVE,
else => @compileError("Missing R_RELATIVE definition for this target"),
};
// Obtain a pointer to the _DYNAMIC array.
// We have to compute its address as a PC-relative quantity not to require a
// relocation that, at this point, is not yet applied.
fn getDynamicSymbol() [*]elf.Dyn {
return switch (builtin.cpu.arch) {
.i386 => asm volatile (
\\ .weak _DYNAMIC
\\ .hidden _DYNAMIC
\\ call 1f
\\ 1: pop %[ret]
\\ lea _DYNAMIC-1b(%[ret]), %[ret]
: [ret] "=r" (-> [*]elf.Dyn),
),
.x86_64 => asm volatile (
\\ .weak _DYNAMIC
\\ .hidden _DYNAMIC
\\ lea _DYNAMIC(%%rip), %[ret]
: [ret] "=r" (-> [*]elf.Dyn),
),
// Work around the limited offset range of `ldr`
.arm => asm volatile (
\\ .weak _DYNAMIC
\\ .hidden _DYNAMIC
\\ ldr %[ret], 1f
\\ add %[ret], pc
\\ b 2f
\\ 1: .word _DYNAMIC-1b
\\ 2:
: [ret] "=r" (-> [*]elf.Dyn),
),
// A simple `adr` is not enough as it has a limited offset range
.aarch64 => asm volatile (
\\ .weak _DYNAMIC
\\ .hidden _DYNAMIC
\\ adrp %[ret], _DYNAMIC
\\ add %[ret], %[ret], #:lo12:_DYNAMIC
: [ret] "=r" (-> [*]elf.Dyn),
),
.riscv64 => asm volatile (
\\ .weak _DYNAMIC
\\ .hidden _DYNAMIC
\\ lla %[ret], _DYNAMIC
: [ret] "=r" (-> [*]elf.Dyn),
),
else => {
@compileError("PIE startup is not yet supported for this target!");
},
};
}
pub fn relocate(phdrs: []elf.Phdr) void {
@setRuntimeSafety(false);
const dynv = getDynamicSymbol();
// Recover the delta applied by the loader by comparing the effective and
// the theoretical load addresses for the `_DYNAMIC` symbol.
const base_addr = base: {
for (phdrs) |*phdr| {
if (phdr.p_type != elf.PT_DYNAMIC) continue;
break :base @intFromPtr(dynv) - phdr.p_vaddr;
}
// This is not supposed to happen for well-formed binaries.
std.os.abort();
};
var rel_addr: usize = 0;
var rela_addr: usize = 0;
var rel_size: usize = 0;
var rela_size: usize = 0;
{
var i: usize = 0;
while (dynv[i].d_tag != elf.DT_NULL) : (i += 1) {
switch (dynv[i].d_tag) {
elf.DT_REL => rel_addr = base_addr + dynv[i].d_val,
elf.DT_RELA => rela_addr = base_addr + dynv[i].d_val,
elf.DT_RELSZ => rel_size = dynv[i].d_val,
elf.DT_RELASZ => rela_size = dynv[i].d_val,
else => {},
}
}
}
// Apply the relocations.
if (rel_addr != 0) {
const rel = std.mem.bytesAsSlice(elf.Rel, @as([*]u8, @ptrFromInt(rel_addr))[0..rel_size]);
for (rel) |r| {
if (r.r_type() != R_RELATIVE) continue;
@as(*usize, @ptrFromInt(base_addr + r.r_offset)).* += base_addr;
}
}
if (rela_addr != 0) {
const rela = std.mem.bytesAsSlice(elf.Rela, @as([*]u8, @ptrFromInt(rela_addr))[0..rela_size]);
for (rela) |r| {
if (r.r_type() != R_RELATIVE) continue;
@as(*usize, @ptrFromInt(base_addr + r.r_offset)).* += base_addr + @as(usize, @bitCast(r.r_addend));
}
}
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/test.zig | const std = @import("../../std.zig");
const builtin = @import("builtin");
const linux = std.os.linux;
const mem = std.mem;
const elf = std.elf;
const expect = std.testing.expect;
const expectEqual = std.testing.expectEqual;
const fs = std.fs;
test "fallocate" {
const path = "test_fallocate";
const file = try fs.cwd().createFile(path, .{ .truncate = true, .mode = 0o666 });
defer file.close();
defer fs.cwd().deleteFile(path) catch {};
try expect((try file.stat()).size == 0);
const len: i64 = 65536;
switch (linux.getErrno(linux.fallocate(file.handle, 0, 0, len))) {
.SUCCESS => {},
.NOSYS => return error.SkipZigTest,
.OPNOTSUPP => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try expect((try file.stat()).size == len);
}
test "getpid" {
try expect(linux.getpid() != 0);
}
test "timer" {
const epoll_fd = linux.epoll_create();
var err: linux.E = linux.getErrno(epoll_fd);
try expect(err == .SUCCESS);
const timer_fd = linux.timerfd_create(linux.CLOCK.MONOTONIC, 0);
try expect(linux.getErrno(timer_fd) == .SUCCESS);
const time_interval = linux.timespec{
.tv_sec = 0,
.tv_nsec = 2000000,
};
const new_time = linux.itimerspec{
.it_interval = time_interval,
.it_value = time_interval,
};
err = linux.getErrno(linux.timerfd_settime(@as(i32, @intCast(timer_fd)), 0, &new_time, null));
try expect(err == .SUCCESS);
var event = linux.epoll_event{
.events = linux.EPOLL.IN | linux.EPOLL.OUT | linux.EPOLL.ET,
.data = linux.epoll_data{ .ptr = 0 },
};
err = linux.getErrno(linux.epoll_ctl(@as(i32, @intCast(epoll_fd)), linux.EPOLL.CTL_ADD, @as(i32, @intCast(timer_fd)), &event));
try expect(err == .SUCCESS);
const events_one: linux.epoll_event = undefined;
var events = [_]linux.epoll_event{events_one} ** 8;
err = linux.getErrno(linux.epoll_wait(@as(i32, @intCast(epoll_fd)), &events, 8, -1));
try expect(err == .SUCCESS);
}
test "statx" {
const tmp_file_name = "just_a_temporary_file.txt";
var file = try fs.cwd().createFile(tmp_file_name, .{});
defer {
file.close();
fs.cwd().deleteFile(tmp_file_name) catch {};
}
var statx_buf: linux.Statx = undefined;
switch (linux.getErrno(linux.statx(file.handle, "", linux.AT.EMPTY_PATH, linux.STATX_BASIC_STATS, &statx_buf))) {
.SUCCESS => {},
// The statx syscall was only introduced in linux 4.11
.NOSYS => return error.SkipZigTest,
else => unreachable,
}
var stat_buf: linux.Stat = undefined;
switch (linux.getErrno(linux.fstatat(file.handle, "", &stat_buf, linux.AT.EMPTY_PATH))) {
.SUCCESS => {},
else => unreachable,
}
try expect(stat_buf.mode == statx_buf.mode);
try expect(@as(u32, @bitCast(stat_buf.uid)) == statx_buf.uid);
try expect(@as(u32, @bitCast(stat_buf.gid)) == statx_buf.gid);
try expect(@as(u64, @bitCast(@as(i64, stat_buf.size))) == statx_buf.size);
try expect(@as(u64, @bitCast(@as(i64, stat_buf.blksize))) == statx_buf.blksize);
try expect(@as(u64, @bitCast(@as(i64, stat_buf.blocks))) == statx_buf.blocks);
}
test "user and group ids" {
if (builtin.link_libc) return error.SkipZigTest;
try expectEqual(linux.getauxval(elf.AT_UID), linux.getuid());
try expectEqual(linux.getauxval(elf.AT_GID), linux.getgid());
try expectEqual(linux.getauxval(elf.AT_EUID), linux.geteuid());
try expectEqual(linux.getauxval(elf.AT_EGID), linux.getegid());
}
test "fadvise" {
const tmp_file_name = "temp_posix_fadvise.txt";
var file = try fs.cwd().createFile(tmp_file_name, .{});
defer {
file.close();
fs.cwd().deleteFile(tmp_file_name) catch {};
}
var buf: [2048]u8 = undefined;
try file.writeAll(&buf);
const ret = linux.fadvise(
file.handle,
0,
0,
linux.POSIX_FADV.SEQUENTIAL,
);
try expectEqual(@as(usize, 0), ret);
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/arm64.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const sockaddr = linux.sockaddr;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const timespec = std.os.linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
: "memory", "cc"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
[arg1] "{x0}" (arg1),
: "memory", "cc"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
[arg1] "{x0}" (arg1),
[arg2] "{x1}" (arg2),
: "memory", "cc"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
[arg1] "{x0}" (arg1),
[arg2] "{x1}" (arg2),
[arg3] "{x2}" (arg3),
: "memory", "cc"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
[arg1] "{x0}" (arg1),
[arg2] "{x1}" (arg2),
[arg3] "{x2}" (arg3),
[arg4] "{x3}" (arg4),
: "memory", "cc"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
[arg1] "{x0}" (arg1),
[arg2] "{x1}" (arg2),
[arg3] "{x2}" (arg3),
[arg4] "{x3}" (arg4),
[arg5] "{x4}" (arg5),
: "memory", "cc"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile ("svc #0"
: [ret] "={x0}" (-> usize),
: [number] "{x8}" (@intFromEnum(number)),
[arg1] "{x0}" (arg1),
[arg2] "{x1}" (arg2),
[arg3] "{x2}" (arg3),
[arg4] "{x3}" (arg4),
[arg5] "{x4}" (arg5),
[arg6] "{x5}" (arg6),
: "memory", "cc"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub const restore = restore_rt;
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("svc #0"
:
: [number] "{x8}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory", "cc"
);
}
pub const SYS = enum(usize) {
io_setup = 0,
io_destroy = 1,
io_submit = 2,
io_cancel = 3,
io_getevents = 4,
setxattr = 5,
lsetxattr = 6,
fsetxattr = 7,
getxattr = 8,
lgetxattr = 9,
fgetxattr = 10,
listxattr = 11,
llistxattr = 12,
flistxattr = 13,
removexattr = 14,
lremovexattr = 15,
fremovexattr = 16,
getcwd = 17,
lookup_dcookie = 18,
eventfd2 = 19,
epoll_create1 = 20,
epoll_ctl = 21,
epoll_pwait = 22,
dup = 23,
dup3 = 24,
fcntl = 25,
inotify_init1 = 26,
inotify_add_watch = 27,
inotify_rm_watch = 28,
ioctl = 29,
ioprio_set = 30,
ioprio_get = 31,
flock = 32,
mknodat = 33,
mkdirat = 34,
unlinkat = 35,
symlinkat = 36,
linkat = 37,
renameat = 38,
umount2 = 39,
mount = 40,
pivot_root = 41,
nfsservctl = 42,
statfs = 43,
fstatfs = 44,
truncate = 45,
ftruncate = 46,
fallocate = 47,
faccessat = 48,
chdir = 49,
fchdir = 50,
chroot = 51,
fchmod = 52,
fchmodat = 53,
fchownat = 54,
fchown = 55,
openat = 56,
close = 57,
vhangup = 58,
pipe2 = 59,
quotactl = 60,
getdents64 = 61,
lseek = 62,
read = 63,
write = 64,
readv = 65,
writev = 66,
pread64 = 67,
pwrite64 = 68,
preadv = 69,
pwritev = 70,
sendfile = 71,
pselect6 = 72,
ppoll = 73,
signalfd4 = 74,
vmsplice = 75,
splice = 76,
tee = 77,
readlinkat = 78,
fstatat = 79,
fstat = 80,
sync = 81,
fsync = 82,
fdatasync = 83,
sync_file_range = 84,
timerfd_create = 85,
timerfd_settime = 86,
timerfd_gettime = 87,
utimensat = 88,
acct = 89,
capget = 90,
capset = 91,
personality = 92,
exit = 93,
exit_group = 94,
waitid = 95,
set_tid_address = 96,
unshare = 97,
futex = 98,
set_robust_list = 99,
get_robust_list = 100,
nanosleep = 101,
getitimer = 102,
setitimer = 103,
kexec_load = 104,
init_module = 105,
delete_module = 106,
timer_create = 107,
timer_gettime = 108,
timer_getoverrun = 109,
timer_settime = 110,
timer_delete = 111,
clock_settime = 112,
clock_gettime = 113,
clock_getres = 114,
clock_nanosleep = 115,
syslog = 116,
ptrace = 117,
sched_setparam = 118,
sched_setscheduler = 119,
sched_getscheduler = 120,
sched_getparam = 121,
sched_setaffinity = 122,
sched_getaffinity = 123,
sched_yield = 124,
sched_get_priority_max = 125,
sched_get_priority_min = 126,
sched_rr_get_interval = 127,
restart_syscall = 128,
kill = 129,
tkill = 130,
tgkill = 131,
sigaltstack = 132,
rt_sigsuspend = 133,
rt_sigaction = 134,
rt_sigprocmask = 135,
rt_sigpending = 136,
rt_sigtimedwait = 137,
rt_sigqueueinfo = 138,
rt_sigreturn = 139,
setpriority = 140,
getpriority = 141,
reboot = 142,
setregid = 143,
setgid = 144,
setreuid = 145,
setuid = 146,
setresuid = 147,
getresuid = 148,
setresgid = 149,
getresgid = 150,
setfsuid = 151,
setfsgid = 152,
times = 153,
setpgid = 154,
getpgid = 155,
getsid = 156,
setsid = 157,
getgroups = 158,
setgroups = 159,
uname = 160,
sethostname = 161,
setdomainname = 162,
getrlimit = 163,
setrlimit = 164,
getrusage = 165,
umask = 166,
prctl = 167,
getcpu = 168,
gettimeofday = 169,
settimeofday = 170,
adjtimex = 171,
getpid = 172,
getppid = 173,
getuid = 174,
geteuid = 175,
getgid = 176,
getegid = 177,
gettid = 178,
sysinfo = 179,
mq_open = 180,
mq_unlink = 181,
mq_timedsend = 182,
mq_timedreceive = 183,
mq_notify = 184,
mq_getsetattr = 185,
msgget = 186,
msgctl = 187,
msgrcv = 188,
msgsnd = 189,
semget = 190,
semctl = 191,
semtimedop = 192,
semop = 193,
shmget = 194,
shmctl = 195,
shmat = 196,
shmdt = 197,
socket = 198,
socketpair = 199,
bind = 200,
listen = 201,
accept = 202,
connect = 203,
getsockname = 204,
getpeername = 205,
sendto = 206,
recvfrom = 207,
setsockopt = 208,
getsockopt = 209,
shutdown = 210,
sendmsg = 211,
recvmsg = 212,
readahead = 213,
brk = 214,
munmap = 215,
mremap = 216,
add_key = 217,
request_key = 218,
keyctl = 219,
clone = 220,
execve = 221,
mmap = 222,
fadvise64 = 223,
swapon = 224,
swapoff = 225,
mprotect = 226,
msync = 227,
mlock = 228,
munlock = 229,
mlockall = 230,
munlockall = 231,
mincore = 232,
madvise = 233,
remap_file_pages = 234,
mbind = 235,
get_mempolicy = 236,
set_mempolicy = 237,
migrate_pages = 238,
move_pages = 239,
rt_tgsigqueueinfo = 240,
perf_event_open = 241,
accept4 = 242,
recvmmsg = 243,
arch_specific_syscall = 244,
wait4 = 260,
prlimit64 = 261,
fanotify_init = 262,
fanotify_mark = 263,
clock_adjtime = 266,
syncfs = 267,
setns = 268,
sendmmsg = 269,
process_vm_readv = 270,
process_vm_writev = 271,
kcmp = 272,
finit_module = 273,
sched_setattr = 274,
sched_getattr = 275,
renameat2 = 276,
seccomp = 277,
getrandom = 278,
memfd_create = 279,
bpf = 280,
execveat = 281,
userfaultfd = 282,
membarrier = 283,
mlock2 = 284,
copy_file_range = 285,
preadv2 = 286,
pwritev2 = 287,
pkey_mprotect = 288,
pkey_alloc = 289,
pkey_free = 290,
statx = 291,
io_pgetevents = 292,
rseq = 293,
kexec_file_load = 294,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
_,
};
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o40000;
pub const NOFOLLOW = 0o100000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o200000;
pub const LARGEFILE = 0o400000;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20040000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const GETLK = 5;
pub const SETLK = 6;
pub const SETLKW = 7;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const UN = 8;
pub const NB = 4;
};
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x2000;
/// don't check for reservations
pub const NORESERVE = 0x4000;
};
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
__unused: [4]u8,
};
pub const msghdr = extern struct {
msg_name: ?*sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec,
msg_iovlen: i32,
__pad1: i32 = 0,
msg_control: ?*anyopaque,
msg_controllen: socklen_t,
__pad2: socklen_t = 0,
msg_flags: i32,
};
pub const msghdr_const = extern struct {
msg_name: ?*const sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec_const,
msg_iovlen: i32,
__pad1: i32 = 0,
msg_control: ?*anyopaque,
msg_controllen: socklen_t,
__pad2: socklen_t = 0,
msg_flags: i32,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = isize;
pub const mode_t = u32;
pub const off_t = isize;
pub const ino_t = usize;
pub const dev_t = usize;
pub const blkcnt_t = isize;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
ino: ino_t,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__pad: usize,
size: off_t,
blksize: blksize_t,
__pad2: i32,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
__unused: [2]u32,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: isize,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const mcontext_t = extern struct {
fault_address: usize,
regs: [31]usize,
sp: usize,
pc: usize,
pstate: usize,
// Make sure the field is correctly aligned since this area
// holds various FP/vector registers
reserved1: [256 * 16]u8 align(16),
};
pub const ucontext_t = extern struct {
flags: usize,
link: *ucontext_t,
stack: stack_t,
sigmask: sigset_t,
mcontext: mcontext_t,
};
pub const Elf_Symndx = u32;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/x86_64.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const iovec = std.os.iovec;
const iovec_const = std.os.iovec_const;
const pid_t = linux.pid_t;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const clock_t = linux.clock_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const sockaddr = linux.sockaddr;
const socklen_t = linux.socklen_t;
const timespec = linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
: "rcx", "r11", "memory"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
[arg1] "{rdi}" (arg1),
: "rcx", "r11", "memory"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
[arg1] "{rdi}" (arg1),
[arg2] "{rsi}" (arg2),
: "rcx", "r11", "memory"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
[arg1] "{rdi}" (arg1),
[arg2] "{rsi}" (arg2),
[arg3] "{rdx}" (arg3),
: "rcx", "r11", "memory"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
[arg1] "{rdi}" (arg1),
[arg2] "{rsi}" (arg2),
[arg3] "{rdx}" (arg3),
[arg4] "{r10}" (arg4),
: "rcx", "r11", "memory"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
[arg1] "{rdi}" (arg1),
[arg2] "{rsi}" (arg2),
[arg3] "{rdx}" (arg3),
[arg4] "{r10}" (arg4),
[arg5] "{r8}" (arg5),
: "rcx", "r11", "memory"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile ("syscall"
: [ret] "={rax}" (-> usize),
: [number] "{rax}" (@intFromEnum(number)),
[arg1] "{rdi}" (arg1),
[arg2] "{rsi}" (arg2),
[arg3] "{rdx}" (arg3),
[arg4] "{r10}" (arg4),
[arg5] "{r8}" (arg5),
[arg6] "{r9}" (arg6),
: "rcx", "r11", "memory"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub const restore = restore_rt;
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("syscall"
:
: [number] "{rax}" (@intFromEnum(SYS.rt_sigreturn)),
: "rcx", "r11", "memory"
);
}
pub const mode_t = usize;
pub const time_t = isize;
pub const nlink_t = usize;
pub const blksize_t = isize;
pub const blkcnt_t = isize;
pub const SYS = enum(usize) {
read = 0,
write = 1,
open = 2,
close = 3,
stat = 4,
fstat = 5,
lstat = 6,
poll = 7,
lseek = 8,
mmap = 9,
mprotect = 10,
munmap = 11,
brk = 12,
rt_sigaction = 13,
rt_sigprocmask = 14,
rt_sigreturn = 15,
ioctl = 16,
pread = 17,
pwrite = 18,
readv = 19,
writev = 20,
access = 21,
pipe = 22,
select = 23,
sched_yield = 24,
mremap = 25,
msync = 26,
mincore = 27,
madvise = 28,
shmget = 29,
shmat = 30,
shmctl = 31,
dup = 32,
dup2 = 33,
pause = 34,
nanosleep = 35,
getitimer = 36,
alarm = 37,
setitimer = 38,
getpid = 39,
sendfile = 40,
socket = 41,
connect = 42,
accept = 43,
sendto = 44,
recvfrom = 45,
sendmsg = 46,
recvmsg = 47,
shutdown = 48,
bind = 49,
listen = 50,
getsockname = 51,
getpeername = 52,
socketpair = 53,
setsockopt = 54,
getsockopt = 55,
clone = 56,
fork = 57,
vfork = 58,
execve = 59,
exit = 60,
wait4 = 61,
kill = 62,
uname = 63,
semget = 64,
semop = 65,
semctl = 66,
shmdt = 67,
msgget = 68,
msgsnd = 69,
msgrcv = 70,
msgctl = 71,
fcntl = 72,
flock = 73,
fsync = 74,
fdatasync = 75,
truncate = 76,
ftruncate = 77,
getdents = 78,
getcwd = 79,
chdir = 80,
fchdir = 81,
rename = 82,
mkdir = 83,
rmdir = 84,
creat = 85,
link = 86,
unlink = 87,
symlink = 88,
readlink = 89,
chmod = 90,
fchmod = 91,
chown = 92,
fchown = 93,
lchown = 94,
umask = 95,
gettimeofday = 96,
getrlimit = 97,
getrusage = 98,
sysinfo = 99,
times = 100,
ptrace = 101,
getuid = 102,
syslog = 103,
getgid = 104,
setuid = 105,
setgid = 106,
geteuid = 107,
getegid = 108,
setpgid = 109,
getppid = 110,
getpgrp = 111,
setsid = 112,
setreuid = 113,
setregid = 114,
getgroups = 115,
setgroups = 116,
setresuid = 117,
getresuid = 118,
setresgid = 119,
getresgid = 120,
getpgid = 121,
setfsuid = 122,
setfsgid = 123,
getsid = 124,
capget = 125,
capset = 126,
rt_sigpending = 127,
rt_sigtimedwait = 128,
rt_sigqueueinfo = 129,
rt_sigsuspend = 130,
sigaltstack = 131,
utime = 132,
mknod = 133,
uselib = 134,
personality = 135,
ustat = 136,
statfs = 137,
fstatfs = 138,
sysfs = 139,
getpriority = 140,
setpriority = 141,
sched_setparam = 142,
sched_getparam = 143,
sched_setscheduler = 144,
sched_getscheduler = 145,
sched_get_priority_max = 146,
sched_get_priority_min = 147,
sched_rr_get_interval = 148,
mlock = 149,
munlock = 150,
mlockall = 151,
munlockall = 152,
vhangup = 153,
modify_ldt = 154,
pivot_root = 155,
_sysctl = 156,
prctl = 157,
arch_prctl = 158,
adjtimex = 159,
setrlimit = 160,
chroot = 161,
sync = 162,
acct = 163,
settimeofday = 164,
mount = 165,
umount2 = 166,
swapon = 167,
swapoff = 168,
reboot = 169,
sethostname = 170,
setdomainname = 171,
iopl = 172,
ioperm = 173,
create_module = 174,
init_module = 175,
delete_module = 176,
get_kernel_syms = 177,
query_module = 178,
quotactl = 179,
nfsservctl = 180,
getpmsg = 181,
putpmsg = 182,
afs_syscall = 183,
tuxcall = 184,
security = 185,
gettid = 186,
readahead = 187,
setxattr = 188,
lsetxattr = 189,
fsetxattr = 190,
getxattr = 191,
lgetxattr = 192,
fgetxattr = 193,
listxattr = 194,
llistxattr = 195,
flistxattr = 196,
removexattr = 197,
lremovexattr = 198,
fremovexattr = 199,
tkill = 200,
time = 201,
futex = 202,
sched_setaffinity = 203,
sched_getaffinity = 204,
set_thread_area = 205,
io_setup = 206,
io_destroy = 207,
io_getevents = 208,
io_submit = 209,
io_cancel = 210,
get_thread_area = 211,
lookup_dcookie = 212,
epoll_create = 213,
epoll_ctl_old = 214,
epoll_wait_old = 215,
remap_file_pages = 216,
getdents64 = 217,
set_tid_address = 218,
restart_syscall = 219,
semtimedop = 220,
fadvise64 = 221,
timer_create = 222,
timer_settime = 223,
timer_gettime = 224,
timer_getoverrun = 225,
timer_delete = 226,
clock_settime = 227,
clock_gettime = 228,
clock_getres = 229,
clock_nanosleep = 230,
exit_group = 231,
epoll_wait = 232,
epoll_ctl = 233,
tgkill = 234,
utimes = 235,
vserver = 236,
mbind = 237,
set_mempolicy = 238,
get_mempolicy = 239,
mq_open = 240,
mq_unlink = 241,
mq_timedsend = 242,
mq_timedreceive = 243,
mq_notify = 244,
mq_getsetattr = 245,
kexec_load = 246,
waitid = 247,
add_key = 248,
request_key = 249,
keyctl = 250,
ioprio_set = 251,
ioprio_get = 252,
inotify_init = 253,
inotify_add_watch = 254,
inotify_rm_watch = 255,
migrate_pages = 256,
openat = 257,
mkdirat = 258,
mknodat = 259,
fchownat = 260,
futimesat = 261,
fstatat = 262,
unlinkat = 263,
renameat = 264,
linkat = 265,
symlinkat = 266,
readlinkat = 267,
fchmodat = 268,
faccessat = 269,
pselect6 = 270,
ppoll = 271,
unshare = 272,
set_robust_list = 273,
get_robust_list = 274,
splice = 275,
tee = 276,
sync_file_range = 277,
vmsplice = 278,
move_pages = 279,
utimensat = 280,
epoll_pwait = 281,
signalfd = 282,
timerfd_create = 283,
eventfd = 284,
fallocate = 285,
timerfd_settime = 286,
timerfd_gettime = 287,
accept4 = 288,
signalfd4 = 289,
eventfd2 = 290,
epoll_create1 = 291,
dup3 = 292,
pipe2 = 293,
inotify_init1 = 294,
preadv = 295,
pwritev = 296,
rt_tgsigqueueinfo = 297,
perf_event_open = 298,
recvmmsg = 299,
fanotify_init = 300,
fanotify_mark = 301,
prlimit64 = 302,
name_to_handle_at = 303,
open_by_handle_at = 304,
clock_adjtime = 305,
syncfs = 306,
sendmmsg = 307,
setns = 308,
getcpu = 309,
process_vm_readv = 310,
process_vm_writev = 311,
kcmp = 312,
finit_module = 313,
sched_setattr = 314,
sched_getattr = 315,
renameat2 = 316,
seccomp = 317,
getrandom = 318,
memfd_create = 319,
kexec_file_load = 320,
bpf = 321,
execveat = 322,
userfaultfd = 323,
membarrier = 324,
mlock2 = 325,
copy_file_range = 326,
preadv2 = 327,
pwritev2 = 328,
pkey_mprotect = 329,
pkey_alloc = 330,
pkey_free = 331,
statx = 332,
io_pgetevents = 333,
rseq = 334,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
memfd_secret = 447,
_,
};
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o200000;
pub const NOFOLLOW = 0o400000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o40000;
pub const LARGEFILE = 0;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20200000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const GETLK = 5;
pub const SETLK = 6;
pub const SETLKW = 7;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
};
pub const MAP = struct {
/// only give out 32bit addresses
pub const @"32BIT" = 0x40;
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x2000;
/// don't check for reservations
pub const NORESERVE = 0x4000;
};
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
pub const GETCPU_SYM = "__vdso_getcpu";
pub const GETCPU_VER = "LINUX_2.6";
};
pub const ARCH = struct {
pub const SET_GS = 0x1001;
pub const SET_FS = 0x1002;
pub const GET_FS = 0x1003;
pub const GET_GS = 0x1004;
};
pub const REG = struct {
pub const R8 = 0;
pub const R9 = 1;
pub const R10 = 2;
pub const R11 = 3;
pub const R12 = 4;
pub const R13 = 5;
pub const R14 = 6;
pub const R15 = 7;
pub const RDI = 8;
pub const RSI = 9;
pub const RBP = 10;
pub const RBX = 11;
pub const RDX = 12;
pub const RAX = 13;
pub const RCX = 14;
pub const RSP = 15;
pub const RIP = 16;
pub const EFL = 17;
pub const CSGSFS = 18;
pub const ERR = 19;
pub const TRAPNO = 20;
pub const OLDMASK = 21;
pub const CR2 = 22;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const NB = 4;
pub const UN = 8;
};
pub const Flock = extern struct {
type: i16,
whence: i16,
start: off_t,
len: off_t,
pid: pid_t,
};
pub const msghdr = extern struct {
name: ?*sockaddr,
namelen: socklen_t,
iov: [*]iovec,
iovlen: i32,
__pad1: i32 = 0,
control: ?*anyopaque,
controllen: socklen_t,
__pad2: socklen_t = 0,
flags: i32,
};
pub const msghdr_const = extern struct {
name: ?*const sockaddr,
namelen: socklen_t,
iov: [*]iovec_const,
iovlen: i32,
__pad1: i32 = 0,
control: ?*anyopaque,
controllen: socklen_t,
__pad2: socklen_t = 0,
flags: i32,
};
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
ino: ino_t,
nlink: usize,
mode: u32,
uid: uid_t,
gid: gid_t,
__pad0: u32,
rdev: dev_t,
size: off_t,
blksize: isize,
blocks: i64,
atim: timespec,
mtim: timespec,
ctim: timespec,
__unused: [3]isize,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: isize,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const Elf_Symndx = u32;
pub const greg_t = usize;
pub const gregset_t = [23]greg_t;
pub const fpstate = extern struct {
cwd: u16,
swd: u16,
ftw: u16,
fop: u16,
rip: usize,
rdp: usize,
mxcsr: u32,
mxcr_mask: u32,
st: [8]extern struct {
significand: [4]u16,
exponent: u16,
padding: [3]u16 = undefined,
},
xmm: [16]extern struct {
element: [4]u32,
},
padding: [24]u32 = undefined,
};
pub const fpregset_t = *fpstate;
pub const sigcontext = extern struct {
r8: usize,
r9: usize,
r10: usize,
r11: usize,
r12: usize,
r13: usize,
r14: usize,
r15: usize,
rdi: usize,
rsi: usize,
rbp: usize,
rbx: usize,
rdx: usize,
rax: usize,
rcx: usize,
rsp: usize,
rip: usize,
eflags: usize,
cs: u16,
gs: u16,
fs: u16,
pad0: u16 = undefined,
err: usize,
trapno: usize,
oldmask: usize,
cr2: usize,
fpstate: *fpstate,
reserved1: [8]usize = undefined,
};
pub const mcontext_t = extern struct {
gregs: gregset_t,
fpregs: fpregset_t,
reserved1: [8]usize = undefined,
};
pub const ucontext_t = extern struct {
flags: usize,
link: *ucontext_t,
stack: stack_t,
mcontext: mcontext_t,
sigmask: sigset_t,
fpregs_mem: [64]usize,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/sparc64.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const pid_t = linux.pid_t;
const uid_t = linux.uid_t;
const clock_t = linux.clock_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const linux = std.os.linux;
const sockaddr = linux.sockaddr;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const timespec = linux.timespec;
pub fn syscall_pipe(fd: *[2]i32) usize {
return asm volatile (
\\ mov %[arg], %%g3
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ # Return the error code
\\ ba 2f
\\ neg %%o0
\\1:
\\ st %%o0, [%%g3+0]
\\ st %%o1, [%%g3+4]
\\ clr %%o0
\\2:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(SYS.pipe)),
[arg] "r" (fd),
: "memory", "g3"
);
}
pub fn syscall_fork() usize {
// Linux/sparc64 fork() returns two values in %o0 and %o1:
// - On the parent's side, %o0 is the child's PID and %o1 is 0.
// - On the child's side, %o0 is the parent's PID and %o1 is 1.
// We need to clear the child's %o0 so that the return values
// conform to the libc convention.
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ ba 2f
\\ neg %%o0
\\ 1:
\\ # Clear the child's %%o0
\\ dec %%o1
\\ and %%o1, %%o0, %%o0
\\ 2:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(SYS.fork)),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall0(number: SYS) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
[arg1] "{o0}" (arg1),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
[arg1] "{o0}" (arg1),
[arg2] "{o1}" (arg2),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
[arg1] "{o0}" (arg1),
[arg2] "{o1}" (arg2),
[arg3] "{o2}" (arg3),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
[arg1] "{o0}" (arg1),
[arg2] "{o1}" (arg2),
[arg3] "{o2}" (arg3),
[arg4] "{o3}" (arg4),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
[arg1] "{o0}" (arg1),
[arg2] "{o1}" (arg2),
[arg3] "{o2}" (arg3),
[arg4] "{o3}" (arg4),
[arg5] "{o4}" (arg5),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile (
\\ t 0x6d
\\ bcc,pt %%xcc, 1f
\\ nop
\\ neg %%o0
\\ 1:
: [ret] "={o0}" (-> usize),
: [number] "{g1}" (@intFromEnum(number)),
[arg1] "{o0}" (arg1),
[arg2] "{o1}" (arg2),
[arg3] "{o2}" (arg3),
[arg4] "{o3}" (arg4),
[arg5] "{o4}" (arg5),
[arg6] "{o5}" (arg6),
: "memory", "xcc", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub const restore = restore_rt;
// Need to use C ABI here instead of naked
// to prevent an infinite loop when calling rt_sigreturn.
pub fn restore_rt() callconv(.C) void {
return asm volatile ("t 0x6d"
:
: [number] "{g1}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory", "xcc", "o0", "o1", "o2", "o3", "o4", "o5", "o7"
);
}
pub const SYS = enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
wait4 = 7,
creat = 8,
link = 9,
unlink = 10,
execv = 11,
chdir = 12,
chown = 13,
mknod = 14,
chmod = 15,
lchown = 16,
brk = 17,
perfctr = 18,
lseek = 19,
getpid = 20,
capget = 21,
capset = 22,
setuid = 23,
getuid = 24,
vmsplice = 25,
ptrace = 26,
alarm = 27,
sigaltstack = 28,
pause = 29,
utime = 30,
access = 33,
nice = 34,
sync = 36,
kill = 37,
stat = 38,
sendfile = 39,
lstat = 40,
dup = 41,
pipe = 42,
times = 43,
umount2 = 45,
setgid = 46,
getgid = 47,
signal = 48,
geteuid = 49,
getegid = 50,
acct = 51,
memory_ordering = 52,
ioctl = 54,
reboot = 55,
symlink = 57,
readlink = 58,
execve = 59,
umask = 60,
chroot = 61,
fstat = 62,
fstat64 = 63,
getpagesize = 64,
msync = 65,
vfork = 66,
pread64 = 67,
pwrite64 = 68,
mmap = 71,
munmap = 73,
mprotect = 74,
madvise = 75,
vhangup = 76,
mincore = 78,
getgroups = 79,
setgroups = 80,
getpgrp = 81,
setitimer = 83,
swapon = 85,
getitimer = 86,
sethostname = 88,
dup2 = 90,
fcntl = 92,
select = 93,
fsync = 95,
setpriority = 96,
socket = 97,
connect = 98,
accept = 99,
getpriority = 100,
rt_sigreturn = 101,
rt_sigaction = 102,
rt_sigprocmask = 103,
rt_sigpending = 104,
rt_sigtimedwait = 105,
rt_sigqueueinfo = 106,
rt_sigsuspend = 107,
setresuid = 108,
getresuid = 109,
setresgid = 110,
getresgid = 111,
recvmsg = 113,
sendmsg = 114,
gettimeofday = 116,
getrusage = 117,
getsockopt = 118,
getcwd = 119,
readv = 120,
writev = 121,
settimeofday = 122,
fchown = 123,
fchmod = 124,
recvfrom = 125,
setreuid = 126,
setregid = 127,
rename = 128,
truncate = 129,
ftruncate = 130,
flock = 131,
lstat64 = 132,
sendto = 133,
shutdown = 134,
socketpair = 135,
mkdir = 136,
rmdir = 137,
utimes = 138,
stat64 = 139,
sendfile64 = 140,
getpeername = 141,
futex = 142,
gettid = 143,
getrlimit = 144,
setrlimit = 145,
pivot_root = 146,
prctl = 147,
pciconfig_read = 148,
pciconfig_write = 149,
getsockname = 150,
inotify_init = 151,
inotify_add_watch = 152,
poll = 153,
getdents64 = 154,
inotify_rm_watch = 156,
statfs = 157,
fstatfs = 158,
umount = 159,
sched_set_affinity = 160,
sched_get_affinity = 161,
getdomainname = 162,
setdomainname = 163,
utrap_install = 164,
quotactl = 165,
set_tid_address = 166,
mount = 167,
ustat = 168,
setxattr = 169,
lsetxattr = 170,
fsetxattr = 171,
getxattr = 172,
lgetxattr = 173,
getdents = 174,
setsid = 175,
fchdir = 176,
fgetxattr = 177,
listxattr = 178,
llistxattr = 179,
flistxattr = 180,
removexattr = 181,
lremovexattr = 182,
sigpending = 183,
query_module = 184,
setpgid = 185,
fremovexattr = 186,
tkill = 187,
exit_group = 188,
uname = 189,
init_module = 190,
personality = 191,
remap_file_pages = 192,
epoll_create = 193,
epoll_ctl = 194,
epoll_wait = 195,
ioprio_set = 196,
getppid = 197,
sigaction = 198,
sgetmask = 199,
ssetmask = 200,
sigsuspend = 201,
oldlstat = 202,
uselib = 203,
readdir = 204,
readahead = 205,
socketcall = 206,
syslog = 207,
lookup_dcookie = 208,
fadvise64 = 209,
fadvise64_64 = 210,
tgkill = 211,
waitpid = 212,
swapoff = 213,
sysinfo = 214,
ipc = 215,
sigreturn = 216,
clone = 217,
ioprio_get = 218,
adjtimex = 219,
sigprocmask = 220,
create_module = 221,
delete_module = 222,
get_kernel_syms = 223,
getpgid = 224,
bdflush = 225,
sysfs = 226,
afs_syscall = 227,
setfsuid = 228,
setfsgid = 229,
_newselect = 230,
splice = 232,
stime = 233,
statfs64 = 234,
fstatfs64 = 235,
_llseek = 236,
mlock = 237,
munlock = 238,
mlockall = 239,
munlockall = 240,
sched_setparam = 241,
sched_getparam = 242,
sched_setscheduler = 243,
sched_getscheduler = 244,
sched_yield = 245,
sched_get_priority_max = 246,
sched_get_priority_min = 247,
sched_rr_get_interval = 248,
nanosleep = 249,
mremap = 250,
_sysctl = 251,
getsid = 252,
fdatasync = 253,
nfsservctl = 254,
sync_file_range = 255,
clock_settime = 256,
clock_gettime = 257,
clock_getres = 258,
clock_nanosleep = 259,
sched_getaffinity = 260,
sched_setaffinity = 261,
timer_settime = 262,
timer_gettime = 263,
timer_getoverrun = 264,
timer_delete = 265,
timer_create = 266,
vserver = 267,
io_setup = 268,
io_destroy = 269,
io_submit = 270,
io_cancel = 271,
io_getevents = 272,
mq_open = 273,
mq_unlink = 274,
mq_timedsend = 275,
mq_timedreceive = 276,
mq_notify = 277,
mq_getsetattr = 278,
waitid = 279,
tee = 280,
add_key = 281,
request_key = 282,
keyctl = 283,
openat = 284,
mkdirat = 285,
mknodat = 286,
fchownat = 287,
futimesat = 288,
fstatat64 = 289,
unlinkat = 290,
renameat = 291,
linkat = 292,
symlinkat = 293,
readlinkat = 294,
fchmodat = 295,
faccessat = 296,
pselect6 = 297,
ppoll = 298,
unshare = 299,
set_robust_list = 300,
get_robust_list = 301,
migrate_pages = 302,
mbind = 303,
get_mempolicy = 304,
set_mempolicy = 305,
kexec_load = 306,
move_pages = 307,
getcpu = 308,
epoll_pwait = 309,
utimensat = 310,
signalfd = 311,
timerfd_create = 312,
eventfd = 313,
fallocate = 314,
timerfd_settime = 315,
timerfd_gettime = 316,
signalfd4 = 317,
eventfd2 = 318,
epoll_create1 = 319,
dup3 = 320,
pipe2 = 321,
inotify_init1 = 322,
accept4 = 323,
preadv = 324,
pwritev = 325,
rt_tgsigqueueinfo = 326,
perf_event_open = 327,
recvmmsg = 328,
fanotify_init = 329,
fanotify_mark = 330,
prlimit64 = 331,
name_to_handle_at = 332,
open_by_handle_at = 333,
clock_adjtime = 334,
syncfs = 335,
sendmmsg = 336,
setns = 337,
process_vm_readv = 338,
process_vm_writev = 339,
kern_features = 340,
kcmp = 341,
finit_module = 342,
sched_setattr = 343,
sched_getattr = 344,
renameat2 = 345,
seccomp = 346,
getrandom = 347,
memfd_create = 348,
bpf = 349,
execveat = 350,
membarrier = 351,
userfaultfd = 352,
bind = 353,
listen = 354,
setsockopt = 355,
mlock2 = 356,
copy_file_range = 357,
preadv2 = 358,
pwritev2 = 359,
statx = 360,
io_pgetevents = 361,
pkey_mprotect = 362,
pkey_alloc = 363,
pkey_free = 364,
rseq = 365,
semtimedop = 392,
semget = 393,
semctl = 394,
shmget = 395,
shmctl = 396,
shmat = 397,
shmdt = 398,
msgget = 399,
msgsnd = 400,
msgrcv = 401,
msgctl = 402,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
_,
};
pub const O = struct {
pub const CREAT = 0x200;
pub const EXCL = 0x800;
pub const NOCTTY = 0x8000;
pub const TRUNC = 0x400;
pub const APPEND = 0x8;
pub const NONBLOCK = 0x4000;
pub const SYNC = 0x802000;
pub const DSYNC = 0x2000;
pub const RSYNC = SYNC;
pub const DIRECTORY = 0x10000;
pub const NOFOLLOW = 0x20000;
pub const CLOEXEC = 0x400000;
pub const ASYNC = 0x40;
pub const DIRECT = 0x100000;
pub const LARGEFILE = 0;
pub const NOATIME = 0x200000;
pub const PATH = 0x1000000;
pub const TMPFILE = 0x2010000;
pub const NDELAY = NONBLOCK | 0x4;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 5;
pub const GETOWN = 6;
pub const GETLK = 7;
pub const SETLK = 8;
pub const SETLKW = 9;
pub const RDLCK = 1;
pub const WRLCK = 2;
pub const UNLCK = 3;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const NB = 4;
pub const UN = 8;
};
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0200;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x0100;
/// don't check for reservations
pub const NORESERVE = 0x0040;
};
pub const VDSO = struct {
pub const CGT_SYM = "__vdso_clock_gettime";
pub const CGT_VER = "LINUX_2.6";
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
};
pub const msghdr = extern struct {
msg_name: ?*sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec,
msg_iovlen: u64,
msg_control: ?*anyopaque,
msg_controllen: u64,
msg_flags: i32,
};
pub const msghdr_const = extern struct {
msg_name: ?*const sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec_const,
msg_iovlen: u64,
msg_control: ?*anyopaque,
msg_controllen: u64,
msg_flags: i32,
};
pub const off_t = i64;
pub const ino_t = u64;
pub const mode_t = u32;
pub const dev_t = usize;
pub const nlink_t = u32;
pub const blksize_t = isize;
pub const blkcnt_t = isize;
// The `stat64` definition used by the kernel.
pub const Stat = extern struct {
dev: u64,
ino: u64,
nlink: u64,
mode: u32,
uid: u32,
gid: u32,
__pad0: u32,
rdev: u64,
size: i64,
blksize: i64,
blocks: i64,
atim: timespec,
mtim: timespec,
ctim: timespec,
__unused: [3]u64,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: isize,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
// TODO I'm not sure if the code below is correct, need someone with more
// knowledge about sparc64 linux internals to look into.
pub const Elf_Symndx = u32;
pub const fpstate = extern struct {
regs: [32]u64,
fsr: u64,
gsr: u64,
fprs: u64,
};
pub const __fpq = extern struct {
fpq_addr: *u32,
fpq_instr: u32,
};
pub const __fq = extern struct {
FQu: extern union {
whole: f64,
fpq: __fpq,
},
};
pub const fpregset_t = extern struct {
fpu_fr: extern union {
fpu_regs: [32]u32,
fpu_dregs: [32]f64,
fpu_qregs: [16]c_longdouble,
},
fpu_q: *__fq,
fpu_fsr: u64,
fpu_qcnt: u8,
fpu_q_entrysize: u8,
fpu_en: u8,
};
pub const siginfo_fpu_t = extern struct {
float_regs: [64]u32,
fsr: u64,
gsr: u64,
fprs: u64,
};
pub const sigcontext = extern struct {
info: [128]i8,
regs: extern struct {
u_regs: [16]u64,
tstate: u64,
tpc: u64,
tnpc: u64,
y: u64,
fprs: u64,
},
fpu_save: *siginfo_fpu_t,
stack: extern struct {
sp: usize,
flags: i32,
size: u64,
},
mask: u64,
};
pub const greg_t = u64;
pub const gregset_t = [19]greg_t;
pub const fq = extern struct {
addr: *u64,
insn: u32,
};
pub const fpu_t = extern struct {
fregs: extern union {
sregs: [32]u32,
dregs: [32]u64,
qregs: [16]c_longdouble,
},
fsr: u64,
fprs: u64,
gsr: u64,
fq: *fq,
qcnt: u8,
qentsz: u8,
enab: u8,
};
pub const mcontext_t = extern struct {
gregs: gregset_t,
fp: greg_t,
i7: greg_t,
fpregs: fpu_t,
};
pub const ucontext_t = extern struct {
link: *ucontext_t,
flags: u64,
sigmask: u64,
mcontext: mcontext_t,
stack: stack_t,
sigmask: sigset_t,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/riscv64.zig | const std = @import("../../std.zig");
const uid_t = std.os.linux.uid_t;
const gid_t = std.os.linux.gid_t;
const pid_t = std.os.linux.pid_t;
const timespec = std.os.linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
: "memory"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
[arg1] "{x10}" (arg1),
: "memory"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
[arg1] "{x10}" (arg1),
[arg2] "{x11}" (arg2),
: "memory"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
[arg1] "{x10}" (arg1),
[arg2] "{x11}" (arg2),
[arg3] "{x12}" (arg3),
: "memory"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
[arg1] "{x10}" (arg1),
[arg2] "{x11}" (arg2),
[arg3] "{x12}" (arg3),
[arg4] "{x13}" (arg4),
: "memory"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
[arg1] "{x10}" (arg1),
[arg2] "{x11}" (arg2),
[arg3] "{x12}" (arg3),
[arg4] "{x13}" (arg4),
[arg5] "{x14}" (arg5),
: "memory"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile ("ecall"
: [ret] "={x10}" (-> usize),
: [number] "{x17}" (@intFromEnum(number)),
[arg1] "{x10}" (arg1),
[arg2] "{x11}" (arg2),
[arg3] "{x12}" (arg3),
[arg4] "{x13}" (arg4),
[arg5] "{x14}" (arg5),
[arg6] "{x15}" (arg6),
: "memory"
);
}
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub const restore = restore_rt;
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("ecall"
:
: [number] "{x17}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory"
);
}
pub const SYS = enum(usize) {
pub const arch_specific_syscall = 244;
io_setup = 0,
io_destroy = 1,
io_submit = 2,
io_cancel = 3,
io_getevents = 4,
setxattr = 5,
lsetxattr = 6,
fsetxattr = 7,
getxattr = 8,
lgetxattr = 9,
fgetxattr = 10,
listxattr = 11,
llistxattr = 12,
flistxattr = 13,
removexattr = 14,
lremovexattr = 15,
fremovexattr = 16,
getcwd = 17,
lookup_dcookie = 18,
eventfd2 = 19,
epoll_create1 = 20,
epoll_ctl = 21,
epoll_pwait = 22,
dup = 23,
dup3 = 24,
fcntl = 25,
inotify_init1 = 26,
inotify_add_watch = 27,
inotify_rm_watch = 28,
ioctl = 29,
ioprio_set = 30,
ioprio_get = 31,
flock = 32,
mknodat = 33,
mkdirat = 34,
unlinkat = 35,
symlinkat = 36,
linkat = 37,
umount2 = 39,
mount = 40,
pivot_root = 41,
nfsservctl = 42,
statfs = 43,
fstatfs = 44,
truncate = 45,
ftruncate = 46,
fallocate = 47,
faccessat = 48,
chdir = 49,
fchdir = 50,
chroot = 51,
fchmod = 52,
fchmodat = 53,
fchownat = 54,
fchown = 55,
openat = 56,
close = 57,
vhangup = 58,
pipe2 = 59,
quotactl = 60,
getdents64 = 61,
lseek = 62,
read = 63,
write = 64,
readv = 65,
writev = 66,
pread64 = 67,
pwrite64 = 68,
preadv = 69,
pwritev = 70,
sendfile = 71,
pselect6 = 72,
ppoll = 73,
signalfd4 = 74,
vmsplice = 75,
splice = 76,
tee = 77,
readlinkat = 78,
fstatat = 79,
fstat = 80,
sync = 81,
fsync = 82,
fdatasync = 83,
sync_file_range = 84,
timerfd_create = 85,
timerfd_settime = 86,
timerfd_gettime = 87,
utimensat = 88,
acct = 89,
capget = 90,
capset = 91,
personality = 92,
exit = 93,
exit_group = 94,
waitid = 95,
set_tid_address = 96,
unshare = 97,
futex = 98,
set_robust_list = 99,
get_robust_list = 100,
nanosleep = 101,
getitimer = 102,
setitimer = 103,
kexec_load = 104,
init_module = 105,
delete_module = 106,
timer_create = 107,
timer_gettime = 108,
timer_getoverrun = 109,
timer_settime = 110,
timer_delete = 111,
clock_settime = 112,
clock_gettime = 113,
clock_getres = 114,
clock_nanosleep = 115,
syslog = 116,
ptrace = 117,
sched_setparam = 118,
sched_setscheduler = 119,
sched_getscheduler = 120,
sched_getparam = 121,
sched_setaffinity = 122,
sched_getaffinity = 123,
sched_yield = 124,
sched_get_priority_max = 125,
sched_get_priority_min = 126,
sched_rr_get_interval = 127,
restart_syscall = 128,
kill = 129,
tkill = 130,
tgkill = 131,
sigaltstack = 132,
rt_sigsuspend = 133,
rt_sigaction = 134,
rt_sigprocmask = 135,
rt_sigpending = 136,
rt_sigtimedwait = 137,
rt_sigqueueinfo = 138,
rt_sigreturn = 139,
setpriority = 140,
getpriority = 141,
reboot = 142,
setregid = 143,
setgid = 144,
setreuid = 145,
setuid = 146,
setresuid = 147,
getresuid = 148,
setresgid = 149,
getresgid = 150,
setfsuid = 151,
setfsgid = 152,
times = 153,
setpgid = 154,
getpgid = 155,
getsid = 156,
setsid = 157,
getgroups = 158,
setgroups = 159,
uname = 160,
sethostname = 161,
setdomainname = 162,
getrlimit = 163,
setrlimit = 164,
getrusage = 165,
umask = 166,
prctl = 167,
getcpu = 168,
gettimeofday = 169,
settimeofday = 170,
adjtimex = 171,
getpid = 172,
getppid = 173,
getuid = 174,
geteuid = 175,
getgid = 176,
getegid = 177,
gettid = 178,
sysinfo = 179,
mq_open = 180,
mq_unlink = 181,
mq_timedsend = 182,
mq_timedreceive = 183,
mq_notify = 184,
mq_getsetattr = 185,
msgget = 186,
msgctl = 187,
msgrcv = 188,
msgsnd = 189,
semget = 190,
semctl = 191,
semtimedop = 192,
semop = 193,
shmget = 194,
shmctl = 195,
shmat = 196,
shmdt = 197,
socket = 198,
socketpair = 199,
bind = 200,
listen = 201,
accept = 202,
connect = 203,
getsockname = 204,
getpeername = 205,
sendto = 206,
recvfrom = 207,
setsockopt = 208,
getsockopt = 209,
shutdown = 210,
sendmsg = 211,
recvmsg = 212,
readahead = 213,
brk = 214,
munmap = 215,
mremap = 216,
add_key = 217,
request_key = 218,
keyctl = 219,
clone = 220,
execve = 221,
mmap = 222,
fadvise64 = 223,
swapon = 224,
swapoff = 225,
mprotect = 226,
msync = 227,
mlock = 228,
munlock = 229,
mlockall = 230,
munlockall = 231,
mincore = 232,
madvise = 233,
remap_file_pages = 234,
mbind = 235,
get_mempolicy = 236,
set_mempolicy = 237,
migrate_pages = 238,
move_pages = 239,
rt_tgsigqueueinfo = 240,
perf_event_open = 241,
accept4 = 242,
recvmmsg = 243,
riscv_flush_icache = arch_specific_syscall + 15,
wait4 = 260,
prlimit64 = 261,
fanotify_init = 262,
fanotify_mark = 263,
name_to_handle_at = 264,
open_by_handle_at = 265,
clock_adjtime = 266,
syncfs = 267,
setns = 268,
sendmmsg = 269,
process_vm_readv = 270,
process_vm_writev = 271,
kcmp = 272,
finit_module = 273,
sched_setattr = 274,
sched_getattr = 275,
renameat2 = 276,
seccomp = 277,
getrandom = 278,
memfd_create = 279,
bpf = 280,
execveat = 281,
userfaultfd = 282,
membarrier = 283,
mlock2 = 284,
copy_file_range = 285,
preadv2 = 286,
pwritev2 = 287,
pkey_mprotect = 288,
pkey_alloc = 289,
pkey_free = 290,
statx = 291,
io_pgetevents = 292,
rseq = 293,
kexec_file_load = 294,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
_,
};
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o200000;
pub const NOFOLLOW = 0o400000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o40000;
pub const LARGEFILE = 0o100000;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20200000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const GETLK = 5;
pub const SETLK = 6;
pub const SETLKW = 7;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const UN = 8;
pub const NB = 4;
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = isize;
pub const mode_t = u32;
pub const off_t = isize;
pub const ino_t = usize;
pub const dev_t = usize;
pub const blkcnt_t = isize;
pub const timeval = extern struct {
tv_sec: time_t,
tv_usec: i64,
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
__unused: [4]u8,
};
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
ino: ino_t,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__pad: usize,
size: off_t,
blksize: blksize_t,
__pad2: i32,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
__unused: [2]u32,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const Elf_Symndx = u32;
pub const VDSO = struct {};
pub const MAP = struct {};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/mips.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const timespec = linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile (
\\ syscall
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
: "memory", "cc", "$7"
);
}
pub fn syscall_pipe(fd: *[2]i32) usize {
return asm volatile (
\\ .set noat
\\ .set noreorder
\\ syscall
\\ blez $7, 1f
\\ nop
\\ b 2f
\\ subu $2, $0, $2
\\ 1:
\\ sw $2, 0($4)
\\ sw $3, 4($4)
\\ 2:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(SYS.pipe)),
[fd] "{$4}" (fd),
: "memory", "cc", "$7"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile (
\\ syscall
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
: "memory", "cc", "$7"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile (
\\ syscall
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
[arg2] "{$5}" (arg2),
: "memory", "cc", "$7"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile (
\\ syscall
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
[arg2] "{$5}" (arg2),
[arg3] "{$6}" (arg3),
: "memory", "cc", "$7"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile (
\\ syscall
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
[arg2] "{$5}" (arg2),
[arg3] "{$6}" (arg3),
[arg4] "{$7}" (arg4),
: "memory", "cc", "$7"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile (
\\ .set noat
\\ subu $sp, $sp, 24
\\ sw %[arg5], 16($sp)
\\ syscall
\\ addu $sp, $sp, 24
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
[arg2] "{$5}" (arg2),
[arg3] "{$6}" (arg3),
[arg4] "{$7}" (arg4),
[arg5] "r" (arg5),
: "memory", "cc", "$7"
);
}
// NOTE: The o32 calling convention requires the callee to reserve 16 bytes for
// the first four arguments even though they're passed in $a0-$a3.
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile (
\\ .set noat
\\ subu $sp, $sp, 24
\\ sw %[arg5], 16($sp)
\\ sw %[arg6], 20($sp)
\\ syscall
\\ addu $sp, $sp, 24
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
[arg2] "{$5}" (arg2),
[arg3] "{$6}" (arg3),
[arg4] "{$7}" (arg4),
[arg5] "r" (arg5),
[arg6] "r" (arg6),
: "memory", "cc", "$7"
);
}
pub fn syscall7(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
arg7: usize,
) usize {
return asm volatile (
\\ .set noat
\\ subu $sp, $sp, 32
\\ sw %[arg5], 16($sp)
\\ sw %[arg6], 20($sp)
\\ sw %[arg7], 24($sp)
\\ syscall
\\ addu $sp, $sp, 32
\\ blez $7, 1f
\\ subu $2, $0, $2
\\ 1:
: [ret] "={$2}" (-> usize),
: [number] "{$2}" (@intFromEnum(number)),
[arg1] "{$4}" (arg1),
[arg2] "{$5}" (arg2),
[arg3] "{$6}" (arg3),
[arg4] "{$7}" (arg4),
[arg5] "r" (arg5),
[arg6] "r" (arg6),
[arg7] "r" (arg7),
: "memory", "cc", "$7"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: u32, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub fn restore() callconv(.Naked) void {
return asm volatile ("syscall"
:
: [number] "{$2}" (@intFromEnum(SYS.sigreturn)),
: "memory", "cc", "$7"
);
}
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("syscall"
:
: [number] "{$2}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory", "cc", "$7"
);
}
pub const SYS = enum(usize) {
pub const Linux = 4000;
syscall = Linux + 0,
exit = Linux + 1,
fork = Linux + 2,
read = Linux + 3,
write = Linux + 4,
open = Linux + 5,
close = Linux + 6,
waitpid = Linux + 7,
creat = Linux + 8,
link = Linux + 9,
unlink = Linux + 10,
execve = Linux + 11,
chdir = Linux + 12,
time = Linux + 13,
mknod = Linux + 14,
chmod = Linux + 15,
lchown = Linux + 16,
@"break" = Linux + 17,
unused18 = Linux + 18,
lseek = Linux + 19,
getpid = Linux + 20,
mount = Linux + 21,
umount = Linux + 22,
setuid = Linux + 23,
getuid = Linux + 24,
stime = Linux + 25,
ptrace = Linux + 26,
alarm = Linux + 27,
unused28 = Linux + 28,
pause = Linux + 29,
utime = Linux + 30,
stty = Linux + 31,
gtty = Linux + 32,
access = Linux + 33,
nice = Linux + 34,
ftime = Linux + 35,
sync = Linux + 36,
kill = Linux + 37,
rename = Linux + 38,
mkdir = Linux + 39,
rmdir = Linux + 40,
dup = Linux + 41,
pipe = Linux + 42,
times = Linux + 43,
prof = Linux + 44,
brk = Linux + 45,
setgid = Linux + 46,
getgid = Linux + 47,
signal = Linux + 48,
geteuid = Linux + 49,
getegid = Linux + 50,
acct = Linux + 51,
umount2 = Linux + 52,
lock = Linux + 53,
ioctl = Linux + 54,
fcntl = Linux + 55,
mpx = Linux + 56,
setpgid = Linux + 57,
ulimit = Linux + 58,
unused59 = Linux + 59,
umask = Linux + 60,
chroot = Linux + 61,
ustat = Linux + 62,
dup2 = Linux + 63,
getppid = Linux + 64,
getpgrp = Linux + 65,
setsid = Linux + 66,
sigaction = Linux + 67,
sgetmask = Linux + 68,
ssetmask = Linux + 69,
setreuid = Linux + 70,
setregid = Linux + 71,
sigsuspend = Linux + 72,
sigpending = Linux + 73,
sethostname = Linux + 74,
setrlimit = Linux + 75,
getrlimit = Linux + 76,
getrusage = Linux + 77,
gettimeofday = Linux + 78,
settimeofday = Linux + 79,
getgroups = Linux + 80,
setgroups = Linux + 81,
reserved82 = Linux + 82,
symlink = Linux + 83,
unused84 = Linux + 84,
readlink = Linux + 85,
uselib = Linux + 86,
swapon = Linux + 87,
reboot = Linux + 88,
readdir = Linux + 89,
mmap = Linux + 90,
munmap = Linux + 91,
truncate = Linux + 92,
ftruncate = Linux + 93,
fchmod = Linux + 94,
fchown = Linux + 95,
getpriority = Linux + 96,
setpriority = Linux + 97,
profil = Linux + 98,
statfs = Linux + 99,
fstatfs = Linux + 100,
ioperm = Linux + 101,
socketcall = Linux + 102,
syslog = Linux + 103,
setitimer = Linux + 104,
getitimer = Linux + 105,
stat = Linux + 106,
lstat = Linux + 107,
fstat = Linux + 108,
unused109 = Linux + 109,
iopl = Linux + 110,
vhangup = Linux + 111,
idle = Linux + 112,
vm86 = Linux + 113,
wait4 = Linux + 114,
swapoff = Linux + 115,
sysinfo = Linux + 116,
ipc = Linux + 117,
fsync = Linux + 118,
sigreturn = Linux + 119,
clone = Linux + 120,
setdomainname = Linux + 121,
uname = Linux + 122,
modify_ldt = Linux + 123,
adjtimex = Linux + 124,
mprotect = Linux + 125,
sigprocmask = Linux + 126,
create_module = Linux + 127,
init_module = Linux + 128,
delete_module = Linux + 129,
get_kernel_syms = Linux + 130,
quotactl = Linux + 131,
getpgid = Linux + 132,
fchdir = Linux + 133,
bdflush = Linux + 134,
sysfs = Linux + 135,
personality = Linux + 136,
afs_syscall = Linux + 137,
setfsuid = Linux + 138,
setfsgid = Linux + 139,
_llseek = Linux + 140,
getdents = Linux + 141,
_newselect = Linux + 142,
flock = Linux + 143,
msync = Linux + 144,
readv = Linux + 145,
writev = Linux + 146,
cacheflush = Linux + 147,
cachectl = Linux + 148,
sysmips = Linux + 149,
unused150 = Linux + 150,
getsid = Linux + 151,
fdatasync = Linux + 152,
_sysctl = Linux + 153,
mlock = Linux + 154,
munlock = Linux + 155,
mlockall = Linux + 156,
munlockall = Linux + 157,
sched_setparam = Linux + 158,
sched_getparam = Linux + 159,
sched_setscheduler = Linux + 160,
sched_getscheduler = Linux + 161,
sched_yield = Linux + 162,
sched_get_priority_max = Linux + 163,
sched_get_priority_min = Linux + 164,
sched_rr_get_interval = Linux + 165,
nanosleep = Linux + 166,
mremap = Linux + 167,
accept = Linux + 168,
bind = Linux + 169,
connect = Linux + 170,
getpeername = Linux + 171,
getsockname = Linux + 172,
getsockopt = Linux + 173,
listen = Linux + 174,
recv = Linux + 175,
recvfrom = Linux + 176,
recvmsg = Linux + 177,
send = Linux + 178,
sendmsg = Linux + 179,
sendto = Linux + 180,
setsockopt = Linux + 181,
shutdown = Linux + 182,
socket = Linux + 183,
socketpair = Linux + 184,
setresuid = Linux + 185,
getresuid = Linux + 186,
query_module = Linux + 187,
poll = Linux + 188,
nfsservctl = Linux + 189,
setresgid = Linux + 190,
getresgid = Linux + 191,
prctl = Linux + 192,
rt_sigreturn = Linux + 193,
rt_sigaction = Linux + 194,
rt_sigprocmask = Linux + 195,
rt_sigpending = Linux + 196,
rt_sigtimedwait = Linux + 197,
rt_sigqueueinfo = Linux + 198,
rt_sigsuspend = Linux + 199,
pread64 = Linux + 200,
pwrite64 = Linux + 201,
chown = Linux + 202,
getcwd = Linux + 203,
capget = Linux + 204,
capset = Linux + 205,
sigaltstack = Linux + 206,
sendfile = Linux + 207,
getpmsg = Linux + 208,
putpmsg = Linux + 209,
mmap2 = Linux + 210,
truncate64 = Linux + 211,
ftruncate64 = Linux + 212,
stat64 = Linux + 213,
lstat64 = Linux + 214,
fstat64 = Linux + 215,
pivot_root = Linux + 216,
mincore = Linux + 217,
madvise = Linux + 218,
getdents64 = Linux + 219,
fcntl64 = Linux + 220,
reserved221 = Linux + 221,
gettid = Linux + 222,
readahead = Linux + 223,
setxattr = Linux + 224,
lsetxattr = Linux + 225,
fsetxattr = Linux + 226,
getxattr = Linux + 227,
lgetxattr = Linux + 228,
fgetxattr = Linux + 229,
listxattr = Linux + 230,
llistxattr = Linux + 231,
flistxattr = Linux + 232,
removexattr = Linux + 233,
lremovexattr = Linux + 234,
fremovexattr = Linux + 235,
tkill = Linux + 236,
sendfile64 = Linux + 237,
futex = Linux + 238,
sched_setaffinity = Linux + 239,
sched_getaffinity = Linux + 240,
io_setup = Linux + 241,
io_destroy = Linux + 242,
io_getevents = Linux + 243,
io_submit = Linux + 244,
io_cancel = Linux + 245,
exit_group = Linux + 246,
lookup_dcookie = Linux + 247,
epoll_create = Linux + 248,
epoll_ctl = Linux + 249,
epoll_wait = Linux + 250,
remap_file_pages = Linux + 251,
set_tid_address = Linux + 252,
restart_syscall = Linux + 253,
fadvise64 = Linux + 254,
statfs64 = Linux + 255,
fstatfs64 = Linux + 256,
timer_create = Linux + 257,
timer_settime = Linux + 258,
timer_gettime = Linux + 259,
timer_getoverrun = Linux + 260,
timer_delete = Linux + 261,
clock_settime = Linux + 262,
clock_gettime = Linux + 263,
clock_getres = Linux + 264,
clock_nanosleep = Linux + 265,
tgkill = Linux + 266,
utimes = Linux + 267,
mbind = Linux + 268,
get_mempolicy = Linux + 269,
set_mempolicy = Linux + 270,
mq_open = Linux + 271,
mq_unlink = Linux + 272,
mq_timedsend = Linux + 273,
mq_timedreceive = Linux + 274,
mq_notify = Linux + 275,
mq_getsetattr = Linux + 276,
vserver = Linux + 277,
waitid = Linux + 278,
add_key = Linux + 280,
request_key = Linux + 281,
keyctl = Linux + 282,
set_thread_area = Linux + 283,
inotify_init = Linux + 284,
inotify_add_watch = Linux + 285,
inotify_rm_watch = Linux + 286,
migrate_pages = Linux + 287,
openat = Linux + 288,
mkdirat = Linux + 289,
mknodat = Linux + 290,
fchownat = Linux + 291,
futimesat = Linux + 292,
fstatat64 = Linux + 293,
unlinkat = Linux + 294,
renameat = Linux + 295,
linkat = Linux + 296,
symlinkat = Linux + 297,
readlinkat = Linux + 298,
fchmodat = Linux + 299,
faccessat = Linux + 300,
pselect6 = Linux + 301,
ppoll = Linux + 302,
unshare = Linux + 303,
splice = Linux + 304,
sync_file_range = Linux + 305,
tee = Linux + 306,
vmsplice = Linux + 307,
move_pages = Linux + 308,
set_robust_list = Linux + 309,
get_robust_list = Linux + 310,
kexec_load = Linux + 311,
getcpu = Linux + 312,
epoll_pwait = Linux + 313,
ioprio_set = Linux + 314,
ioprio_get = Linux + 315,
utimensat = Linux + 316,
signalfd = Linux + 317,
timerfd = Linux + 318,
eventfd = Linux + 319,
fallocate = Linux + 320,
timerfd_create = Linux + 321,
timerfd_gettime = Linux + 322,
timerfd_settime = Linux + 323,
signalfd4 = Linux + 324,
eventfd2 = Linux + 325,
epoll_create1 = Linux + 326,
dup3 = Linux + 327,
pipe2 = Linux + 328,
inotify_init1 = Linux + 329,
preadv = Linux + 330,
pwritev = Linux + 331,
rt_tgsigqueueinfo = Linux + 332,
perf_event_open = Linux + 333,
accept4 = Linux + 334,
recvmmsg = Linux + 335,
fanotify_init = Linux + 336,
fanotify_mark = Linux + 337,
prlimit64 = Linux + 338,
name_to_handle_at = Linux + 339,
open_by_handle_at = Linux + 340,
clock_adjtime = Linux + 341,
syncfs = Linux + 342,
sendmmsg = Linux + 343,
setns = Linux + 344,
process_vm_readv = Linux + 345,
process_vm_writev = Linux + 346,
kcmp = Linux + 347,
finit_module = Linux + 348,
sched_setattr = Linux + 349,
sched_getattr = Linux + 350,
renameat2 = Linux + 351,
seccomp = Linux + 352,
getrandom = Linux + 353,
memfd_create = Linux + 354,
bpf = Linux + 355,
execveat = Linux + 356,
userfaultfd = Linux + 357,
membarrier = Linux + 358,
mlock2 = Linux + 359,
copy_file_range = Linux + 360,
preadv2 = Linux + 361,
pwritev2 = Linux + 362,
pkey_mprotect = Linux + 363,
pkey_alloc = Linux + 364,
pkey_free = Linux + 365,
statx = Linux + 366,
rseq = Linux + 367,
io_pgetevents = Linux + 368,
semget = Linux + 393,
semctl = Linux + 394,
shmget = Linux + 395,
shmctl = Linux + 396,
shmat = Linux + 397,
shmdt = Linux + 398,
msgget = Linux + 399,
msgsnd = Linux + 400,
msgrcv = Linux + 401,
msgctl = Linux + 402,
clock_gettime64 = Linux + 403,
clock_settime64 = Linux + 404,
clock_adjtime64 = Linux + 405,
clock_getres_time64 = Linux + 406,
clock_nanosleep_time64 = Linux + 407,
timer_gettime64 = Linux + 408,
timer_settime64 = Linux + 409,
timerfd_gettime64 = Linux + 410,
timerfd_settime64 = Linux + 411,
utimensat_time64 = Linux + 412,
pselect6_time64 = Linux + 413,
ppoll_time64 = Linux + 414,
io_pgetevents_time64 = Linux + 416,
recvmmsg_time64 = Linux + 417,
mq_timedsend_time64 = Linux + 418,
mq_timedreceive_time64 = Linux + 419,
semtimedop_time64 = Linux + 420,
rt_sigtimedwait_time64 = Linux + 421,
futex_time64 = Linux + 422,
sched_rr_get_interval_time64 = Linux + 423,
pidfd_send_signal = Linux + 424,
io_uring_setup = Linux + 425,
io_uring_enter = Linux + 426,
io_uring_register = Linux + 427,
open_tree = Linux + 428,
move_mount = Linux + 429,
fsopen = Linux + 430,
fsconfig = Linux + 431,
fsmount = Linux + 432,
fspick = Linux + 433,
pidfd_open = Linux + 434,
clone3 = Linux + 435,
close_range = Linux + 436,
openat2 = Linux + 437,
pidfd_getfd = Linux + 438,
faccessat2 = Linux + 439,
process_madvise = Linux + 440,
epoll_pwait2 = Linux + 441,
mount_setattr = Linux + 442,
landlock_create_ruleset = Linux + 444,
landlock_add_rule = Linux + 445,
landlock_restrict_self = Linux + 446,
_,
};
pub const O = struct {
pub const CREAT = 0o0400;
pub const EXCL = 0o02000;
pub const NOCTTY = 0o04000;
pub const TRUNC = 0o01000;
pub const APPEND = 0o0010;
pub const NONBLOCK = 0o0200;
pub const DSYNC = 0o0020;
pub const SYNC = 0o040020;
pub const RSYNC = 0o040020;
pub const DIRECTORY = 0o0200000;
pub const NOFOLLOW = 0o0400000;
pub const CLOEXEC = 0o02000000;
pub const ASYNC = 0o010000;
pub const DIRECT = 0o0100000;
pub const LARGEFILE = 0o020000;
pub const NOATIME = 0o01000000;
pub const PATH = 0o010000000;
pub const TMPFILE = 0o020200000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 24;
pub const GETOWN = 23;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const GETLK = 33;
pub const SETLK = 34;
pub const SETLKW = 35;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const UN = 8;
pub const NB = 4;
};
pub const MMAP2_UNIT = 4096;
pub const MAP = struct {
pub const NORESERVE = 0x0400;
pub const GROWSDOWN = 0x1000;
pub const DENYWRITE = 0x2000;
pub const EXECUTABLE = 0x4000;
pub const LOCKED = 0x8000;
pub const @"32BIT" = 0x40;
};
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.39";
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
__pad0: [4]u8,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
__unused: [4]u8,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = i32;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: u32,
__pad0: [3]u32, // Reserved for st_dev expansion
ino: ino_t,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: u32,
__pad1: [3]u32,
size: off_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
blksize: blksize_t,
__pad3: u32,
blocks: blkcnt_t,
__pad4: [14]usize,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: isize,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const Elf_Symndx = u32;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/thumb.zig | //! The syscall interface is identical to the ARM one but we're facing an extra
//! challenge: r7, the register where the syscall number is stored, may be
//! reserved for the frame pointer.
//! Save and restore r7 around the syscall without touching the stack pointer not
//! to break the frame chain.
const std = @import("../../std.zig");
const linux = std.os.linux;
const SYS = linux.SYS;
pub fn syscall0(number: SYS) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r1}" (buf),
: "memory"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r1}" (buf),
[arg1] "{r0}" (arg1),
: "memory"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r2}" (buf),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
: "memory"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r3}" (buf),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
: "memory"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r4}" (buf),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
[arg4] "{r3}" (arg4),
: "memory"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r5}" (buf),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
[arg4] "{r3}" (arg4),
[arg5] "{r4}" (arg5),
: "memory"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
@setRuntimeSafety(false);
var buf: [2]usize = .{ @intFromEnum(number), undefined };
return asm volatile (
\\ str r7, [%[tmp], #4]
\\ ldr r7, [%[tmp]]
\\ svc #0
\\ ldr r7, [%[tmp], #4]
: [ret] "={r0}" (-> usize),
: [tmp] "{r6}" (buf),
[arg1] "{r0}" (arg1),
[arg2] "{r1}" (arg2),
[arg3] "{r2}" (arg3),
[arg4] "{r3}" (arg4),
[arg5] "{r4}" (arg5),
[arg6] "{r5}" (arg6),
: "memory"
);
}
pub fn restore() callconv(.Naked) void {
return asm volatile (
\\ mov r7, %[number]
\\ svc #0
:
: [number] "I" (@intFromEnum(SYS.sigreturn)),
);
}
pub fn restore_rt() callconv(.Naked) void {
return asm volatile (
\\ mov r7, %[number]
\\ svc #0
:
: [number] "I" (@intFromEnum(SYS.rt_sigreturn)),
: "memory"
);
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/powerpc.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const sockaddr = linux.sockaddr;
const timespec = linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
[arg4] "{r6}" (arg4),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
[arg4] "{r6}" (arg4),
[arg5] "{r7}" (arg5),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
[arg4] "{r6}" (arg4),
[arg5] "{r7}" (arg5),
[arg6] "{r8}" (arg6),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub const restore = restore_rt;
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("sc"
:
: [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub const SYS = enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
waitpid = 7,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
time = 13,
mknod = 14,
chmod = 15,
lchown = 16,
@"break" = 17,
oldstat = 18,
lseek = 19,
getpid = 20,
mount = 21,
umount = 22,
setuid = 23,
getuid = 24,
stime = 25,
ptrace = 26,
alarm = 27,
oldfstat = 28,
pause = 29,
utime = 30,
stty = 31,
gtty = 32,
access = 33,
nice = 34,
ftime = 35,
sync = 36,
kill = 37,
rename = 38,
mkdir = 39,
rmdir = 40,
dup = 41,
pipe = 42,
times = 43,
prof = 44,
brk = 45,
setgid = 46,
getgid = 47,
signal = 48,
geteuid = 49,
getegid = 50,
acct = 51,
umount2 = 52,
lock = 53,
ioctl = 54,
fcntl = 55,
mpx = 56,
setpgid = 57,
ulimit = 58,
oldolduname = 59,
umask = 60,
chroot = 61,
ustat = 62,
dup2 = 63,
getppid = 64,
getpgrp = 65,
setsid = 66,
sigaction = 67,
sgetmask = 68,
ssetmask = 69,
setreuid = 70,
setregid = 71,
sigsuspend = 72,
sigpending = 73,
sethostname = 74,
setrlimit = 75,
getrlimit = 76,
getrusage = 77,
gettimeofday = 78,
settimeofday = 79,
getgroups = 80,
setgroups = 81,
select = 82,
symlink = 83,
oldlstat = 84,
readlink = 85,
uselib = 86,
swapon = 87,
reboot = 88,
readdir = 89,
mmap = 90,
munmap = 91,
truncate = 92,
ftruncate = 93,
fchmod = 94,
fchown = 95,
getpriority = 96,
setpriority = 97,
profil = 98,
statfs = 99,
fstatfs = 100,
ioperm = 101,
socketcall = 102,
syslog = 103,
setitimer = 104,
getitimer = 105,
stat = 106,
lstat = 107,
fstat = 108,
olduname = 109,
iopl = 110,
vhangup = 111,
idle = 112,
vm86 = 113,
wait4 = 114,
swapoff = 115,
sysinfo = 116,
ipc = 117,
fsync = 118,
sigreturn = 119,
clone = 120,
setdomainname = 121,
uname = 122,
modify_ldt = 123,
adjtimex = 124,
mprotect = 125,
sigprocmask = 126,
create_module = 127,
init_module = 128,
delete_module = 129,
get_kernel_syms = 130,
quotactl = 131,
getpgid = 132,
fchdir = 133,
bdflush = 134,
sysfs = 135,
personality = 136,
afs_syscall = 137,
setfsuid = 138,
setfsgid = 139,
_llseek = 140,
getdents = 141,
_newselect = 142,
flock = 143,
msync = 144,
readv = 145,
writev = 146,
getsid = 147,
fdatasync = 148,
_sysctl = 149,
mlock = 150,
munlock = 151,
mlockall = 152,
munlockall = 153,
sched_setparam = 154,
sched_getparam = 155,
sched_setscheduler = 156,
sched_getscheduler = 157,
sched_yield = 158,
sched_get_priority_max = 159,
sched_get_priority_min = 160,
sched_rr_get_interval = 161,
nanosleep = 162,
mremap = 163,
setresuid = 164,
getresuid = 165,
query_module = 166,
poll = 167,
nfsservctl = 168,
setresgid = 169,
getresgid = 170,
prctl = 171,
rt_sigreturn = 172,
rt_sigaction = 173,
rt_sigprocmask = 174,
rt_sigpending = 175,
rt_sigtimedwait = 176,
rt_sigqueueinfo = 177,
rt_sigsuspend = 178,
pread64 = 179,
pwrite64 = 180,
chown = 181,
getcwd = 182,
capget = 183,
capset = 184,
sigaltstack = 185,
sendfile = 186,
getpmsg = 187,
putpmsg = 188,
vfork = 189,
ugetrlimit = 190,
readahead = 191,
mmap2 = 192,
truncate64 = 193,
ftruncate64 = 194,
stat64 = 195,
lstat64 = 196,
fstat64 = 197,
pciconfig_read = 198,
pciconfig_write = 199,
pciconfig_iobase = 200,
multiplexer = 201,
getdents64 = 202,
pivot_root = 203,
fcntl64 = 204,
madvise = 205,
mincore = 206,
gettid = 207,
tkill = 208,
setxattr = 209,
lsetxattr = 210,
fsetxattr = 211,
getxattr = 212,
lgetxattr = 213,
fgetxattr = 214,
listxattr = 215,
llistxattr = 216,
flistxattr = 217,
removexattr = 218,
lremovexattr = 219,
fremovexattr = 220,
futex = 221,
sched_setaffinity = 222,
sched_getaffinity = 223,
tuxcall = 225,
sendfile64 = 226,
io_setup = 227,
io_destroy = 228,
io_getevents = 229,
io_submit = 230,
io_cancel = 231,
set_tid_address = 232,
fadvise64 = 233,
exit_group = 234,
lookup_dcookie = 235,
epoll_create = 236,
epoll_ctl = 237,
epoll_wait = 238,
remap_file_pages = 239,
timer_create = 240,
timer_settime = 241,
timer_gettime = 242,
timer_getoverrun = 243,
timer_delete = 244,
clock_settime = 245,
clock_gettime = 246,
clock_getres = 247,
clock_nanosleep = 248,
swapcontext = 249,
tgkill = 250,
utimes = 251,
statfs64 = 252,
fstatfs64 = 253,
fadvise64_64 = 254,
rtas = 255,
sys_debug_setcontext = 256,
migrate_pages = 258,
mbind = 259,
get_mempolicy = 260,
set_mempolicy = 261,
mq_open = 262,
mq_unlink = 263,
mq_timedsend = 264,
mq_timedreceive = 265,
mq_notify = 266,
mq_getsetattr = 267,
kexec_load = 268,
add_key = 269,
request_key = 270,
keyctl = 271,
waitid = 272,
ioprio_set = 273,
ioprio_get = 274,
inotify_init = 275,
inotify_add_watch = 276,
inotify_rm_watch = 277,
spu_run = 278,
spu_create = 279,
pselect6 = 280,
ppoll = 281,
unshare = 282,
splice = 283,
tee = 284,
vmsplice = 285,
openat = 286,
mkdirat = 287,
mknodat = 288,
fchownat = 289,
futimesat = 290,
fstatat64 = 291,
unlinkat = 292,
renameat = 293,
linkat = 294,
symlinkat = 295,
readlinkat = 296,
fchmodat = 297,
faccessat = 298,
get_robust_list = 299,
set_robust_list = 300,
move_pages = 301,
getcpu = 302,
epoll_pwait = 303,
utimensat = 304,
signalfd = 305,
timerfd_create = 306,
eventfd = 307,
sync_file_range = 308,
fallocate = 309,
subpage_prot = 310,
timerfd_settime = 311,
timerfd_gettime = 312,
signalfd4 = 313,
eventfd2 = 314,
epoll_create1 = 315,
dup3 = 316,
pipe2 = 317,
inotify_init1 = 318,
perf_event_open = 319,
preadv = 320,
pwritev = 321,
rt_tgsigqueueinfo = 322,
fanotify_init = 323,
fanotify_mark = 324,
prlimit64 = 325,
socket = 326,
bind = 327,
connect = 328,
listen = 329,
accept = 330,
getsockname = 331,
getpeername = 332,
socketpair = 333,
send = 334,
sendto = 335,
recv = 336,
recvfrom = 337,
shutdown = 338,
setsockopt = 339,
getsockopt = 340,
sendmsg = 341,
recvmsg = 342,
recvmmsg = 343,
accept4 = 344,
name_to_handle_at = 345,
open_by_handle_at = 346,
clock_adjtime = 347,
syncfs = 348,
sendmmsg = 349,
setns = 350,
process_vm_readv = 351,
process_vm_writev = 352,
finit_module = 353,
kcmp = 354,
sched_setattr = 355,
sched_getattr = 356,
renameat2 = 357,
seccomp = 358,
getrandom = 359,
memfd_create = 360,
bpf = 361,
execveat = 362,
switch_endian = 363,
userfaultfd = 364,
membarrier = 365,
mlock2 = 378,
copy_file_range = 379,
preadv2 = 380,
pwritev2 = 381,
kexec_file_load = 382,
statx = 383,
pkey_alloc = 384,
pkey_free = 385,
pkey_mprotect = 386,
rseq = 387,
io_pgetevents = 388,
semget = 393,
semctl = 394,
shmget = 395,
shmctl = 396,
shmat = 397,
shmdt = 398,
msgget = 399,
msgsnd = 400,
msgrcv = 401,
msgctl = 402,
clock_gettime64 = 403,
clock_settime64 = 404,
clock_adjtime64 = 405,
clock_getres_time64 = 406,
clock_nanosleep_time64 = 407,
timer_gettime64 = 408,
timer_settime64 = 409,
timerfd_gettime64 = 410,
timerfd_settime64 = 411,
utimensat_time64 = 412,
pselect6_time64 = 413,
ppoll_time64 = 414,
io_pgetevents_time64 = 416,
recvmmsg_time64 = 417,
mq_timedsend_time64 = 418,
mq_timedreceive_time64 = 419,
semtimedop_time64 = 420,
rt_sigtimedwait_time64 = 421,
futex_time64 = 422,
sched_rr_get_interval_time64 = 423,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
};
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o40000;
pub const NOFOLLOW = 0o100000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o400000;
pub const LARGEFILE = 0o200000;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20040000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const GETLK = 12;
pub const SETLK = 13;
pub const SETLKW = 14;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const UN = 8;
pub const NB = 4;
};
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x0080;
/// don't check for reservations
pub const NORESERVE = 0x0040;
};
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.15";
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
};
pub const msghdr = extern struct {
msg_name: ?*sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec,
msg_iovlen: usize,
msg_control: ?*anyopaque,
msg_controllen: socklen_t,
msg_flags: i32,
};
pub const msghdr_const = extern struct {
msg_name: ?*const sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec_const,
msg_iovlen: usize,
msg_control: ?*anyopaque,
msg_controllen: socklen_t,
msg_flags: i32,
};
pub const blksize_t = i32;
pub const nlink_t = u32;
pub const time_t = isize;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
ino: ino_t,
mode: mode_t,
nlink: nlink_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
__rdev_padding: i16,
size: off_t,
blksize: blksize_t,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
__unused: [2]u32,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: time_t,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const greg_t = u32;
pub const gregset_t = [48]greg_t;
pub const fpregset_t = [33]f64;
pub const vrregset = extern struct {
vrregs: [32][4]u32,
vrsave: u32,
_pad: [2]u32,
vscr: u32,
};
pub const vrregset_t = vrregset;
pub const mcontext_t = extern struct {
gp_regs: gregset_t,
fp_regs: fpregset_t,
v_regs: vrregset_t align(16),
};
pub const ucontext_t = extern struct {
flags: u32,
link: *ucontext_t,
stack: stack_t,
pad: [7]i32,
regs: *mcontext_t,
sigmask: sigset_t,
pad2: [3]i32,
mcontext: mcontext_t,
};
pub const Elf_Symndx = u32;
pub const MMAP2_UNIT = 4096;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/vdso.zig | const std = @import("../../std.zig");
const elf = std.elf;
const linux = std.os.linux;
const mem = std.mem;
const maxInt = std.math.maxInt;
pub fn lookup(vername: []const u8, name: []const u8) usize {
const vdso_addr = std.os.system.getauxval(std.elf.AT_SYSINFO_EHDR);
if (vdso_addr == 0) return 0;
const eh = @as(*elf.Ehdr, @ptrFromInt(vdso_addr));
var ph_addr: usize = vdso_addr + eh.e_phoff;
var maybe_dynv: ?[*]usize = null;
var base: usize = maxInt(usize);
{
var i: usize = 0;
while (i < eh.e_phnum) : ({
i += 1;
ph_addr += eh.e_phentsize;
}) {
const this_ph = @as(*elf.Phdr, @ptrFromInt(ph_addr));
switch (this_ph.p_type) {
// On WSL1 as well as older kernels, the VDSO ELF image is pre-linked in the upper half
// of the memory space (e.g. p_vaddr = 0xffffffffff700000 on WSL1).
// Wrapping operations are used on this line as well as subsequent calculations relative to base
// (lines 47, 78) to ensure no overflow check is tripped.
elf.PT_LOAD => base = vdso_addr +% this_ph.p_offset -% this_ph.p_vaddr,
elf.PT_DYNAMIC => maybe_dynv = @as([*]usize, @ptrFromInt(vdso_addr + this_ph.p_offset)),
else => {},
}
}
}
const dynv = maybe_dynv orelse return 0;
if (base == maxInt(usize)) return 0;
var maybe_strings: ?[*]u8 = null;
var maybe_syms: ?[*]elf.Sym = null;
var maybe_hashtab: ?[*]linux.Elf_Symndx = null;
var maybe_versym: ?[*]u16 = null;
var maybe_verdef: ?*elf.Verdef = null;
{
var i: usize = 0;
while (dynv[i] != 0) : (i += 2) {
const p = base +% dynv[i + 1];
switch (dynv[i]) {
elf.DT_STRTAB => maybe_strings = @as([*]u8, @ptrFromInt(p)),
elf.DT_SYMTAB => maybe_syms = @as([*]elf.Sym, @ptrFromInt(p)),
elf.DT_HASH => maybe_hashtab = @as([*]linux.Elf_Symndx, @ptrFromInt(p)),
elf.DT_VERSYM => maybe_versym = @as([*]u16, @ptrFromInt(p)),
elf.DT_VERDEF => maybe_verdef = @as(*elf.Verdef, @ptrFromInt(p)),
else => {},
}
}
}
const strings = maybe_strings orelse return 0;
const syms = maybe_syms orelse return 0;
const hashtab = maybe_hashtab orelse return 0;
if (maybe_verdef == null) maybe_versym = null;
const OK_TYPES = (1 << elf.STT_NOTYPE | 1 << elf.STT_OBJECT | 1 << elf.STT_FUNC | 1 << elf.STT_COMMON);
const OK_BINDS = (1 << elf.STB_GLOBAL | 1 << elf.STB_WEAK | 1 << elf.STB_GNU_UNIQUE);
var i: usize = 0;
while (i < hashtab[1]) : (i += 1) {
if (0 == (@as(u32, 1) << @as(u5, @intCast(syms[i].st_info & 0xf)) & OK_TYPES)) continue;
if (0 == (@as(u32, 1) << @as(u5, @intCast(syms[i].st_info >> 4)) & OK_BINDS)) continue;
if (0 == syms[i].st_shndx) continue;
const sym_name = std.meta.assumeSentinel(strings + syms[i].st_name, 0);
if (!mem.eql(u8, name, mem.spanZ(sym_name))) continue;
if (maybe_versym) |versym| {
if (!checkver(maybe_verdef.?, versym[i], vername, strings))
continue;
}
return base +% syms[i].st_value;
}
return 0;
}
fn checkver(def_arg: *elf.Verdef, vsym_arg: i32, vername: []const u8, strings: [*]u8) bool {
var def = def_arg;
const vsym = @as(u32, @bitCast(vsym_arg)) & 0x7fff;
while (true) {
if (0 == (def.vd_flags & elf.VER_FLG_BASE) and (def.vd_ndx & 0x7fff) == vsym)
break;
if (def.vd_next == 0)
return false;
def = @as(*elf.Verdef, @ptrFromInt(@intFromPtr(def) + def.vd_next));
}
const aux = @as(*elf.Verdaux, @ptrFromInt(@intFromPtr(def) + def.vd_aux));
const vda_name = std.meta.assumeSentinel(strings + aux.vda_name, 0);
return mem.eql(u8, vername, mem.spanZ(vda_name));
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/ioctl.zig | const std = @import("../../std.zig");
const bits = switch (@import("builtin").cpu.arch) {
.mips,
.mipsel,
.mips64,
.mips64el,
.powerpc,
.powerpcle,
.powerpc64,
.powerpc64le,
.sparc,
.sparcv9,
.sparcel,
=> .{ .size = 13, .dir = 3, .none = 1, .read = 2, .write = 4 },
else => .{ .size = 14, .dir = 2, .none = 0, .read = 2, .write = 1 },
};
const Direction = std.meta.Int(.unsigned, bits.dir);
pub const Request = packed struct {
nr: u8,
io_type: u8,
size: std.meta.Int(.unsigned, bits.size),
dir: Direction,
};
fn io_impl(dir: Direction, io_type: u8, nr: u8, comptime T: type) u32 {
const request = Request{
.dir = dir,
.size = @sizeOf(T),
.io_type = io_type,
.nr = nr,
};
return @as(u32, @bitCast(request));
}
pub fn IO(io_type: u8, nr: u8) u32 {
return io_impl(bits.none, io_type, nr, void);
}
pub fn IOR(io_type: u8, nr: u8, comptime T: type) u32 {
return io_impl(bits.read, io_type, nr, T);
}
pub fn IOW(io_type: u8, nr: u8, comptime T: type) u32 {
return io_impl(bits.write, io_type, nr, T);
}
pub fn IOWR(io_type: u8, nr: u8, comptime T: type) u32 {
return io_impl(bits.read | bits.write, io_type, nr, T);
}
comptime {
std.debug.assert(@bitSizeOf(Request) == 32);
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/powerpc64.zig | const std = @import("../../std.zig");
const maxInt = std.math.maxInt;
const linux = std.os.linux;
const socklen_t = linux.socklen_t;
const iovec = linux.iovec;
const iovec_const = linux.iovec_const;
const uid_t = linux.uid_t;
const gid_t = linux.gid_t;
const pid_t = linux.pid_t;
const stack_t = linux.stack_t;
const sigset_t = linux.sigset_t;
const sockaddr = linux.sockaddr;
const timespec = linux.timespec;
pub fn syscall0(number: SYS) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall1(number: SYS, arg1: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall2(number: SYS, arg1: usize, arg2: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall3(number: SYS, arg1: usize, arg2: usize, arg3: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall4(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
[arg4] "{r6}" (arg4),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall5(number: SYS, arg1: usize, arg2: usize, arg3: usize, arg4: usize, arg5: usize) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
[arg4] "{r6}" (arg4),
[arg5] "{r7}" (arg5),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub fn syscall6(
number: SYS,
arg1: usize,
arg2: usize,
arg3: usize,
arg4: usize,
arg5: usize,
arg6: usize,
) usize {
return asm volatile (
\\ sc
\\ bns+ 1f
\\ neg 3, 3
\\ 1:
: [ret] "={r3}" (-> usize),
: [number] "{r0}" (@intFromEnum(number)),
[arg1] "{r3}" (arg1),
[arg2] "{r4}" (arg2),
[arg3] "{r5}" (arg3),
[arg4] "{r6}" (arg4),
[arg5] "{r7}" (arg5),
[arg6] "{r8}" (arg6),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
/// This matches the libc clone function.
pub extern fn clone(func: fn (arg: usize) callconv(.C) u8, stack: usize, flags: usize, arg: usize, ptid: *i32, tls: usize, ctid: *i32) usize;
pub const restore = restore_rt;
pub fn restore_rt() callconv(.Naked) void {
return asm volatile ("sc"
:
: [number] "{r0}" (@intFromEnum(SYS.rt_sigreturn)),
: "memory", "cr0", "r4", "r5", "r6", "r7", "r8", "r9", "r10", "r11", "r12"
);
}
pub const SYS = enum(usize) {
restart_syscall = 0,
exit = 1,
fork = 2,
read = 3,
write = 4,
open = 5,
close = 6,
waitpid = 7,
creat = 8,
link = 9,
unlink = 10,
execve = 11,
chdir = 12,
time = 13,
mknod = 14,
chmod = 15,
lchown = 16,
@"break" = 17,
oldstat = 18,
lseek = 19,
getpid = 20,
mount = 21,
umount = 22,
setuid = 23,
getuid = 24,
stime = 25,
ptrace = 26,
alarm = 27,
oldfstat = 28,
pause = 29,
utime = 30,
stty = 31,
gtty = 32,
access = 33,
nice = 34,
ftime = 35,
sync = 36,
kill = 37,
rename = 38,
mkdir = 39,
rmdir = 40,
dup = 41,
pipe = 42,
times = 43,
prof = 44,
brk = 45,
setgid = 46,
getgid = 47,
signal = 48,
geteuid = 49,
getegid = 50,
acct = 51,
umount2 = 52,
lock = 53,
ioctl = 54,
fcntl = 55,
mpx = 56,
setpgid = 57,
ulimit = 58,
oldolduname = 59,
umask = 60,
chroot = 61,
ustat = 62,
dup2 = 63,
getppid = 64,
getpgrp = 65,
setsid = 66,
sigaction = 67,
sgetmask = 68,
ssetmask = 69,
setreuid = 70,
setregid = 71,
sigsuspend = 72,
sigpending = 73,
sethostname = 74,
setrlimit = 75,
getrlimit = 76,
getrusage = 77,
gettimeofday = 78,
settimeofday = 79,
getgroups = 80,
setgroups = 81,
select = 82,
symlink = 83,
oldlstat = 84,
readlink = 85,
uselib = 86,
swapon = 87,
reboot = 88,
readdir = 89,
mmap = 90,
munmap = 91,
truncate = 92,
ftruncate = 93,
fchmod = 94,
fchown = 95,
getpriority = 96,
setpriority = 97,
profil = 98,
statfs = 99,
fstatfs = 100,
ioperm = 101,
socketcall = 102,
syslog = 103,
setitimer = 104,
getitimer = 105,
stat = 106,
lstat = 107,
fstat = 108,
olduname = 109,
iopl = 110,
vhangup = 111,
idle = 112,
vm86 = 113,
wait4 = 114,
swapoff = 115,
sysinfo = 116,
ipc = 117,
fsync = 118,
sigreturn = 119,
clone = 120,
setdomainname = 121,
uname = 122,
modify_ldt = 123,
adjtimex = 124,
mprotect = 125,
sigprocmask = 126,
create_module = 127,
init_module = 128,
delete_module = 129,
get_kernel_syms = 130,
quotactl = 131,
getpgid = 132,
fchdir = 133,
bdflush = 134,
sysfs = 135,
personality = 136,
afs_syscall = 137,
setfsuid = 138,
setfsgid = 139,
_llseek = 140,
getdents = 141,
_newselect = 142,
flock = 143,
msync = 144,
readv = 145,
writev = 146,
getsid = 147,
fdatasync = 148,
_sysctl = 149,
mlock = 150,
munlock = 151,
mlockall = 152,
munlockall = 153,
sched_setparam = 154,
sched_getparam = 155,
sched_setscheduler = 156,
sched_getscheduler = 157,
sched_yield = 158,
sched_get_priority_max = 159,
sched_get_priority_min = 160,
sched_rr_get_interval = 161,
nanosleep = 162,
mremap = 163,
setresuid = 164,
getresuid = 165,
query_module = 166,
poll = 167,
nfsservctl = 168,
setresgid = 169,
getresgid = 170,
prctl = 171,
rt_sigreturn = 172,
rt_sigaction = 173,
rt_sigprocmask = 174,
rt_sigpending = 175,
rt_sigtimedwait = 176,
rt_sigqueueinfo = 177,
rt_sigsuspend = 178,
pread64 = 179,
pwrite64 = 180,
chown = 181,
getcwd = 182,
capget = 183,
capset = 184,
sigaltstack = 185,
sendfile = 186,
getpmsg = 187,
putpmsg = 188,
vfork = 189,
ugetrlimit = 190,
readahead = 191,
pciconfig_read = 198,
pciconfig_write = 199,
pciconfig_iobase = 200,
multiplexer = 201,
getdents64 = 202,
pivot_root = 203,
madvise = 205,
mincore = 206,
gettid = 207,
tkill = 208,
setxattr = 209,
lsetxattr = 210,
fsetxattr = 211,
getxattr = 212,
lgetxattr = 213,
fgetxattr = 214,
listxattr = 215,
llistxattr = 216,
flistxattr = 217,
removexattr = 218,
lremovexattr = 219,
fremovexattr = 220,
futex = 221,
sched_setaffinity = 222,
sched_getaffinity = 223,
tuxcall = 225,
io_setup = 227,
io_destroy = 228,
io_getevents = 229,
io_submit = 230,
io_cancel = 231,
set_tid_address = 232,
fadvise64 = 233,
exit_group = 234,
lookup_dcookie = 235,
epoll_create = 236,
epoll_ctl = 237,
epoll_wait = 238,
remap_file_pages = 239,
timer_create = 240,
timer_settime = 241,
timer_gettime = 242,
timer_getoverrun = 243,
timer_delete = 244,
clock_settime = 245,
clock_gettime = 246,
clock_getres = 247,
clock_nanosleep = 248,
swapcontext = 249,
tgkill = 250,
utimes = 251,
statfs64 = 252,
fstatfs64 = 253,
rtas = 255,
sys_debug_setcontext = 256,
migrate_pages = 258,
mbind = 259,
get_mempolicy = 260,
set_mempolicy = 261,
mq_open = 262,
mq_unlink = 263,
mq_timedsend = 264,
mq_timedreceive = 265,
mq_notify = 266,
mq_getsetattr = 267,
kexec_load = 268,
add_key = 269,
request_key = 270,
keyctl = 271,
waitid = 272,
ioprio_set = 273,
ioprio_get = 274,
inotify_init = 275,
inotify_add_watch = 276,
inotify_rm_watch = 277,
spu_run = 278,
spu_create = 279,
pselect6 = 280,
ppoll = 281,
unshare = 282,
splice = 283,
tee = 284,
vmsplice = 285,
openat = 286,
mkdirat = 287,
mknodat = 288,
fchownat = 289,
futimesat = 290,
fstatat = 291,
unlinkat = 292,
renameat = 293,
linkat = 294,
symlinkat = 295,
readlinkat = 296,
fchmodat = 297,
faccessat = 298,
get_robust_list = 299,
set_robust_list = 300,
move_pages = 301,
getcpu = 302,
epoll_pwait = 303,
utimensat = 304,
signalfd = 305,
timerfd_create = 306,
eventfd = 307,
sync_file_range = 308,
fallocate = 309,
subpage_prot = 310,
timerfd_settime = 311,
timerfd_gettime = 312,
signalfd4 = 313,
eventfd2 = 314,
epoll_create1 = 315,
dup3 = 316,
pipe2 = 317,
inotify_init1 = 318,
perf_event_open = 319,
preadv = 320,
pwritev = 321,
rt_tgsigqueueinfo = 322,
fanotify_init = 323,
fanotify_mark = 324,
prlimit64 = 325,
socket = 326,
bind = 327,
connect = 328,
listen = 329,
accept = 330,
getsockname = 331,
getpeername = 332,
socketpair = 333,
send = 334,
sendto = 335,
recv = 336,
recvfrom = 337,
shutdown = 338,
setsockopt = 339,
getsockopt = 340,
sendmsg = 341,
recvmsg = 342,
recvmmsg = 343,
accept4 = 344,
name_to_handle_at = 345,
open_by_handle_at = 346,
clock_adjtime = 347,
syncfs = 348,
sendmmsg = 349,
setns = 350,
process_vm_readv = 351,
process_vm_writev = 352,
finit_module = 353,
kcmp = 354,
sched_setattr = 355,
sched_getattr = 356,
renameat2 = 357,
seccomp = 358,
getrandom = 359,
memfd_create = 360,
bpf = 361,
execveat = 362,
switch_endian = 363,
userfaultfd = 364,
membarrier = 365,
mlock2 = 378,
copy_file_range = 379,
preadv2 = 380,
pwritev2 = 381,
kexec_file_load = 382,
statx = 383,
pkey_alloc = 384,
pkey_free = 385,
pkey_mprotect = 386,
rseq = 387,
io_pgetevents = 388,
semtimedop = 392,
semget = 393,
semctl = 394,
shmget = 395,
shmctl = 396,
shmat = 397,
shmdt = 398,
msgget = 399,
msgsnd = 400,
msgrcv = 401,
msgctl = 402,
pidfd_send_signal = 424,
io_uring_setup = 425,
io_uring_enter = 426,
io_uring_register = 427,
open_tree = 428,
move_mount = 429,
fsopen = 430,
fsconfig = 431,
fsmount = 432,
fspick = 433,
pidfd_open = 434,
clone3 = 435,
close_range = 436,
openat2 = 437,
pidfd_getfd = 438,
faccessat2 = 439,
process_madvise = 440,
epoll_pwait2 = 441,
mount_setattr = 442,
landlock_create_ruleset = 444,
landlock_add_rule = 445,
landlock_restrict_self = 446,
_,
};
pub const O = struct {
pub const CREAT = 0o100;
pub const EXCL = 0o200;
pub const NOCTTY = 0o400;
pub const TRUNC = 0o1000;
pub const APPEND = 0o2000;
pub const NONBLOCK = 0o4000;
pub const DSYNC = 0o10000;
pub const SYNC = 0o4010000;
pub const RSYNC = 0o4010000;
pub const DIRECTORY = 0o40000;
pub const NOFOLLOW = 0o100000;
pub const CLOEXEC = 0o2000000;
pub const ASYNC = 0o20000;
pub const DIRECT = 0o400000;
pub const LARGEFILE = 0o200000;
pub const NOATIME = 0o1000000;
pub const PATH = 0o10000000;
pub const TMPFILE = 0o20200000;
pub const NDELAY = NONBLOCK;
};
pub const F = struct {
pub const DUPFD = 0;
pub const GETFD = 1;
pub const SETFD = 2;
pub const GETFL = 3;
pub const SETFL = 4;
pub const SETOWN = 8;
pub const GETOWN = 9;
pub const SETSIG = 10;
pub const GETSIG = 11;
pub const GETLK = 5;
pub const SETLK = 6;
pub const SETLKW = 7;
pub const RDLCK = 0;
pub const WRLCK = 1;
pub const UNLCK = 2;
pub const SETOWN_EX = 15;
pub const GETOWN_EX = 16;
pub const GETOWNER_UIDS = 17;
};
pub const LOCK = struct {
pub const SH = 1;
pub const EX = 2;
pub const UN = 8;
pub const NB = 4;
};
pub const MAP = struct {
/// stack-like segment
pub const GROWSDOWN = 0x0100;
/// ETXTBSY
pub const DENYWRITE = 0x0800;
/// mark it as an executable
pub const EXECUTABLE = 0x1000;
/// pages are locked
pub const LOCKED = 0x0080;
/// don't check for reservations
pub const NORESERVE = 0x0040;
};
pub const VDSO = struct {
pub const CGT_SYM = "__kernel_clock_gettime";
pub const CGT_VER = "LINUX_2.6.15";
};
pub const Flock = extern struct {
l_type: i16,
l_whence: i16,
l_start: off_t,
l_len: off_t,
l_pid: pid_t,
__unused: [4]u8,
};
pub const msghdr = extern struct {
msg_name: ?*sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec,
msg_iovlen: usize,
msg_control: ?*anyopaque,
msg_controllen: usize,
msg_flags: i32,
};
pub const msghdr_const = extern struct {
msg_name: ?*const sockaddr,
msg_namelen: socklen_t,
msg_iov: [*]iovec_const,
msg_iovlen: usize,
msg_control: ?*anyopaque,
msg_controllen: usize,
msg_flags: i32,
};
pub const blksize_t = i64;
pub const nlink_t = u64;
pub const time_t = i64;
pub const mode_t = u32;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const blkcnt_t = i64;
// The `stat` definition used by the Linux kernel.
pub const Stat = extern struct {
dev: dev_t,
ino: ino_t,
nlink: nlink_t,
mode: mode_t,
uid: uid_t,
gid: gid_t,
rdev: dev_t,
size: off_t,
blksize: blksize_t,
blocks: blkcnt_t,
atim: timespec,
mtim: timespec,
ctim: timespec,
__unused: [3]u64,
pub fn atime(self: @This()) timespec {
return self.atim;
}
pub fn mtime(self: @This()) timespec {
return self.mtim;
}
pub fn ctime(self: @This()) timespec {
return self.ctim;
}
};
pub const timeval = extern struct {
tv_sec: isize,
tv_usec: isize,
};
pub const timezone = extern struct {
tz_minuteswest: i32,
tz_dsttime: i32,
};
pub const greg_t = u64;
pub const gregset_t = [48]greg_t;
pub const fpregset_t = [33]f64;
/// The position of the vscr register depends on endianness.
/// On C, macros are used to change vscr_word's offset to
/// account for this. Here we'll just define vscr_word_le
/// and vscr_word_be. Code must take care to use the correct one.
pub const vrregset = extern struct {
vrregs: [32][4]u32 align(16),
vscr_word_le: u32,
_pad1: [2]u32,
vscr_word_be: u32,
vrsave: u32,
_pad2: [3]u32,
};
pub const vrregset_t = vrregset;
pub const mcontext_t = extern struct {
__unused: [4]u64,
signal: i32,
_pad0: i32,
handler: u64,
oldmask: u64,
regs: ?*anyopaque,
gp_regs: gregset_t,
fp_regs: fpregset_t,
v_regs: *vrregset_t,
vmx_reserve: [34 + 34 + 32 + 1]i64,
};
pub const ucontext_t = extern struct {
flags: u32,
link: *ucontext_t,
stack: stack_t,
sigmask: sigset_t,
mcontext: mcontext_t,
};
pub const Elf_Symndx = u32;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/io_uring.zig | const std = @import("../../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const mem = std.mem;
const net = std.net;
const os = std.os;
const linux = os.linux;
const testing = std.testing;
const io_uring_params = linux.io_uring_params;
const io_uring_sqe = linux.io_uring_sqe;
const io_uring_cqe = linux.io_uring_cqe;
pub const IO_Uring = struct {
fd: os.fd_t = -1,
sq: SubmissionQueue,
cq: CompletionQueue,
flags: u32,
features: u32,
/// A friendly way to setup an io_uring, with default io_uring_params.
/// `entries` must be a power of two between 1 and 4096, although the kernel will make the final
/// call on how many entries the submission and completion queues will ultimately have,
/// see https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L8027-L8050.
/// Matches the interface of io_uring_queue_init() in liburing.
pub fn init(entries: u13, flags: u32) !IO_Uring {
var params = mem.zeroInit(io_uring_params, .{
.flags = flags,
.sq_thread_idle = 1000,
});
return try IO_Uring.init_params(entries, ¶ms);
}
/// A powerful way to setup an io_uring, if you want to tweak io_uring_params such as submission
/// queue thread cpu affinity or thread idle timeout (the kernel and our default is 1 second).
/// `params` is passed by reference because the kernel needs to modify the parameters.
/// Matches the interface of io_uring_queue_init_params() in liburing.
pub fn init_params(entries: u13, p: *io_uring_params) !IO_Uring {
if (entries == 0) return error.EntriesZero;
if (!std.math.isPowerOfTwo(entries)) return error.EntriesNotPowerOfTwo;
assert(p.sq_entries == 0);
assert(p.cq_entries == 0 or p.flags & linux.IORING_SETUP_CQSIZE != 0);
assert(p.features == 0);
assert(p.wq_fd == 0 or p.flags & linux.IORING_SETUP_ATTACH_WQ != 0);
assert(p.resv[0] == 0);
assert(p.resv[1] == 0);
assert(p.resv[2] == 0);
const res = linux.io_uring_setup(entries, p);
switch (linux.getErrno(res)) {
.SUCCESS => {},
.FAULT => return error.ParamsOutsideAccessibleAddressSpace,
// The resv array contains non-zero data, p.flags contains an unsupported flag,
// entries out of bounds, IORING_SETUP_SQ_AFF was specified without IORING_SETUP_SQPOLL,
// or IORING_SETUP_CQSIZE was specified but io_uring_params.cq_entries was invalid:
.INVAL => return error.ArgumentsInvalid,
.MFILE => return error.ProcessFdQuotaExceeded,
.NFILE => return error.SystemFdQuotaExceeded,
.NOMEM => return error.SystemResources,
// IORING_SETUP_SQPOLL was specified but effective user ID lacks sufficient privileges,
// or a container seccomp policy prohibits io_uring syscalls:
.PERM => return error.PermissionDenied,
.NOSYS => return error.SystemOutdated,
else => |errno| return os.unexpectedErrno(errno),
}
const fd = @as(os.fd_t, @intCast(res));
assert(fd >= 0);
errdefer os.close(fd);
// Kernel versions 5.4 and up use only one mmap() for the submission and completion queues.
// This is not an optional feature for us... if the kernel does it, we have to do it.
// The thinking on this by the kernel developers was that both the submission and the
// completion queue rings have sizes just over a power of two, but the submission queue ring
// is significantly smaller with u32 slots. By bundling both in a single mmap, the kernel
// gets the submission queue ring for free.
// See https://patchwork.kernel.org/patch/11115257 for the kernel patch.
// We do not support the double mmap() done before 5.4, because we want to keep the
// init/deinit mmap paths simple and because io_uring has had many bug fixes even since 5.4.
if ((p.features & linux.IORING_FEAT_SINGLE_MMAP) == 0) {
return error.SystemOutdated;
}
// Check that the kernel has actually set params and that "impossible is nothing".
assert(p.sq_entries != 0);
assert(p.cq_entries != 0);
assert(p.cq_entries >= p.sq_entries);
// From here on, we only need to read from params, so pass `p` by value as immutable.
// The completion queue shares the mmap with the submission queue, so pass `sq` there too.
var sq = try SubmissionQueue.init(fd, p.*);
errdefer sq.deinit();
var cq = try CompletionQueue.init(fd, p.*, sq);
errdefer cq.deinit();
// Check that our starting state is as we expect.
assert(sq.head.* == 0);
assert(sq.tail.* == 0);
assert(sq.mask == p.sq_entries - 1);
// Allow flags.* to be non-zero, since the kernel may set IORING_SQ_NEED_WAKEUP at any time.
assert(sq.dropped.* == 0);
assert(sq.array.len == p.sq_entries);
assert(sq.sqes.len == p.sq_entries);
assert(sq.sqe_head == 0);
assert(sq.sqe_tail == 0);
assert(cq.head.* == 0);
assert(cq.tail.* == 0);
assert(cq.mask == p.cq_entries - 1);
assert(cq.overflow.* == 0);
assert(cq.cqes.len == p.cq_entries);
return IO_Uring{
.fd = fd,
.sq = sq,
.cq = cq,
.flags = p.flags,
.features = p.features,
};
}
pub fn deinit(self: *IO_Uring) void {
assert(self.fd >= 0);
// The mmaps depend on the fd, so the order of these calls is important:
self.cq.deinit();
self.sq.deinit();
os.close(self.fd);
self.fd = -1;
}
/// Returns a pointer to a vacant SQE, or an error if the submission queue is full.
/// We follow the implementation (and atomics) of liburing's `io_uring_get_sqe()` exactly.
/// However, instead of a null we return an error to force safe handling.
/// Any situation where the submission queue is full tends more towards a control flow error,
/// and the null return in liburing is more a C idiom than anything else, for lack of a better
/// alternative. In Zig, we have first-class error handling... so let's use it.
/// Matches the implementation of io_uring_get_sqe() in liburing.
pub fn get_sqe(self: *IO_Uring) !*io_uring_sqe {
const head = @atomicLoad(u32, self.sq.head, .Acquire);
// Remember that these head and tail offsets wrap around every four billion operations.
// We must therefore use wrapping addition and subtraction to avoid a runtime crash.
const next = self.sq.sqe_tail +% 1;
if (next -% head > self.sq.sqes.len) return error.SubmissionQueueFull;
var sqe = &self.sq.sqes[self.sq.sqe_tail & self.sq.mask];
self.sq.sqe_tail = next;
return sqe;
}
/// Submits the SQEs acquired via get_sqe() to the kernel. You can call this once after you have
/// called get_sqe() multiple times to setup multiple I/O requests.
/// Returns the number of SQEs submitted.
/// Matches the implementation of io_uring_submit() in liburing.
pub fn submit(self: *IO_Uring) !u32 {
return self.submit_and_wait(0);
}
/// Like submit(), but allows waiting for events as well.
/// Returns the number of SQEs submitted.
/// Matches the implementation of io_uring_submit_and_wait() in liburing.
pub fn submit_and_wait(self: *IO_Uring, wait_nr: u32) !u32 {
const submitted = self.flush_sq();
var flags: u32 = 0;
if (self.sq_ring_needs_enter(&flags) or wait_nr > 0) {
if (wait_nr > 0 or (self.flags & linux.IORING_SETUP_IOPOLL) != 0) {
flags |= linux.IORING_ENTER_GETEVENTS;
}
return try self.enter(submitted, wait_nr, flags);
}
return submitted;
}
/// Tell the kernel we have submitted SQEs and/or want to wait for CQEs.
/// Returns the number of SQEs submitted.
pub fn enter(self: *IO_Uring, to_submit: u32, min_complete: u32, flags: u32) !u32 {
assert(self.fd >= 0);
const res = linux.io_uring_enter(self.fd, to_submit, min_complete, flags, null);
switch (linux.getErrno(res)) {
.SUCCESS => {},
// The kernel was unable to allocate memory or ran out of resources for the request.
// The application should wait for some completions and try again:
.AGAIN => return error.SystemResources,
// The SQE `fd` is invalid, or IOSQE_FIXED_FILE was set but no files were registered:
.BADF => return error.FileDescriptorInvalid,
// The file descriptor is valid, but the ring is not in the right state.
// See io_uring_register(2) for how to enable the ring.
.BADFD => return error.FileDescriptorInBadState,
// The application attempted to overcommit the number of requests it can have pending.
// The application should wait for some completions and try again:
.BUSY => return error.CompletionQueueOvercommitted,
// The SQE is invalid, or valid but the ring was setup with IORING_SETUP_IOPOLL:
.INVAL => return error.SubmissionQueueEntryInvalid,
// The buffer is outside the process' accessible address space, or IORING_OP_READ_FIXED
// or IORING_OP_WRITE_FIXED was specified but no buffers were registered, or the range
// described by `addr` and `len` is not within the buffer registered at `buf_index`:
.FAULT => return error.BufferInvalid,
.NXIO => return error.RingShuttingDown,
// The kernel believes our `self.fd` does not refer to an io_uring instance,
// or the opcode is valid but not supported by this kernel (more likely):
.OPNOTSUPP => return error.OpcodeNotSupported,
// The operation was interrupted by a delivery of a signal before it could complete.
// This can happen while waiting for events with IORING_ENTER_GETEVENTS:
.INTR => return error.SignalInterrupt,
else => |errno| return os.unexpectedErrno(errno),
}
return @as(u32, @intCast(res));
}
/// Sync internal state with kernel ring state on the SQ side.
/// Returns the number of all pending events in the SQ ring, for the shared ring.
/// This return value includes previously flushed SQEs, as per liburing.
/// The rationale is to suggest that an io_uring_enter() call is needed rather than not.
/// Matches the implementation of __io_uring_flush_sq() in liburing.
pub fn flush_sq(self: *IO_Uring) u32 {
if (self.sq.sqe_head != self.sq.sqe_tail) {
// Fill in SQEs that we have queued up, adding them to the kernel ring.
const to_submit = self.sq.sqe_tail -% self.sq.sqe_head;
var tail = self.sq.tail.*;
var i: usize = 0;
while (i < to_submit) : (i += 1) {
self.sq.array[tail & self.sq.mask] = self.sq.sqe_head & self.sq.mask;
tail +%= 1;
self.sq.sqe_head +%= 1;
}
// Ensure that the kernel can actually see the SQE updates when it sees the tail update.
@atomicStore(u32, self.sq.tail, tail, .Release);
}
return self.sq_ready();
}
/// Returns true if we are not using an SQ thread (thus nobody submits but us),
/// or if IORING_SQ_NEED_WAKEUP is set and the SQ thread must be explicitly awakened.
/// For the latter case, we set the SQ thread wakeup flag.
/// Matches the implementation of sq_ring_needs_enter() in liburing.
pub fn sq_ring_needs_enter(self: *IO_Uring, flags: *u32) bool {
assert(flags.* == 0);
if ((self.flags & linux.IORING_SETUP_SQPOLL) == 0) return true;
if ((@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_NEED_WAKEUP) != 0) {
flags.* |= linux.IORING_ENTER_SQ_WAKEUP;
return true;
}
return false;
}
/// Returns the number of flushed and unflushed SQEs pending in the submission queue.
/// In other words, this is the number of SQEs in the submission queue, i.e. its length.
/// These are SQEs that the kernel is yet to consume.
/// Matches the implementation of io_uring_sq_ready in liburing.
pub fn sq_ready(self: *IO_Uring) u32 {
// Always use the shared ring state (i.e. head and not sqe_head) to avoid going out of sync,
// see https://github.com/axboe/liburing/issues/92.
return self.sq.sqe_tail -% @atomicLoad(u32, self.sq.head, .Acquire);
}
/// Returns the number of CQEs in the completion queue, i.e. its length.
/// These are CQEs that the application is yet to consume.
/// Matches the implementation of io_uring_cq_ready in liburing.
pub fn cq_ready(self: *IO_Uring) u32 {
return @atomicLoad(u32, self.cq.tail, .Acquire) -% self.cq.head.*;
}
/// Copies as many CQEs as are ready, and that can fit into the destination `cqes` slice.
/// If none are available, enters into the kernel to wait for at most `wait_nr` CQEs.
/// Returns the number of CQEs copied, advancing the CQ ring.
/// Provides all the wait/peek methods found in liburing, but with batching and a single method.
/// The rationale for copying CQEs rather than copying pointers is that pointers are 8 bytes
/// whereas CQEs are not much more at only 16 bytes, and this provides a safer faster interface.
/// Safer, because you no longer need to call cqe_seen(), avoiding idempotency bugs.
/// Faster, because we can now amortize the atomic store release to `cq.head` across the batch.
/// See https://github.com/axboe/liburing/issues/103#issuecomment-686665007.
/// Matches the implementation of io_uring_peek_batch_cqe() in liburing, but supports waiting.
pub fn copy_cqes(self: *IO_Uring, cqes: []io_uring_cqe, wait_nr: u32) !u32 {
const count = self.copy_cqes_ready(cqes, wait_nr);
if (count > 0) return count;
if (self.cq_ring_needs_flush() or wait_nr > 0) {
_ = try self.enter(0, wait_nr, linux.IORING_ENTER_GETEVENTS);
return self.copy_cqes_ready(cqes, wait_nr);
}
return 0;
}
fn copy_cqes_ready(self: *IO_Uring, cqes: []io_uring_cqe, wait_nr: u32) u32 {
_ = wait_nr;
const ready = self.cq_ready();
const count = std.math.min(cqes.len, ready);
var head = self.cq.head.*;
var tail = head +% count;
// TODO Optimize this by using 1 or 2 memcpy's (if the tail wraps) rather than a loop.
var i: usize = 0;
// Do not use "less-than" operator since head and tail may wrap:
while (head != tail) {
cqes[i] = self.cq.cqes[head & self.cq.mask]; // Copy struct by value.
head +%= 1;
i += 1;
}
self.cq_advance(count);
return count;
}
/// Returns a copy of an I/O completion, waiting for it if necessary, and advancing the CQ ring.
/// A convenience method for `copy_cqes()` for when you don't need to batch or peek.
pub fn copy_cqe(ring: *IO_Uring) !io_uring_cqe {
var cqes: [1]io_uring_cqe = undefined;
const count = try ring.copy_cqes(&cqes, 1);
assert(count == 1);
return cqes[0];
}
/// Matches the implementation of cq_ring_needs_flush() in liburing.
pub fn cq_ring_needs_flush(self: *IO_Uring) bool {
return (@atomicLoad(u32, self.sq.flags, .Unordered) & linux.IORING_SQ_CQ_OVERFLOW) != 0;
}
/// For advanced use cases only that implement custom completion queue methods.
/// If you use copy_cqes() or copy_cqe() you must not call cqe_seen() or cq_advance().
/// Must be called exactly once after a zero-copy CQE has been processed by your application.
/// Not idempotent, calling more than once will result in other CQEs being lost.
/// Matches the implementation of cqe_seen() in liburing.
pub fn cqe_seen(self: *IO_Uring, cqe: *io_uring_cqe) void {
_ = cqe;
self.cq_advance(1);
}
/// For advanced use cases only that implement custom completion queue methods.
/// Matches the implementation of cq_advance() in liburing.
pub fn cq_advance(self: *IO_Uring, count: u32) void {
if (count > 0) {
// Ensure the kernel only sees the new head value after the CQEs have been read.
@atomicStore(u32, self.cq.head, self.cq.head.* +% count, .Release);
}
}
/// Queues (but does not submit) an SQE to perform an `fsync(2)`.
/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
/// For example, for `fdatasync()` you can set `IORING_FSYNC_DATASYNC` in the SQE's `rw_flags`.
/// N.B. While SQEs are initiated in the order in which they appear in the submission queue,
/// operations execute in parallel and completions are unordered. Therefore, an application that
/// submits a write followed by an fsync in the submission queue cannot expect the fsync to
/// apply to the write, since the fsync may complete before the write is issued to the disk.
/// You should preferably use `link_with_next_sqe()` on a write's SQE to link it with an fsync,
/// or else insert a full write barrier using `drain_previous_sqes()` when queueing an fsync.
pub fn fsync(self: *IO_Uring, user_data: u64, fd: os.fd_t, flags: u32) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_fsync(sqe, fd, flags);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a no-op.
/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
/// A no-op is more useful than may appear at first glance.
/// For example, you could call `drain_previous_sqes()` on the returned SQE, to use the no-op to
/// know when the ring is idle before acting on a kill signal.
pub fn nop(self: *IO_Uring, user_data: u64) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_nop(sqe);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `read(2)`.
/// Returns a pointer to the SQE.
pub fn read(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
buffer: []u8,
offset: u64,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_read(sqe, fd, buffer, offset);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `write(2)`.
/// Returns a pointer to the SQE.
pub fn write(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
buffer: []const u8,
offset: u64,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_write(sqe, fd, buffer, offset);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `preadv()`.
/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
/// For example, if you want to do a `preadv2()` then set `rw_flags` on the returned SQE.
/// See https://linux.die.net/man/2/preadv.
pub fn readv(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
iovecs: []const os.iovec,
offset: u64,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_readv(sqe, fd, iovecs, offset);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a IORING_OP_READ_FIXED.
/// The `buffer` provided must be registered with the kernel by calling `register_buffers` first.
/// The `buffer_index` must be the same as its index in the array provided to `register_buffers`.
///
/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
pub fn read_fixed(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
buffer: *os.iovec,
offset: u64,
buffer_index: u16,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_read_fixed(sqe, fd, buffer, offset, buffer_index);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `pwritev()`.
/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
/// For example, if you want to do a `pwritev2()` then set `rw_flags` on the returned SQE.
/// See https://linux.die.net/man/2/pwritev.
pub fn writev(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
iovecs: []const os.iovec_const,
offset: u64,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_writev(sqe, fd, iovecs, offset);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a IORING_OP_WRITE_FIXED.
/// The `buffer` provided must be registered with the kernel by calling `register_buffers` first.
/// The `buffer_index` must be the same as its index in the array provided to `register_buffers`.
///
/// Returns a pointer to the SQE so that you can further modify the SQE for advanced use cases.
pub fn write_fixed(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
buffer: *os.iovec,
offset: u64,
buffer_index: u16,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_write_fixed(sqe, fd, buffer, offset, buffer_index);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform an `accept4(2)` on a socket.
/// Returns a pointer to the SQE.
pub fn accept(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
addr: *os.sockaddr,
addrlen: *os.socklen_t,
flags: u32,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_accept(sqe, fd, addr, addrlen, flags);
sqe.user_data = user_data;
return sqe;
}
/// Queue (but does not submit) an SQE to perform a `connect(2)` on a socket.
/// Returns a pointer to the SQE.
pub fn connect(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
addr: *const os.sockaddr,
addrlen: os.socklen_t,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_connect(sqe, fd, addr, addrlen);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `epoll_ctl(2)`.
/// Returns a pointer to the SQE.
pub fn epoll_ctl(
self: *IO_Uring,
user_data: u64,
epfd: os.fd_t,
fd: os.fd_t,
op: u32,
ev: ?*linux.epoll_event,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_epoll_ctl(sqe, epfd, fd, op, ev);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `recv(2)`.
/// Returns a pointer to the SQE.
pub fn recv(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
buffer: []u8,
flags: u32,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_recv(sqe, fd, buffer, flags);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `send(2)`.
/// Returns a pointer to the SQE.
pub fn send(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
buffer: []const u8,
flags: u32,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_send(sqe, fd, buffer, flags);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform an `openat(2)`.
/// Returns a pointer to the SQE.
pub fn openat(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
path: [*:0]const u8,
flags: u32,
mode: os.mode_t,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_openat(sqe, fd, path, flags, mode);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `close(2)`.
/// Returns a pointer to the SQE.
pub fn close(self: *IO_Uring, user_data: u64, fd: os.fd_t) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_close(sqe, fd);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to register a timeout operation.
/// Returns a pointer to the SQE.
///
/// The timeout will complete when either the timeout expires, or after the specified number of
/// events complete (if `count` is greater than `0`).
///
/// `flags` may be `0` for a relative timeout, or `IORING_TIMEOUT_ABS` for an absolute timeout.
///
/// The completion event result will be `-ETIME` if the timeout completed through expiration,
/// `0` if the timeout completed after the specified number of events, or `-ECANCELED` if the
/// timeout was removed before it expired.
///
/// io_uring timeouts use the `CLOCK.MONOTONIC` clock source.
pub fn timeout(
self: *IO_Uring,
user_data: u64,
ts: *const os.linux.kernel_timespec,
count: u32,
flags: u32,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_timeout(sqe, ts, count, flags);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to remove an existing timeout operation.
/// Returns a pointer to the SQE.
///
/// The timeout is identified by its `user_data`.
///
/// The completion event result will be `0` if the timeout was found and cancelled successfully,
/// `-EBUSY` if the timeout was found but expiration was already in progress, or
/// `-ENOENT` if the timeout was not found.
pub fn timeout_remove(
self: *IO_Uring,
user_data: u64,
timeout_user_data: u64,
flags: u32,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_timeout_remove(sqe, timeout_user_data, flags);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform a `poll(2)`.
/// Returns a pointer to the SQE.
pub fn poll_add(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
poll_mask: u32,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_poll_add(sqe, fd, poll_mask);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to remove an existing poll operation.
/// Returns a pointer to the SQE.
pub fn poll_remove(
self: *IO_Uring,
user_data: u64,
target_user_data: u64,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_poll_remove(sqe, target_user_data);
sqe.user_data = user_data;
return sqe;
}
/// Queues (but does not submit) an SQE to perform an `fallocate(2)`.
/// Returns a pointer to the SQE.
pub fn fallocate(
self: *IO_Uring,
user_data: u64,
fd: os.fd_t,
mode: i32,
offset: u64,
len: u64,
) !*io_uring_sqe {
const sqe = try self.get_sqe();
io_uring_prep_fallocate(sqe, fd, mode, offset, len);
sqe.user_data = user_data;
return sqe;
}
/// Registers an array of file descriptors.
/// Every time a file descriptor is put in an SQE and submitted to the kernel, the kernel must
/// retrieve a reference to the file, and once I/O has completed the file reference must be
/// dropped. The atomic nature of this file reference can be a slowdown for high IOPS workloads.
/// This slowdown can be avoided by pre-registering file descriptors.
/// To refer to a registered file descriptor, IOSQE_FIXED_FILE must be set in the SQE's flags,
/// and the SQE's fd must be set to the index of the file descriptor in the registered array.
/// Registering file descriptors will wait for the ring to idle.
/// Files are automatically unregistered by the kernel when the ring is torn down.
/// An application need unregister only if it wants to register a new array of file descriptors.
pub fn register_files(self: *IO_Uring, fds: []const os.fd_t) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(
self.fd,
.REGISTER_FILES,
@as(*const anyopaque, @ptrCast(fds.ptr)),
@as(u32, @intCast(fds.len)),
);
try handle_registration_result(res);
}
/// Registers the file descriptor for an eventfd that will be notified of completion events on
/// an io_uring instance.
/// Only a single a eventfd can be registered at any given point in time.
pub fn register_eventfd(self: *IO_Uring, fd: os.fd_t) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(
self.fd,
.REGISTER_EVENTFD,
@as(*const anyopaque, @ptrCast(&fd)),
1,
);
try handle_registration_result(res);
}
/// Registers the file descriptor for an eventfd that will be notified of completion events on
/// an io_uring instance. Notifications are only posted for events that complete in an async manner.
/// This means that events that complete inline while being submitted do not trigger a notification event.
/// Only a single eventfd can be registered at any given point in time.
pub fn register_eventfd_async(self: *IO_Uring, fd: os.fd_t) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(
self.fd,
.REGISTER_EVENTFD_ASYNC,
@as(*const anyopaque, @ptrCast(&fd)),
1,
);
try handle_registration_result(res);
}
/// Unregister the registered eventfd file descriptor.
pub fn unregister_eventfd(self: *IO_Uring) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(
self.fd,
.UNREGISTER_EVENTFD,
null,
0,
);
try handle_registration_result(res);
}
/// Registers an array of buffers for use with `read_fixed` and `write_fixed`.
pub fn register_buffers(self: *IO_Uring, buffers: []const os.iovec) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(
self.fd,
.REGISTER_BUFFERS,
buffers.ptr,
@as(u32, @intCast(buffers.len)),
);
try handle_registration_result(res);
}
/// Unregister the registered buffers.
pub fn unregister_buffers(self: *IO_Uring) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(self.fd, .UNREGISTER_BUFFERS, null, 0);
switch (linux.getErrno(res)) {
.SUCCESS => {},
.NXIO => return error.BuffersNotRegistered,
else => |errno| return os.unexpectedErrno(errno),
}
}
fn handle_registration_result(res: usize) !void {
switch (linux.getErrno(res)) {
.SUCCESS => {},
// One or more fds in the array are invalid, or the kernel does not support sparse sets:
.BADF => return error.FileDescriptorInvalid,
.BUSY => return error.FilesAlreadyRegistered,
.INVAL => return error.FilesEmpty,
// Adding `nr_args` file references would exceed the maximum allowed number of files the
// user is allowed to have according to the per-user RLIMIT_NOFILE resource limit and
// the CAP_SYS_RESOURCE capability is not set, or `nr_args` exceeds the maximum allowed
// for a fixed file set (older kernels have a limit of 1024 files vs 64K files):
.MFILE => return error.UserFdQuotaExceeded,
// Insufficient kernel resources, or the caller had a non-zero RLIMIT_MEMLOCK soft
// resource limit but tried to lock more memory than the limit permitted (not enforced
// when the process is privileged with CAP_IPC_LOCK):
.NOMEM => return error.SystemResources,
// Attempt to register files on a ring already registering files or being torn down:
.NXIO => return error.RingShuttingDownOrAlreadyRegisteringFiles,
else => |errno| return os.unexpectedErrno(errno),
}
}
/// Unregisters all registered file descriptors previously associated with the ring.
pub fn unregister_files(self: *IO_Uring) !void {
assert(self.fd >= 0);
const res = linux.io_uring_register(self.fd, .UNREGISTER_FILES, null, 0);
switch (linux.getErrno(res)) {
.SUCCESS => {},
.NXIO => return error.FilesNotRegistered,
else => |errno| return os.unexpectedErrno(errno),
}
}
};
pub const SubmissionQueue = struct {
head: *u32,
tail: *u32,
mask: u32,
flags: *u32,
dropped: *u32,
array: []u32,
sqes: []io_uring_sqe,
mmap: []align(mem.page_size) u8,
mmap_sqes: []align(mem.page_size) u8,
// We use `sqe_head` and `sqe_tail` in the same way as liburing:
// We increment `sqe_tail` (but not `tail`) for each call to `get_sqe()`.
// We then set `tail` to `sqe_tail` once, only when these events are actually submitted.
// This allows us to amortize the cost of the @atomicStore to `tail` across multiple SQEs.
sqe_head: u32 = 0,
sqe_tail: u32 = 0,
pub fn init(fd: os.fd_t, p: io_uring_params) !SubmissionQueue {
assert(fd >= 0);
assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0);
const size = std.math.max(
p.sq_off.array + p.sq_entries * @sizeOf(u32),
p.cq_off.cqes + p.cq_entries * @sizeOf(io_uring_cqe),
);
const mmap = try os.mmap(
null,
size,
os.PROT.READ | os.PROT.WRITE,
os.MAP.SHARED | os.MAP.POPULATE,
fd,
linux.IORING_OFF_SQ_RING,
);
errdefer os.munmap(mmap);
assert(mmap.len == size);
// The motivation for the `sqes` and `array` indirection is to make it possible for the
// application to preallocate static io_uring_sqe entries and then replay them when needed.
const size_sqes = p.sq_entries * @sizeOf(io_uring_sqe);
const mmap_sqes = try os.mmap(
null,
size_sqes,
os.PROT.READ | os.PROT.WRITE,
os.MAP.SHARED | os.MAP.POPULATE,
fd,
linux.IORING_OFF_SQES,
);
errdefer os.munmap(mmap_sqes);
assert(mmap_sqes.len == size_sqes);
const array: [*]u32 = @ptrCast(@alignCast(&mmap[p.sq_off.array]));
const sqes: [*]io_uring_sqe = @ptrCast(@alignCast(&mmap_sqes[0]));
// We expect the kernel copies p.sq_entries to the u32 pointed to by p.sq_off.ring_entries,
// see https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L7843-L7844.
assert(p.sq_entries == @as(*u32, @ptrCast(@alignCast(&mmap[p.sq_off.ring_entries]))).*);
return SubmissionQueue{
.head = @ptrCast(@alignCast(&mmap[p.sq_off.head])),
.tail = @ptrCast(@alignCast(&mmap[p.sq_off.tail])),
.mask = @as(*u32, @ptrCast(@alignCast(&mmap[p.sq_off.ring_mask]))).*,
.flags = @ptrCast(@alignCast(&mmap[p.sq_off.flags])),
.dropped = @ptrCast(@alignCast(&mmap[p.sq_off.dropped])),
.array = array[0..p.sq_entries],
.sqes = sqes[0..p.sq_entries],
.mmap = mmap,
.mmap_sqes = mmap_sqes,
};
}
pub fn deinit(self: *SubmissionQueue) void {
os.munmap(self.mmap_sqes);
os.munmap(self.mmap);
}
};
pub const CompletionQueue = struct {
head: *u32,
tail: *u32,
mask: u32,
overflow: *u32,
cqes: []io_uring_cqe,
pub fn init(fd: os.fd_t, p: io_uring_params, sq: SubmissionQueue) !CompletionQueue {
assert(fd >= 0);
assert((p.features & linux.IORING_FEAT_SINGLE_MMAP) != 0);
const mmap = sq.mmap;
const cqes: [*]io_uring_cqe = @ptrCast(@alignCast(&mmap[p.cq_off.cqes]));
assert(p.cq_entries == @as(*u32, @ptrCast(@alignCast(&mmap[p.cq_off.ring_entries]))).*);
return CompletionQueue{
.head = @ptrCast(@alignCast(&mmap[p.cq_off.head])),
.tail = @ptrCast(@alignCast(&mmap[p.cq_off.tail])),
.mask = @as(*u32, @ptrCast(@alignCast(&mmap[p.cq_off.ring_mask]))).*,
.overflow = @ptrCast(@alignCast(&mmap[p.cq_off.overflow])),
.cqes = cqes[0..p.cq_entries],
};
}
pub fn deinit(self: *CompletionQueue) void {
_ = self;
// A no-op since we now share the mmap with the submission queue.
// Here for symmetry with the submission queue, and for any future feature support.
}
};
pub fn io_uring_prep_nop(sqe: *io_uring_sqe) void {
sqe.* = .{
.opcode = .NOP,
.flags = 0,
.ioprio = 0,
.fd = 0,
.off = 0,
.addr = 0,
.len = 0,
.rw_flags = 0,
.user_data = 0,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
};
}
pub fn io_uring_prep_fsync(sqe: *io_uring_sqe, fd: os.fd_t, flags: u32) void {
sqe.* = .{
.opcode = .FSYNC,
.flags = 0,
.ioprio = 0,
.fd = fd,
.off = 0,
.addr = 0,
.len = 0,
.rw_flags = flags,
.user_data = 0,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
};
}
pub fn io_uring_prep_rw(
op: linux.IORING_OP,
sqe: *io_uring_sqe,
fd: os.fd_t,
addr: u64,
len: usize,
offset: u64,
) void {
sqe.* = .{
.opcode = op,
.flags = 0,
.ioprio = 0,
.fd = fd,
.off = offset,
.addr = addr,
.len = @as(u32, @intCast(len)),
.rw_flags = 0,
.user_data = 0,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
};
}
pub fn io_uring_prep_read(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []u8, offset: u64) void {
io_uring_prep_rw(.READ, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, offset);
}
pub fn io_uring_prep_write(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []const u8, offset: u64) void {
io_uring_prep_rw(.WRITE, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, offset);
}
pub fn io_uring_prep_readv(
sqe: *io_uring_sqe,
fd: os.fd_t,
iovecs: []const os.iovec,
offset: u64,
) void {
io_uring_prep_rw(.READV, sqe, fd, @intFromPtr(iovecs.ptr), iovecs.len, offset);
}
pub fn io_uring_prep_writev(
sqe: *io_uring_sqe,
fd: os.fd_t,
iovecs: []const os.iovec_const,
offset: u64,
) void {
io_uring_prep_rw(.WRITEV, sqe, fd, @intFromPtr(iovecs.ptr), iovecs.len, offset);
}
pub fn io_uring_prep_read_fixed(sqe: *io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void {
io_uring_prep_rw(.READ_FIXED, sqe, fd, @intFromPtr(buffer.iov_base), buffer.iov_len, offset);
sqe.buf_index = buffer_index;
}
pub fn io_uring_prep_write_fixed(sqe: *io_uring_sqe, fd: os.fd_t, buffer: *os.iovec, offset: u64, buffer_index: u16) void {
io_uring_prep_rw(.WRITE_FIXED, sqe, fd, @intFromPtr(buffer.iov_base), buffer.iov_len, offset);
sqe.buf_index = buffer_index;
}
pub fn io_uring_prep_accept(
sqe: *io_uring_sqe,
fd: os.fd_t,
addr: *os.sockaddr,
addrlen: *os.socklen_t,
flags: u32,
) void {
// `addr` holds a pointer to `sockaddr`, and `addr2` holds a pointer to socklen_t`.
// `addr2` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32).
io_uring_prep_rw(.ACCEPT, sqe, fd, @intFromPtr(addr), 0, @intFromPtr(addrlen));
sqe.rw_flags = flags;
}
pub fn io_uring_prep_connect(
sqe: *io_uring_sqe,
fd: os.fd_t,
addr: *const os.sockaddr,
addrlen: os.socklen_t,
) void {
// `addrlen` maps to `sqe.off` (u64) instead of `sqe.len` (which is only a u32).
io_uring_prep_rw(.CONNECT, sqe, fd, @intFromPtr(addr), 0, addrlen);
}
pub fn io_uring_prep_epoll_ctl(
sqe: *io_uring_sqe,
epfd: os.fd_t,
fd: os.fd_t,
op: u32,
ev: ?*linux.epoll_event,
) void {
io_uring_prep_rw(.EPOLL_CTL, sqe, epfd, @intFromPtr(ev), op, @as(u64, @intCast(fd)));
}
pub fn io_uring_prep_recv(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []u8, flags: u32) void {
io_uring_prep_rw(.RECV, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, 0);
sqe.rw_flags = flags;
}
pub fn io_uring_prep_send(sqe: *io_uring_sqe, fd: os.fd_t, buffer: []const u8, flags: u32) void {
io_uring_prep_rw(.SEND, sqe, fd, @intFromPtr(buffer.ptr), buffer.len, 0);
sqe.rw_flags = flags;
}
pub fn io_uring_prep_openat(
sqe: *io_uring_sqe,
fd: os.fd_t,
path: [*:0]const u8,
flags: u32,
mode: os.mode_t,
) void {
io_uring_prep_rw(.OPENAT, sqe, fd, @intFromPtr(path), mode, 0);
sqe.rw_flags = flags;
}
pub fn io_uring_prep_close(sqe: *io_uring_sqe, fd: os.fd_t) void {
sqe.* = .{
.opcode = .CLOSE,
.flags = 0,
.ioprio = 0,
.fd = fd,
.off = 0,
.addr = 0,
.len = 0,
.rw_flags = 0,
.user_data = 0,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
};
}
pub fn io_uring_prep_timeout(
sqe: *io_uring_sqe,
ts: *const os.linux.kernel_timespec,
count: u32,
flags: u32,
) void {
io_uring_prep_rw(.TIMEOUT, sqe, -1, @intFromPtr(ts), 1, count);
sqe.rw_flags = flags;
}
pub fn io_uring_prep_timeout_remove(sqe: *io_uring_sqe, timeout_user_data: u64, flags: u32) void {
sqe.* = .{
.opcode = .TIMEOUT_REMOVE,
.flags = 0,
.ioprio = 0,
.fd = -1,
.off = 0,
.addr = timeout_user_data,
.len = 0,
.rw_flags = flags,
.user_data = 0,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
};
}
pub fn io_uring_prep_poll_add(
sqe: *io_uring_sqe,
fd: os.fd_t,
poll_mask: u32,
) void {
io_uring_prep_rw(.POLL_ADD, sqe, fd, @intFromPtr(@as(?*anyopaque, null)), 0, 0);
sqe.rw_flags = std.mem.nativeToLittle(u32, poll_mask);
}
pub fn io_uring_prep_poll_remove(
sqe: *io_uring_sqe,
target_user_data: u64,
) void {
io_uring_prep_rw(.POLL_REMOVE, sqe, -1, target_user_data, 0, 0);
}
pub fn io_uring_prep_fallocate(
sqe: *io_uring_sqe,
fd: os.fd_t,
mode: i32,
offset: u64,
len: u64,
) void {
sqe.* = .{
.opcode = .FALLOCATE,
.flags = 0,
.ioprio = 0,
.fd = fd,
.off = offset,
.addr = len,
.len = @as(u32, @intCast(mode)),
.rw_flags = 0,
.user_data = 0,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
};
}
test "structs/offsets/entries" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
try testing.expectEqual(@as(usize, 120), @sizeOf(io_uring_params));
try testing.expectEqual(@as(usize, 64), @sizeOf(io_uring_sqe));
try testing.expectEqual(@as(usize, 16), @sizeOf(io_uring_cqe));
try testing.expectEqual(0, linux.IORING_OFF_SQ_RING);
try testing.expectEqual(0x8000000, linux.IORING_OFF_CQ_RING);
try testing.expectEqual(0x10000000, linux.IORING_OFF_SQES);
try testing.expectError(error.EntriesZero, IO_Uring.init(0, 0));
try testing.expectError(error.EntriesNotPowerOfTwo, IO_Uring.init(3, 0));
}
test "nop" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer {
ring.deinit();
testing.expectEqual(@as(os.fd_t, -1), ring.fd) catch @panic("test failed");
}
const sqe = try ring.nop(0xaaaaaaaa);
try testing.expectEqual(io_uring_sqe{
.opcode = .NOP,
.flags = 0,
.ioprio = 0,
.fd = 0,
.off = 0,
.addr = 0,
.len = 0,
.rw_flags = 0,
.user_data = 0xaaaaaaaa,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
}, sqe.*);
try testing.expectEqual(@as(u32, 0), ring.sq.sqe_head);
try testing.expectEqual(@as(u32, 1), ring.sq.sqe_tail);
try testing.expectEqual(@as(u32, 0), ring.sq.tail.*);
try testing.expectEqual(@as(u32, 0), ring.cq.head.*);
try testing.expectEqual(@as(u32, 1), ring.sq_ready());
try testing.expectEqual(@as(u32, 0), ring.cq_ready());
try testing.expectEqual(@as(u32, 1), try ring.submit());
try testing.expectEqual(@as(u32, 1), ring.sq.sqe_head);
try testing.expectEqual(@as(u32, 1), ring.sq.sqe_tail);
try testing.expectEqual(@as(u32, 1), ring.sq.tail.*);
try testing.expectEqual(@as(u32, 0), ring.cq.head.*);
try testing.expectEqual(@as(u32, 0), ring.sq_ready());
try testing.expectEqual(io_uring_cqe{
.user_data = 0xaaaaaaaa,
.res = 0,
.flags = 0,
}, try ring.copy_cqe());
try testing.expectEqual(@as(u32, 1), ring.cq.head.*);
try testing.expectEqual(@as(u32, 0), ring.cq_ready());
const sqe_barrier = try ring.nop(0xbbbbbbbb);
sqe_barrier.flags |= linux.IOSQE_IO_DRAIN;
try testing.expectEqual(@as(u32, 1), try ring.submit());
try testing.expectEqual(io_uring_cqe{
.user_data = 0xbbbbbbbb,
.res = 0,
.flags = 0,
}, try ring.copy_cqe());
try testing.expectEqual(@as(u32, 2), ring.sq.sqe_head);
try testing.expectEqual(@as(u32, 2), ring.sq.sqe_tail);
try testing.expectEqual(@as(u32, 2), ring.sq.tail.*);
try testing.expectEqual(@as(u32, 2), ring.cq.head.*);
}
test "readv" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const fd = try os.openZ("/dev/zero", os.O.RDONLY | os.O.CLOEXEC, 0);
defer os.close(fd);
// Linux Kernel 5.4 supports IORING_REGISTER_FILES but not sparse fd sets (i.e. an fd of -1).
// Linux Kernel 5.5 adds support for sparse fd sets.
// Compare:
// https://github.com/torvalds/linux/blob/v5.4/fs/io_uring.c#L3119-L3124 vs
// https://github.com/torvalds/linux/blob/v5.8/fs/io_uring.c#L6687-L6691
// We therefore avoid stressing sparse fd sets here:
var registered_fds = [_]os.fd_t{0} ** 1;
const fd_index = 0;
registered_fds[fd_index] = fd;
try ring.register_files(registered_fds[0..]);
var buffer = [_]u8{42} ** 128;
var iovecs = [_]os.iovec{os.iovec{ .iov_base = &buffer, .iov_len = buffer.len }};
const sqe = try ring.readv(0xcccccccc, fd_index, iovecs[0..], 0);
try testing.expectEqual(linux.IORING_OP.READV, sqe.opcode);
sqe.flags |= linux.IOSQE_FIXED_FILE;
try testing.expectError(error.SubmissionQueueFull, ring.nop(0));
try testing.expectEqual(@as(u32, 1), try ring.submit());
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xcccccccc,
.res = buffer.len,
.flags = 0,
}, try ring.copy_cqe());
try testing.expectEqualSlices(u8, &([_]u8{0} ** buffer.len), buffer[0..]);
try ring.unregister_files();
}
test "writev/fsync/readv" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(4, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const path = "test_io_uring_writev_fsync_readv";
const file = try std.fs.cwd().createFile(path, .{ .read = true, .truncate = true });
defer file.close();
defer std.fs.cwd().deleteFile(path) catch {};
const fd = file.handle;
const buffer_write = [_]u8{42} ** 128;
const iovecs_write = [_]os.iovec_const{
os.iovec_const{ .iov_base = &buffer_write, .iov_len = buffer_write.len },
};
var buffer_read = [_]u8{0} ** 128;
var iovecs_read = [_]os.iovec{
os.iovec{ .iov_base = &buffer_read, .iov_len = buffer_read.len },
};
const sqe_writev = try ring.writev(0xdddddddd, fd, iovecs_write[0..], 17);
try testing.expectEqual(linux.IORING_OP.WRITEV, sqe_writev.opcode);
try testing.expectEqual(@as(u64, 17), sqe_writev.off);
sqe_writev.flags |= linux.IOSQE_IO_LINK;
const sqe_fsync = try ring.fsync(0xeeeeeeee, fd, 0);
try testing.expectEqual(linux.IORING_OP.FSYNC, sqe_fsync.opcode);
try testing.expectEqual(fd, sqe_fsync.fd);
sqe_fsync.flags |= linux.IOSQE_IO_LINK;
const sqe_readv = try ring.readv(0xffffffff, fd, iovecs_read[0..], 17);
try testing.expectEqual(linux.IORING_OP.READV, sqe_readv.opcode);
try testing.expectEqual(@as(u64, 17), sqe_readv.off);
try testing.expectEqual(@as(u32, 3), ring.sq_ready());
try testing.expectEqual(@as(u32, 3), try ring.submit_and_wait(3));
try testing.expectEqual(@as(u32, 0), ring.sq_ready());
try testing.expectEqual(@as(u32, 3), ring.cq_ready());
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xdddddddd,
.res = buffer_write.len,
.flags = 0,
}, try ring.copy_cqe());
try testing.expectEqual(@as(u32, 2), ring.cq_ready());
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xeeeeeeee,
.res = 0,
.flags = 0,
}, try ring.copy_cqe());
try testing.expectEqual(@as(u32, 1), ring.cq_ready());
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xffffffff,
.res = buffer_read.len,
.flags = 0,
}, try ring.copy_cqe());
try testing.expectEqual(@as(u32, 0), ring.cq_ready());
try testing.expectEqualSlices(u8, buffer_write[0..], buffer_read[0..]);
}
test "write/read" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const path = "test_io_uring_write_read";
const file = try std.fs.cwd().createFile(path, .{ .read = true, .truncate = true });
defer file.close();
defer std.fs.cwd().deleteFile(path) catch {};
const fd = file.handle;
const buffer_write = [_]u8{97} ** 20;
var buffer_read = [_]u8{98} ** 20;
const sqe_write = try ring.write(0x11111111, fd, buffer_write[0..], 10);
try testing.expectEqual(linux.IORING_OP.WRITE, sqe_write.opcode);
try testing.expectEqual(@as(u64, 10), sqe_write.off);
sqe_write.flags |= linux.IOSQE_IO_LINK;
const sqe_read = try ring.read(0x22222222, fd, buffer_read[0..], 10);
try testing.expectEqual(linux.IORING_OP.READ, sqe_read.opcode);
try testing.expectEqual(@as(u64, 10), sqe_read.off);
try testing.expectEqual(@as(u32, 2), try ring.submit());
const cqe_write = try ring.copy_cqe();
const cqe_read = try ring.copy_cqe();
// Prior to Linux Kernel 5.6 this is the only way to test for read/write support:
// https://lwn.net/Articles/809820/
if (cqe_write.err() == .INVAL) return error.SkipZigTest;
if (cqe_read.err() == .INVAL) return error.SkipZigTest;
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x11111111,
.res = buffer_write.len,
.flags = 0,
}, cqe_write);
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x22222222,
.res = buffer_read.len,
.flags = 0,
}, cqe_read);
try testing.expectEqualSlices(u8, buffer_write[0..], buffer_read[0..]);
}
test "write_fixed/read_fixed" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const path = "test_io_uring_write_read_fixed";
const file = try std.fs.cwd().createFile(path, .{ .read = true, .truncate = true });
defer file.close();
defer std.fs.cwd().deleteFile(path) catch {};
const fd = file.handle;
var raw_buffers: [2][11]u8 = undefined;
// First buffer will be written to the file.
std.mem.set(u8, &raw_buffers[0], 'z');
std.mem.copy(u8, &raw_buffers[0], "foobar");
var buffers = [2]os.iovec{
.{ .iov_base = &raw_buffers[0], .iov_len = raw_buffers[0].len },
.{ .iov_base = &raw_buffers[1], .iov_len = raw_buffers[1].len },
};
try ring.register_buffers(&buffers);
const sqe_write = try ring.write_fixed(0x45454545, fd, &buffers[0], 3, 0);
try testing.expectEqual(linux.IORING_OP.WRITE_FIXED, sqe_write.opcode);
try testing.expectEqual(@as(u64, 3), sqe_write.off);
sqe_write.flags |= linux.IOSQE_IO_LINK;
const sqe_read = try ring.read_fixed(0x12121212, fd, &buffers[1], 0, 1);
try testing.expectEqual(linux.IORING_OP.READ_FIXED, sqe_read.opcode);
try testing.expectEqual(@as(u64, 0), sqe_read.off);
try testing.expectEqual(@as(u32, 2), try ring.submit());
const cqe_write = try ring.copy_cqe();
const cqe_read = try ring.copy_cqe();
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x45454545,
.res = @as(i32, @intCast(buffers[0].iov_len)),
.flags = 0,
}, cqe_write);
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x12121212,
.res = @as(i32, @intCast(buffers[1].iov_len)),
.flags = 0,
}, cqe_read);
try testing.expectEqualSlices(u8, "\x00\x00\x00", buffers[1].iov_base[0..3]);
try testing.expectEqualSlices(u8, "foobar", buffers[1].iov_base[3..9]);
try testing.expectEqualSlices(u8, "zz", buffers[1].iov_base[9..11]);
}
test "openat" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const path = "test_io_uring_openat";
defer std.fs.cwd().deleteFile(path) catch {};
const flags: u32 = os.O.CLOEXEC | os.O.RDWR | os.O.CREAT;
const mode: os.mode_t = 0o666;
const sqe_openat = try ring.openat(0x33333333, linux.AT.FDCWD, path, flags, mode);
try testing.expectEqual(io_uring_sqe{
.opcode = .OPENAT,
.flags = 0,
.ioprio = 0,
.fd = linux.AT.FDCWD,
.off = 0,
.addr = @intFromPtr(path),
.len = mode,
.rw_flags = flags,
.user_data = 0x33333333,
.buf_index = 0,
.personality = 0,
.splice_fd_in = 0,
.__pad2 = [2]u64{ 0, 0 },
}, sqe_openat.*);
try testing.expectEqual(@as(u32, 1), try ring.submit());
const cqe_openat = try ring.copy_cqe();
try testing.expectEqual(@as(u64, 0x33333333), cqe_openat.user_data);
if (cqe_openat.err() == .INVAL) return error.SkipZigTest;
// AT.FDCWD is not fully supported before kernel 5.6:
// See https://lore.kernel.org/io-uring/[email protected]/T/
// We use IORING_FEAT_RW_CUR_POS to know if we are pre-5.6 since that feature was added in 5.6.
if (cqe_openat.err() == .BADF and (ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0) {
return error.SkipZigTest;
}
if (cqe_openat.res <= 0) std.debug.print("\ncqe_openat.res={}\n", .{cqe_openat.res});
try testing.expect(cqe_openat.res > 0);
try testing.expectEqual(@as(u32, 0), cqe_openat.flags);
os.close(cqe_openat.res);
}
test "close" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const path = "test_io_uring_close";
const file = try std.fs.cwd().createFile(path, .{});
errdefer file.close();
defer std.fs.cwd().deleteFile(path) catch {};
const sqe_close = try ring.close(0x44444444, file.handle);
try testing.expectEqual(linux.IORING_OP.CLOSE, sqe_close.opcode);
try testing.expectEqual(file.handle, sqe_close.fd);
try testing.expectEqual(@as(u32, 1), try ring.submit());
const cqe_close = try ring.copy_cqe();
if (cqe_close.err() == .INVAL) return error.SkipZigTest;
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x44444444,
.res = 0,
.flags = 0,
}, cqe_close);
}
test "accept/connect/send/recv" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(16, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const address = try net.Address.parseIp4("127.0.0.1", 3131);
const kernel_backlog = 1;
const server = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0);
defer os.close(server);
try os.setsockopt(server, os.SOL.SOCKET, os.SO.REUSEADDR, &mem.toBytes(@as(c_int, 1)));
try os.bind(server, &address.any, address.getOsSockLen());
try os.listen(server, kernel_backlog);
const buffer_send = [_]u8{ 1, 0, 1, 0, 1, 0, 1, 0, 1, 0 };
var buffer_recv = [_]u8{ 0, 1, 0, 1, 0 };
var accept_addr: os.sockaddr = undefined;
var accept_addr_len: os.socklen_t = @sizeOf(@TypeOf(accept_addr));
_ = try ring.accept(0xaaaaaaaa, server, &accept_addr, &accept_addr_len, 0);
try testing.expectEqual(@as(u32, 1), try ring.submit());
const client = try os.socket(address.any.family, os.SOCK.STREAM | os.SOCK.CLOEXEC, 0);
defer os.close(client);
_ = try ring.connect(0xcccccccc, client, &address.any, address.getOsSockLen());
try testing.expectEqual(@as(u32, 1), try ring.submit());
var cqe_accept = try ring.copy_cqe();
if (cqe_accept.err() == .INVAL) return error.SkipZigTest;
var cqe_connect = try ring.copy_cqe();
if (cqe_connect.err() == .INVAL) return error.SkipZigTest;
// The accept/connect CQEs may arrive in any order, the connect CQE will sometimes come first:
if (cqe_accept.user_data == 0xcccccccc and cqe_connect.user_data == 0xaaaaaaaa) {
const a = cqe_accept;
const b = cqe_connect;
cqe_accept = b;
cqe_connect = a;
}
try testing.expectEqual(@as(u64, 0xaaaaaaaa), cqe_accept.user_data);
if (cqe_accept.res <= 0) std.debug.print("\ncqe_accept.res={}\n", .{cqe_accept.res});
try testing.expect(cqe_accept.res > 0);
try testing.expectEqual(@as(u32, 0), cqe_accept.flags);
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xcccccccc,
.res = 0,
.flags = 0,
}, cqe_connect);
const send = try ring.send(0xeeeeeeee, client, buffer_send[0..], 0);
send.flags |= linux.IOSQE_IO_LINK;
_ = try ring.recv(0xffffffff, cqe_accept.res, buffer_recv[0..], 0);
try testing.expectEqual(@as(u32, 2), try ring.submit());
const cqe_send = try ring.copy_cqe();
if (cqe_send.err() == .INVAL) return error.SkipZigTest;
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xeeeeeeee,
.res = buffer_send.len,
.flags = 0,
}, cqe_send);
const cqe_recv = try ring.copy_cqe();
if (cqe_recv.err() == .INVAL) return error.SkipZigTest;
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xffffffff,
.res = buffer_recv.len,
.flags = 0,
}, cqe_recv);
try testing.expectEqualSlices(u8, buffer_send[0..buffer_recv.len], buffer_recv[0..]);
}
test "timeout (after a relative time)" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const ms = 10;
const margin = 5;
const ts = os.linux.kernel_timespec{ .tv_sec = 0, .tv_nsec = ms * 1000000 };
const started = std.time.milliTimestamp();
const sqe = try ring.timeout(0x55555555, &ts, 0, 0);
try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe.opcode);
try testing.expectEqual(@as(u32, 1), try ring.submit());
const cqe = try ring.copy_cqe();
const stopped = std.time.milliTimestamp();
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x55555555,
.res = -@as(i32, @intFromEnum(linux.E.TIME)),
.flags = 0,
}, cqe);
// Tests should not depend on timings: skip test if outside margin.
if (!std.math.approxEqAbs(f64, ms, @as(f64, @floatFromInt(stopped - started)), margin)) return error.SkipZigTest;
}
test "timeout (after a number of completions)" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const ts = os.linux.kernel_timespec{ .tv_sec = 3, .tv_nsec = 0 };
const count_completions: u64 = 1;
const sqe_timeout = try ring.timeout(0x66666666, &ts, count_completions, 0);
try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe_timeout.opcode);
try testing.expectEqual(count_completions, sqe_timeout.off);
_ = try ring.nop(0x77777777);
try testing.expectEqual(@as(u32, 2), try ring.submit());
const cqe_nop = try ring.copy_cqe();
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x77777777,
.res = 0,
.flags = 0,
}, cqe_nop);
const cqe_timeout = try ring.copy_cqe();
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x66666666,
.res = 0,
.flags = 0,
}, cqe_timeout);
}
test "timeout_remove" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(2, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const ts = os.linux.kernel_timespec{ .tv_sec = 3, .tv_nsec = 0 };
const sqe_timeout = try ring.timeout(0x88888888, &ts, 0, 0);
try testing.expectEqual(linux.IORING_OP.TIMEOUT, sqe_timeout.opcode);
try testing.expectEqual(@as(u64, 0x88888888), sqe_timeout.user_data);
const sqe_timeout_remove = try ring.timeout_remove(0x99999999, 0x88888888, 0);
try testing.expectEqual(linux.IORING_OP.TIMEOUT_REMOVE, sqe_timeout_remove.opcode);
try testing.expectEqual(@as(u64, 0x88888888), sqe_timeout_remove.addr);
try testing.expectEqual(@as(u64, 0x99999999), sqe_timeout_remove.user_data);
try testing.expectEqual(@as(u32, 2), try ring.submit());
const cqe_timeout = try ring.copy_cqe();
// IORING_OP_TIMEOUT_REMOVE is not supported by this kernel version:
// Timeout remove operations set the fd to -1, which results in EBADF before EINVAL.
// We use IORING_FEAT_RW_CUR_POS as a safety check here to make sure we are at least pre-5.6.
// We don't want to skip this test for newer kernels.
if (cqe_timeout.user_data == 0x99999999 and
cqe_timeout.err() == .BADF and
(ring.features & linux.IORING_FEAT_RW_CUR_POS) == 0)
{
return error.SkipZigTest;
}
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x88888888,
.res = -@as(i32, @intFromEnum(linux.E.CANCELED)),
.flags = 0,
}, cqe_timeout);
const cqe_timeout_remove = try ring.copy_cqe();
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0x99999999,
.res = 0,
.flags = 0,
}, cqe_timeout_remove);
}
test "fallocate" {
if (builtin.os.tag != .linux) return error.SkipZigTest;
var ring = IO_Uring.init(1, 0) catch |err| switch (err) {
error.SystemOutdated => return error.SkipZigTest,
error.PermissionDenied => return error.SkipZigTest,
else => return err,
};
defer ring.deinit();
const path = "test_io_uring_fallocate";
const file = try std.fs.cwd().createFile(path, .{ .truncate = true, .mode = 0o666 });
defer file.close();
defer std.fs.cwd().deleteFile(path) catch {};
try testing.expectEqual(@as(u64, 0), (try file.stat()).size);
const len: u64 = 65536;
const sqe = try ring.fallocate(0xaaaaaaaa, file.handle, 0, 0, len);
try testing.expectEqual(linux.IORING_OP.FALLOCATE, sqe.opcode);
try testing.expectEqual(file.handle, sqe.fd);
try testing.expectEqual(@as(u32, 1), try ring.submit());
const cqe = try ring.copy_cqe();
switch (cqe.err()) {
.SUCCESS => {},
// This kernel's io_uring does not yet implement fallocate():
.INVAL => return error.SkipZigTest,
// This kernel does not implement fallocate():
.NOSYS => return error.SkipZigTest,
// The filesystem containing the file referred to by fd does not support this operation;
// or the mode is not supported by the filesystem containing the file referred to by fd:
.OPNOTSUPP => return error.SkipZigTest,
else => |errno| std.debug.panic("unhandled errno: {}", .{errno}),
}
try testing.expectEqual(linux.io_uring_cqe{
.user_data = 0xaaaaaaaa,
.res = 0,
.flags = 0,
}, cqe);
try testing.expectEqual(len, (try file.stat()).size);
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/bpf/kern.zig | const std = @import("../../../std.zig");
const builtin = @import("builtin");
const in_bpf_program = switch (builtin.cpu.arch) {
.bpfel, .bpfeb => true,
else => false,
};
pub const helpers = if (in_bpf_program) @import("helpers.zig") else struct {};
pub const BpfSock = opaque {};
pub const BpfSockAddr = opaque {};
pub const FibLookup = opaque {};
pub const MapDef = opaque {};
pub const PerfEventData = opaque {};
pub const PerfEventValue = opaque {};
pub const PidNsInfo = opaque {};
pub const SeqFile = opaque {};
pub const SkBuff = opaque {};
pub const SkMsgMd = opaque {};
pub const SkReusePortMd = opaque {};
pub const Sock = opaque {};
pub const SockAddr = opaque {};
pub const SockOps = opaque {};
pub const SockTuple = opaque {};
pub const SpinLock = opaque {};
pub const SysCtl = opaque {};
pub const Tcp6Sock = opaque {};
pub const TcpRequestSock = opaque {};
pub const TcpSock = opaque {};
pub const TcpTimewaitSock = opaque {};
pub const TunnelKey = opaque {};
pub const Udp6Sock = opaque {};
pub const XdpMd = opaque {};
pub const XfrmState = opaque {};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/bpf/btf_ext.zig | pub const Header = packed struct {
magic: u16,
version: u8,
flags: u8,
hdr_len: u32,
/// All offsets are in bytes relative to the end of this header
func_info_off: u32,
func_info_len: u32,
line_info_off: u32,
line_info_len: u32,
};
pub const InfoSec = packed struct {
sec_name_off: u32,
num_info: u32,
// TODO: communicate that there is data here
//data: [0]u8,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/bpf/btf.zig | const std = @import("../../../std.zig");
const magic = 0xeb9f;
const version = 1;
pub const ext = @import("btf_ext.zig");
/// All offsets are in bytes relative to the end of this header
pub const Header = packed struct {
magic: u16,
version: u8,
flags: u8,
hdr_len: u32,
/// offset of type section
type_off: u32,
/// length of type section
type_len: u32,
/// offset of string section
str_off: u32,
/// length of string section
str_len: u32,
};
/// Max number of type identifiers
pub const max_type = 0xfffff;
/// Max offset into string section
pub const max_name_offset = 0xffffff;
/// Max number of struct/union/enum member of func args
pub const max_vlen = 0xffff;
pub const Type = packed struct {
name_off: u32,
info: packed struct {
/// number of struct's members
vlen: u16,
unused_1: u8,
kind: Kind,
unused_2: u3,
/// used by Struct, Union, and Fwd
kind_flag: bool,
},
/// size is used by Int, Enum, Struct, Union, and DataSec, it tells the size
/// of the type it is describing
///
/// type is used by Ptr, Typedef, Volatile, Const, Restrict, Func,
/// FuncProto, and Var. It is a type_id referring to another type
size_type: union { size: u32, typ: u32 },
};
/// For some kinds, Type is immediately followed by extra data
pub const Kind = enum(u4) {
unknown,
int,
ptr,
array,
structure,
kind_union,
enumeration,
fwd,
typedef,
kind_volatile,
constant,
restrict,
func,
funcProto,
variable,
dataSec,
};
/// Int kind is followed by this struct
pub const IntInfo = packed struct {
bits: u8,
unused: u8,
offset: u8,
encoding: enum(u4) {
signed = 1 << 0,
char = 1 << 1,
boolean = 1 << 2,
},
};
test "IntInfo is 32 bits" {
try std.testing.expectEqual(@bitSizeOf(IntInfo), 32);
}
/// Enum kind is followed by this struct
pub const Enum = packed struct {
name_off: u32,
val: i32,
};
/// Array kind is followd by this struct
pub const Array = packed struct {
typ: u32,
index_type: u32,
nelems: u32,
};
/// Struct and Union kinds are followed by multiple Member structs. The exact
/// number is stored in vlen
pub const Member = packed struct {
name_off: u32,
typ: u32,
/// if the kind_flag is set, offset contains both member bitfield size and
/// bit offset, the bitfield size is set for bitfield members. If the type
/// info kind_flag is not set, the offset contains only bit offset
offset: packed struct {
bit: u24,
bitfield_size: u8,
},
};
/// FuncProto is followed by multiple Params, the exact number is stored in vlen
pub const Param = packed struct {
name_off: u32,
typ: u32,
};
pub const VarLinkage = enum {
static,
global_allocated,
global_extern,
};
pub const FuncLinkage = enum {
static,
global,
external,
};
/// Var kind is followd by a single Var struct to describe additional
/// information related to the variable such as its linkage
pub const Var = packed struct {
linkage: u32,
};
/// Datasec kind is followed by multible VarSecInfo to describe all Var kind
/// types it contains along with it's in-section offset as well as size.
pub const VarSecInfo = packed struct {
typ: u32,
offset: u32,
size: u32,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/bpf/helpers.zig | const std = @import("../../../std.zig");
const kern = @import("kern.zig");
const PtRegs = @compileError("TODO missing os bits: PtRegs");
const TcpHdr = @compileError("TODO missing os bits: TcpHdr");
const SkFullSock = @compileError("TODO missing os bits: SkFullSock");
// in BPF, all the helper calls
// TODO: when https://github.com/ziglang/zig/issues/1717 is here, make a nice
// function that uses the Helper enum
//
// Note, these function signatures were created from documentation found in
// '/usr/include/linux/bpf.h'
pub const map_lookup_elem = @as(fn (map: *const kern.MapDef, key: ?*const anyopaque) ?*anyopaque, @ptrFromInt(1));
pub const map_update_elem = @as(fn (map: *const kern.MapDef, key: ?*const anyopaque, value: ?*const anyopaque, flags: u64) c_long, @ptrFromInt(2));
pub const map_delete_elem = @as(fn (map: *const kern.MapDef, key: ?*const anyopaque) c_long, @ptrFromInt(3));
pub const probe_read = @as(fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, @ptrFromInt(4));
pub const ktime_get_ns = @as(fn () u64, @ptrFromInt(5));
pub const trace_printk = @as(fn (fmt: [*:0]const u8, fmt_size: u32, arg1: u64, arg2: u64, arg3: u64) c_long, @ptrFromInt(6));
pub const get_prandom_u32 = @as(fn () u32, @ptrFromInt(7));
pub const get_smp_processor_id = @as(fn () u32, @ptrFromInt(8));
pub const skb_store_bytes = @as(fn (skb: *kern.SkBuff, offset: u32, from: ?*const anyopaque, len: u32, flags: u64) c_long, @ptrFromInt(9));
pub const l3_csum_replace = @as(fn (skb: *kern.SkBuff, offset: u32, from: u64, to: u64, size: u64) c_long, @ptrFromInt(10));
pub const l4_csum_replace = @as(fn (skb: *kern.SkBuff, offset: u32, from: u64, to: u64, flags: u64) c_long, @ptrFromInt(11));
pub const tail_call = @as(fn (ctx: ?*anyopaque, prog_array_map: *const kern.MapDef, index: u32) c_long, @ptrFromInt(12));
pub const clone_redirect = @as(fn (skb: *kern.SkBuff, ifindex: u32, flags: u64) c_long, @ptrFromInt(13));
pub const get_current_pid_tgid = @as(fn () u64, @ptrFromInt(14));
pub const get_current_uid_gid = @as(fn () u64, @ptrFromInt(15));
pub const get_current_comm = @as(fn (buf: ?*anyopaque, size_of_buf: u32) c_long, @ptrFromInt(16));
pub const get_cgroup_classid = @as(fn (skb: *kern.SkBuff) u32, @ptrFromInt(17));
// Note vlan_proto is big endian
pub const skb_vlan_push = @as(fn (skb: *kern.SkBuff, vlan_proto: u16, vlan_tci: u16) c_long, @ptrFromInt(18));
pub const skb_vlan_pop = @as(fn (skb: *kern.SkBuff) c_long, @ptrFromInt(19));
pub const skb_get_tunnel_key = @as(fn (skb: *kern.SkBuff, key: *kern.TunnelKey, size: u32, flags: u64) c_long, @ptrFromInt(20));
pub const skb_set_tunnel_key = @as(fn (skb: *kern.SkBuff, key: *kern.TunnelKey, size: u32, flags: u64) c_long, @ptrFromInt(21));
pub const perf_event_read = @as(fn (map: *const kern.MapDef, flags: u64) u64, @ptrFromInt(22));
pub const redirect = @as(fn (ifindex: u32, flags: u64) c_long, @ptrFromInt(23));
pub const get_route_realm = @as(fn (skb: *kern.SkBuff) u32, @ptrFromInt(24));
pub const perf_event_output = @as(fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, @ptrFromInt(25));
pub const skb_load_bytes = @as(fn (skb: ?*anyopaque, offset: u32, to: ?*anyopaque, len: u32) c_long, @ptrFromInt(26));
pub const get_stackid = @as(fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64) c_long, @ptrFromInt(27));
// from and to point to __be32
pub const csum_diff = @as(fn (from: *u32, from_size: u32, to: *u32, to_size: u32, seed: u32) i64, @ptrFromInt(28));
pub const skb_get_tunnel_opt = @as(fn (skb: *kern.SkBuff, opt: ?*anyopaque, size: u32) c_long, @ptrFromInt(29));
pub const skb_set_tunnel_opt = @as(fn (skb: *kern.SkBuff, opt: ?*anyopaque, size: u32) c_long, @ptrFromInt(30));
// proto is __be16
pub const skb_change_proto = @as(fn (skb: *kern.SkBuff, proto: u16, flags: u64) c_long, @ptrFromInt(31));
pub const skb_change_type = @as(fn (skb: *kern.SkBuff, skb_type: u32) c_long, @ptrFromInt(32));
pub const skb_under_cgroup = @as(fn (skb: *kern.SkBuff, map: ?*const anyopaque, index: u32) c_long, @ptrFromInt(33));
pub const get_hash_recalc = @as(fn (skb: *kern.SkBuff) u32, @ptrFromInt(34));
pub const get_current_task = @as(fn () u64, @ptrFromInt(35));
pub const probe_write_user = @as(fn (dst: ?*anyopaque, src: ?*const anyopaque, len: u32) c_long, @ptrFromInt(36));
pub const current_task_under_cgroup = @as(fn (map: *const kern.MapDef, index: u32) c_long, @ptrFromInt(37));
pub const skb_change_tail = @as(fn (skb: *kern.SkBuff, len: u32, flags: u64) c_long, @ptrFromInt(38));
pub const skb_pull_data = @as(fn (skb: *kern.SkBuff, len: u32) c_long, @ptrFromInt(39));
pub const csum_update = @as(fn (skb: *kern.SkBuff, csum: u32) i64, @ptrFromInt(40));
pub const set_hash_invalid = @as(fn (skb: *kern.SkBuff) void, @ptrFromInt(41));
pub const get_numa_node_id = @as(fn () c_long, @ptrFromInt(42));
pub const skb_change_head = @as(fn (skb: *kern.SkBuff, len: u32, flags: u64) c_long, @ptrFromInt(43));
pub const xdp_adjust_head = @as(fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, @ptrFromInt(44));
pub const probe_read_str = @as(fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, @ptrFromInt(45));
pub const get_socket_cookie = @as(fn (ctx: ?*anyopaque) u64, @ptrFromInt(46));
pub const get_socket_uid = @as(fn (skb: *kern.SkBuff) u32, @ptrFromInt(47));
pub const set_hash = @as(fn (skb: *kern.SkBuff, hash: u32) c_long, @ptrFromInt(48));
pub const setsockopt = @as(fn (bpf_socket: *kern.SockOps, level: c_int, optname: c_int, optval: ?*anyopaque, optlen: c_int) c_long, @ptrFromInt(49));
pub const skb_adjust_room = @as(fn (skb: *kern.SkBuff, len_diff: i32, mode: u32, flags: u64) c_long, @ptrFromInt(50));
pub const redirect_map = @as(fn (map: *const kern.MapDef, key: u32, flags: u64) c_long, @ptrFromInt(51));
pub const sk_redirect_map = @as(fn (skb: *kern.SkBuff, map: *const kern.MapDef, key: u32, flags: u64) c_long, @ptrFromInt(52));
pub const sock_map_update = @as(fn (skops: *kern.SockOps, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, @ptrFromInt(53));
pub const xdp_adjust_meta = @as(fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, @ptrFromInt(54));
pub const perf_event_read_value = @as(fn (map: *const kern.MapDef, flags: u64, buf: *kern.PerfEventValue, buf_size: u32) c_long, @ptrFromInt(55));
pub const perf_prog_read_value = @as(fn (ctx: *kern.PerfEventData, buf: *kern.PerfEventValue, buf_size: u32) c_long, @ptrFromInt(56));
pub const getsockopt = @as(fn (bpf_socket: ?*anyopaque, level: c_int, optname: c_int, optval: ?*anyopaque, optlen: c_int) c_long, @ptrFromInt(57));
pub const override_return = @as(fn (regs: *PtRegs, rc: u64) c_long, @ptrFromInt(58));
pub const sock_ops_cb_flags_set = @as(fn (bpf_sock: *kern.SockOps, argval: c_int) c_long, @ptrFromInt(59));
pub const msg_redirect_map = @as(fn (msg: *kern.SkMsgMd, map: *const kern.MapDef, key: u32, flags: u64) c_long, @ptrFromInt(60));
pub const msg_apply_bytes = @as(fn (msg: *kern.SkMsgMd, bytes: u32) c_long, @ptrFromInt(61));
pub const msg_cork_bytes = @as(fn (msg: *kern.SkMsgMd, bytes: u32) c_long, @ptrFromInt(62));
pub const msg_pull_data = @as(fn (msg: *kern.SkMsgMd, start: u32, end: u32, flags: u64) c_long, @ptrFromInt(63));
pub const bind = @as(fn (ctx: *kern.BpfSockAddr, addr: *kern.SockAddr, addr_len: c_int) c_long, @ptrFromInt(64));
pub const xdp_adjust_tail = @as(fn (xdp_md: *kern.XdpMd, delta: c_int) c_long, @ptrFromInt(65));
pub const skb_get_xfrm_state = @as(fn (skb: *kern.SkBuff, index: u32, xfrm_state: *kern.XfrmState, size: u32, flags: u64) c_long, @ptrFromInt(66));
pub const get_stack = @as(fn (ctx: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, @ptrFromInt(67));
pub const skb_load_bytes_relative = @as(fn (skb: ?*const anyopaque, offset: u32, to: ?*anyopaque, len: u32, start_header: u32) c_long, @ptrFromInt(68));
pub const fib_lookup = @as(fn (ctx: ?*anyopaque, params: *kern.FibLookup, plen: c_int, flags: u32) c_long, @ptrFromInt(69));
pub const sock_hash_update = @as(fn (skops: *kern.SockOps, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, @ptrFromInt(70));
pub const msg_redirect_hash = @as(fn (msg: *kern.SkMsgMd, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, @ptrFromInt(71));
pub const sk_redirect_hash = @as(fn (skb: *kern.SkBuff, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, @ptrFromInt(72));
pub const lwt_push_encap = @as(fn (skb: *kern.SkBuff, typ: u32, hdr: ?*anyopaque, len: u32) c_long, @ptrFromInt(73));
pub const lwt_seg6_store_bytes = @as(fn (skb: *kern.SkBuff, offset: u32, from: ?*const anyopaque, len: u32) c_long, @ptrFromInt(74));
pub const lwt_seg6_adjust_srh = @as(fn (skb: *kern.SkBuff, offset: u32, delta: i32) c_long, @ptrFromInt(75));
pub const lwt_seg6_action = @as(fn (skb: *kern.SkBuff, action: u32, param: ?*anyopaque, param_len: u32) c_long, @ptrFromInt(76));
pub const rc_repeat = @as(fn (ctx: ?*anyopaque) c_long, @ptrFromInt(77));
pub const rc_keydown = @as(fn (ctx: ?*anyopaque, protocol: u32, scancode: u64, toggle: u32) c_long, @ptrFromInt(78));
pub const skb_cgroup_id = @as(fn (skb: *kern.SkBuff) u64, @ptrFromInt(79));
pub const get_current_cgroup_id = @as(fn () u64, @ptrFromInt(80));
pub const get_local_storage = @as(fn (map: ?*anyopaque, flags: u64) ?*anyopaque, @ptrFromInt(81));
pub const sk_select_reuseport = @as(fn (reuse: *kern.SkReusePortMd, map: *const kern.MapDef, key: ?*anyopaque, flags: u64) c_long, @ptrFromInt(82));
pub const skb_ancestor_cgroup_id = @as(fn (skb: *kern.SkBuff, ancestor_level: c_int) u64, @ptrFromInt(83));
pub const sk_lookup_tcp = @as(fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, @ptrFromInt(84));
pub const sk_lookup_udp = @as(fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, @ptrFromInt(85));
pub const sk_release = @as(fn (sock: *kern.Sock) c_long, @ptrFromInt(86));
pub const map_push_elem = @as(fn (map: *const kern.MapDef, value: ?*const anyopaque, flags: u64) c_long, @ptrFromInt(87));
pub const map_pop_elem = @as(fn (map: *const kern.MapDef, value: ?*anyopaque) c_long, @ptrFromInt(88));
pub const map_peek_elem = @as(fn (map: *const kern.MapDef, value: ?*anyopaque) c_long, @ptrFromInt(89));
pub const msg_push_data = @as(fn (msg: *kern.SkMsgMd, start: u32, len: u32, flags: u64) c_long, @ptrFromInt(90));
pub const msg_pop_data = @as(fn (msg: *kern.SkMsgMd, start: u32, len: u32, flags: u64) c_long, @ptrFromInt(91));
pub const rc_pointer_rel = @as(fn (ctx: ?*anyopaque, rel_x: i32, rel_y: i32) c_long, @ptrFromInt(92));
pub const spin_lock = @as(fn (lock: *kern.SpinLock) c_long, @ptrFromInt(93));
pub const spin_unlock = @as(fn (lock: *kern.SpinLock) c_long, @ptrFromInt(94));
pub const sk_fullsock = @as(fn (sk: *kern.Sock) ?*SkFullSock, @ptrFromInt(95));
pub const tcp_sock = @as(fn (sk: *kern.Sock) ?*kern.TcpSock, @ptrFromInt(96));
pub const skb_ecn_set_ce = @as(fn (skb: *kern.SkBuff) c_long, @ptrFromInt(97));
pub const get_listener_sock = @as(fn (sk: *kern.Sock) ?*kern.Sock, @ptrFromInt(98));
pub const skc_lookup_tcp = @as(fn (ctx: ?*anyopaque, tuple: *kern.SockTuple, tuple_size: u32, netns: u64, flags: u64) ?*kern.Sock, @ptrFromInt(99));
pub const tcp_check_syncookie = @as(fn (sk: *kern.Sock, iph: ?*anyopaque, iph_len: u32, th: *TcpHdr, th_len: u32) c_long, @ptrFromInt(100));
pub const sysctl_get_name = @as(fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong, flags: u64) c_long, @ptrFromInt(101));
pub const sysctl_get_current_value = @as(fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong) c_long, @ptrFromInt(102));
pub const sysctl_get_new_value = @as(fn (ctx: *kern.SysCtl, buf: ?*u8, buf_len: c_ulong) c_long, @ptrFromInt(103));
pub const sysctl_set_new_value = @as(fn (ctx: *kern.SysCtl, buf: ?*const u8, buf_len: c_ulong) c_long, @ptrFromInt(104));
pub const strtol = @as(fn (buf: *const u8, buf_len: c_ulong, flags: u64, res: *c_long) c_long, @ptrFromInt(105));
pub const strtoul = @as(fn (buf: *const u8, buf_len: c_ulong, flags: u64, res: *c_ulong) c_long, @ptrFromInt(106));
pub const sk_storage_get = @as(fn (map: *const kern.MapDef, sk: *kern.Sock, value: ?*anyopaque, flags: u64) ?*anyopaque, @ptrFromInt(107));
pub const sk_storage_delete = @as(fn (map: *const kern.MapDef, sk: *kern.Sock) c_long, @ptrFromInt(108));
pub const send_signal = @as(fn (sig: u32) c_long, @ptrFromInt(109));
pub const tcp_gen_syncookie = @as(fn (sk: *kern.Sock, iph: ?*anyopaque, iph_len: u32, th: *TcpHdr, th_len: u32) i64, @ptrFromInt(110));
pub const skb_output = @as(fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, @ptrFromInt(111));
pub const probe_read_user = @as(fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, @ptrFromInt(112));
pub const probe_read_kernel = @as(fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, @ptrFromInt(113));
pub const probe_read_user_str = @as(fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, @ptrFromInt(114));
pub const probe_read_kernel_str = @as(fn (dst: ?*anyopaque, size: u32, unsafe_ptr: ?*const anyopaque) c_long, @ptrFromInt(115));
pub const tcp_send_ack = @as(fn (tp: ?*anyopaque, rcv_nxt: u32) c_long, @ptrFromInt(116));
pub const send_signal_thread = @as(fn (sig: u32) c_long, @ptrFromInt(117));
pub const jiffies64 = @as(fn () u64, @ptrFromInt(118));
pub const read_branch_records = @as(fn (ctx: *kern.PerfEventData, buf: ?*anyopaque, size: u32, flags: u64) c_long, @ptrFromInt(119));
pub const get_ns_current_pid_tgid = @as(fn (dev: u64, ino: u64, nsdata: *kern.PidNsInfo, size: u32) c_long, @ptrFromInt(120));
pub const xdp_output = @as(fn (ctx: ?*anyopaque, map: *const kern.MapDef, flags: u64, data: ?*anyopaque, size: u64) c_long, @ptrFromInt(121));
pub const get_netns_cookie = @as(fn (ctx: ?*anyopaque) u64, @ptrFromInt(122));
pub const get_current_ancestor_cgroup_id = @as(fn (ancestor_level: c_int) u64, @ptrFromInt(123));
pub const sk_assign = @as(fn (skb: *kern.SkBuff, sk: *kern.Sock, flags: u64) c_long, @ptrFromInt(124));
pub const ktime_get_boot_ns = @as(fn () u64, @ptrFromInt(125));
pub const seq_printf = @as(fn (m: *kern.SeqFile, fmt: ?*const u8, fmt_size: u32, data: ?*const anyopaque, data_len: u32) c_long, @ptrFromInt(126));
pub const seq_write = @as(fn (m: *kern.SeqFile, data: ?*const u8, len: u32) c_long, @ptrFromInt(127));
pub const sk_cgroup_id = @as(fn (sk: *kern.BpfSock) u64, @ptrFromInt(128));
pub const sk_ancestor_cgroup_id = @as(fn (sk: *kern.BpfSock, ancestor_level: c_long) u64, @ptrFromInt(129));
pub const ringbuf_output = @as(fn (ringbuf: ?*anyopaque, data: ?*anyopaque, size: u64, flags: u64) ?*anyopaque, @ptrFromInt(130));
pub const ringbuf_reserve = @as(fn (ringbuf: ?*anyopaque, size: u64, flags: u64) ?*anyopaque, @ptrFromInt(131));
pub const ringbuf_submit = @as(fn (data: ?*anyopaque, flags: u64) void, @ptrFromInt(132));
pub const ringbuf_discard = @as(fn (data: ?*anyopaque, flags: u64) void, @ptrFromInt(133));
pub const ringbuf_query = @as(fn (ringbuf: ?*anyopaque, flags: u64) u64, @ptrFromInt(134));
pub const csum_level = @as(fn (skb: *kern.SkBuff, level: u64) c_long, @ptrFromInt(135));
pub const skc_to_tcp6_sock = @as(fn (sk: ?*anyopaque) ?*kern.Tcp6Sock, @ptrFromInt(136));
pub const skc_to_tcp_sock = @as(fn (sk: ?*anyopaque) ?*kern.TcpSock, @ptrFromInt(137));
pub const skc_to_tcp_timewait_sock = @as(fn (sk: ?*anyopaque) ?*kern.TcpTimewaitSock, @ptrFromInt(138));
pub const skc_to_tcp_request_sock = @as(fn (sk: ?*anyopaque) ?*kern.TcpRequestSock, @ptrFromInt(139));
pub const skc_to_udp6_sock = @as(fn (sk: ?*anyopaque) ?*kern.Udp6Sock, @ptrFromInt(140));
pub const get_task_stack = @as(fn (task: ?*anyopaque, buf: ?*anyopaque, size: u32, flags: u64) c_long, @ptrFromInt(141));
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/errno/sparc.zig | //! These match the SunOS error numbering scheme.
pub const E = enum(i32) {
/// No error occurred.
SUCCESS = 0,
PERM = 1,
NOENT = 2,
SRCH = 3,
INTR = 4,
IO = 5,
NXIO = 6,
@"2BIG" = 7,
NOEXEC = 8,
BADF = 9,
CHILD = 10,
/// Also used for WOULDBLOCK
AGAIN = 11,
NOMEM = 12,
ACCES = 13,
FAULT = 14,
NOTBLK = 15,
BUSY = 16,
EXIST = 17,
XDEV = 18,
NODEV = 19,
NOTDIR = 20,
ISDIR = 21,
INVAL = 22,
NFILE = 23,
MFILE = 24,
NOTTY = 25,
TXTBSY = 26,
FBIG = 27,
NOSPC = 28,
SPIPE = 29,
ROFS = 30,
MLINK = 31,
PIPE = 32,
DOM = 33,
RANGE = 34,
INPROGRESS = 36,
ALREADY = 37,
NOTSOCK = 38,
DESTADDRREQ = 39,
MSGSIZE = 40,
PROTOTYPE = 41,
NOPROTOOPT = 42,
PROTONOSUPPORT = 43,
SOCKTNOSUPPORT = 44,
/// Also used for NOTSUP
OPNOTSUPP = 45,
PFNOSUPPORT = 46,
AFNOSUPPORT = 47,
ADDRINUSE = 48,
ADDRNOTAVAIL = 49,
NETDOWN = 50,
NETUNREACH = 51,
NETRESET = 52,
CONNABORTED = 53,
CONNRESET = 54,
NOBUFS = 55,
ISCONN = 56,
NOTCONN = 57,
SHUTDOWN = 58,
TOOMANYREFS = 59,
TIMEDOUT = 60,
CONNREFUSED = 61,
LOOP = 62,
NAMETOOLONG = 63,
HOSTDOWN = 64,
HOSTUNREACH = 65,
NOTEMPTY = 66,
PROCLIM = 67,
USERS = 68,
DQUOT = 69,
STALE = 70,
REMOTE = 71,
NOSTR = 72,
TIME = 73,
NOSR = 74,
NOMSG = 75,
BADMSG = 76,
IDRM = 77,
DEADLK = 78,
NOLCK = 79,
NONET = 80,
RREMOTE = 81,
NOLINK = 82,
ADV = 83,
SRMNT = 84,
COMM = 85,
PROTO = 86,
MULTIHOP = 87,
DOTDOT = 88,
REMCHG = 89,
NOSYS = 90,
STRPIPE = 91,
OVERFLOW = 92,
BADFD = 93,
CHRNG = 94,
L2NSYNC = 95,
L3HLT = 96,
L3RST = 97,
LNRNG = 98,
UNATCH = 99,
NOCSI = 100,
L2HLT = 101,
BADE = 102,
BADR = 103,
XFULL = 104,
NOANO = 105,
BADRQC = 106,
BADSLT = 107,
DEADLOCK = 108,
BFONT = 109,
LIBEXEC = 110,
NODATA = 111,
LIBBAD = 112,
NOPKG = 113,
LIBACC = 114,
NOTUNIQ = 115,
RESTART = 116,
UCLEAN = 117,
NOTNAM = 118,
NAVAIL = 119,
ISNAM = 120,
REMOTEIO = 121,
ILSEQ = 122,
LIBMAX = 123,
LIBSCN = 124,
NOMEDIUM = 125,
MEDIUMTYPE = 126,
CANCELED = 127,
NOKEY = 128,
KEYEXPIRED = 129,
KEYREVOKED = 130,
KEYREJECTED = 131,
OWNERDEAD = 132,
NOTRECOVERABLE = 133,
RFKILL = 134,
HWPOISON = 135,
_,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/errno/mips.zig | //! These are MIPS ABI compatible.
pub const E = enum(i32) {
/// No error occurred.
SUCCESS = 0,
PERM = 1,
NOENT = 2,
SRCH = 3,
INTR = 4,
IO = 5,
NXIO = 6,
@"2BIG" = 7,
NOEXEC = 8,
BADF = 9,
CHILD = 10,
/// Also used for WOULDBLOCK.
AGAIN = 11,
NOMEM = 12,
ACCES = 13,
FAULT = 14,
NOTBLK = 15,
BUSY = 16,
EXIST = 17,
XDEV = 18,
NODEV = 19,
NOTDIR = 20,
ISDIR = 21,
INVAL = 22,
NFILE = 23,
MFILE = 24,
NOTTY = 25,
TXTBSY = 26,
FBIG = 27,
NOSPC = 28,
SPIPE = 29,
ROFS = 30,
MLINK = 31,
PIPE = 32,
DOM = 33,
RANGE = 34,
NOMSG = 35,
IDRM = 36,
CHRNG = 37,
L2NSYNC = 38,
L3HLT = 39,
L3RST = 40,
LNRNG = 41,
UNATCH = 42,
NOCSI = 43,
L2HLT = 44,
DEADLK = 45,
NOLCK = 46,
BADE = 50,
BADR = 51,
XFULL = 52,
NOANO = 53,
BADRQC = 54,
BADSLT = 55,
DEADLOCK = 56,
BFONT = 59,
NOSTR = 60,
NODATA = 61,
TIME = 62,
NOSR = 63,
NONET = 64,
NOPKG = 65,
REMOTE = 66,
NOLINK = 67,
ADV = 68,
SRMNT = 69,
COMM = 70,
PROTO = 71,
DOTDOT = 73,
MULTIHOP = 74,
BADMSG = 77,
NAMETOOLONG = 78,
OVERFLOW = 79,
NOTUNIQ = 80,
BADFD = 81,
REMCHG = 82,
LIBACC = 83,
LIBBAD = 84,
LIBSCN = 85,
LIBMAX = 86,
LIBEXEC = 87,
ILSEQ = 88,
NOSYS = 89,
LOOP = 90,
RESTART = 91,
STRPIPE = 92,
NOTEMPTY = 93,
USERS = 94,
NOTSOCK = 95,
DESTADDRREQ = 96,
MSGSIZE = 97,
PROTOTYPE = 98,
NOPROTOOPT = 99,
PROTONOSUPPORT = 120,
SOCKTNOSUPPORT = 121,
OPNOTSUPP = 122,
PFNOSUPPORT = 123,
AFNOSUPPORT = 124,
ADDRINUSE = 125,
ADDRNOTAVAIL = 126,
NETDOWN = 127,
NETUNREACH = 128,
NETRESET = 129,
CONNABORTED = 130,
CONNRESET = 131,
NOBUFS = 132,
ISCONN = 133,
NOTCONN = 134,
UCLEAN = 135,
NOTNAM = 137,
NAVAIL = 138,
ISNAM = 139,
REMOTEIO = 140,
SHUTDOWN = 143,
TOOMANYREFS = 144,
TIMEDOUT = 145,
CONNREFUSED = 146,
HOSTDOWN = 147,
HOSTUNREACH = 148,
ALREADY = 149,
INPROGRESS = 150,
STALE = 151,
CANCELED = 158,
NOMEDIUM = 159,
MEDIUMTYPE = 160,
NOKEY = 161,
KEYEXPIRED = 162,
KEYREVOKED = 163,
KEYREJECTED = 164,
OWNERDEAD = 165,
NOTRECOVERABLE = 166,
RFKILL = 167,
HWPOISON = 168,
DQUOT = 1133,
_,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/linux/errno/generic.zig | pub const E = enum(u16) {
/// No error occurred.
/// Same code used for `NSROK`.
SUCCESS = 0,
/// Operation not permitted
PERM = 1,
/// No such file or directory
NOENT = 2,
/// No such process
SRCH = 3,
/// Interrupted system call
INTR = 4,
/// I/O error
IO = 5,
/// No such device or address
NXIO = 6,
/// Arg list too long
@"2BIG" = 7,
/// Exec format error
NOEXEC = 8,
/// Bad file number
BADF = 9,
/// No child processes
CHILD = 10,
/// Try again
/// Also means: WOULDBLOCK: operation would block
AGAIN = 11,
/// Out of memory
NOMEM = 12,
/// Permission denied
ACCES = 13,
/// Bad address
FAULT = 14,
/// Block device required
NOTBLK = 15,
/// Device or resource busy
BUSY = 16,
/// File exists
EXIST = 17,
/// Cross-device link
XDEV = 18,
/// No such device
NODEV = 19,
/// Not a directory
NOTDIR = 20,
/// Is a directory
ISDIR = 21,
/// Invalid argument
INVAL = 22,
/// File table overflow
NFILE = 23,
/// Too many open files
MFILE = 24,
/// Not a typewriter
NOTTY = 25,
/// Text file busy
TXTBSY = 26,
/// File too large
FBIG = 27,
/// No space left on device
NOSPC = 28,
/// Illegal seek
SPIPE = 29,
/// Read-only file system
ROFS = 30,
/// Too many links
MLINK = 31,
/// Broken pipe
PIPE = 32,
/// Math argument out of domain of func
DOM = 33,
/// Math result not representable
RANGE = 34,
/// Resource deadlock would occur
DEADLK = 35,
/// File name too long
NAMETOOLONG = 36,
/// No record locks available
NOLCK = 37,
/// Function not implemented
NOSYS = 38,
/// Directory not empty
NOTEMPTY = 39,
/// Too many symbolic links encountered
LOOP = 40,
/// No message of desired type
NOMSG = 42,
/// Identifier removed
IDRM = 43,
/// Channel number out of range
CHRNG = 44,
/// Level 2 not synchronized
L2NSYNC = 45,
/// Level 3 halted
L3HLT = 46,
/// Level 3 reset
L3RST = 47,
/// Link number out of range
LNRNG = 48,
/// Protocol driver not attached
UNATCH = 49,
/// No CSI structure available
NOCSI = 50,
/// Level 2 halted
L2HLT = 51,
/// Invalid exchange
BADE = 52,
/// Invalid request descriptor
BADR = 53,
/// Exchange full
XFULL = 54,
/// No anode
NOANO = 55,
/// Invalid request code
BADRQC = 56,
/// Invalid slot
BADSLT = 57,
/// Bad font file format
BFONT = 59,
/// Device not a stream
NOSTR = 60,
/// No data available
NODATA = 61,
/// Timer expired
TIME = 62,
/// Out of streams resources
NOSR = 63,
/// Machine is not on the network
NONET = 64,
/// Package not installed
NOPKG = 65,
/// Object is remote
REMOTE = 66,
/// Link has been severed
NOLINK = 67,
/// Advertise error
ADV = 68,
/// Srmount error
SRMNT = 69,
/// Communication error on send
COMM = 70,
/// Protocol error
PROTO = 71,
/// Multihop attempted
MULTIHOP = 72,
/// RFS specific error
DOTDOT = 73,
/// Not a data message
BADMSG = 74,
/// Value too large for defined data type
OVERFLOW = 75,
/// Name not unique on network
NOTUNIQ = 76,
/// File descriptor in bad state
BADFD = 77,
/// Remote address changed
REMCHG = 78,
/// Can not access a needed shared library
LIBACC = 79,
/// Accessing a corrupted shared library
LIBBAD = 80,
/// .lib section in a.out corrupted
LIBSCN = 81,
/// Attempting to link in too many shared libraries
LIBMAX = 82,
/// Cannot exec a shared library directly
LIBEXEC = 83,
/// Illegal byte sequence
ILSEQ = 84,
/// Interrupted system call should be restarted
RESTART = 85,
/// Streams pipe error
STRPIPE = 86,
/// Too many users
USERS = 87,
/// Socket operation on non-socket
NOTSOCK = 88,
/// Destination address required
DESTADDRREQ = 89,
/// Message too long
MSGSIZE = 90,
/// Protocol wrong type for socket
PROTOTYPE = 91,
/// Protocol not available
NOPROTOOPT = 92,
/// Protocol not supported
PROTONOSUPPORT = 93,
/// Socket type not supported
SOCKTNOSUPPORT = 94,
/// Operation not supported on transport endpoint
/// This code also means `NOTSUP`.
OPNOTSUPP = 95,
/// Protocol family not supported
PFNOSUPPORT = 96,
/// Address family not supported by protocol
AFNOSUPPORT = 97,
/// Address already in use
ADDRINUSE = 98,
/// Cannot assign requested address
ADDRNOTAVAIL = 99,
/// Network is down
NETDOWN = 100,
/// Network is unreachable
NETUNREACH = 101,
/// Network dropped connection because of reset
NETRESET = 102,
/// Software caused connection abort
CONNABORTED = 103,
/// Connection reset by peer
CONNRESET = 104,
/// No buffer space available
NOBUFS = 105,
/// Transport endpoint is already connected
ISCONN = 106,
/// Transport endpoint is not connected
NOTCONN = 107,
/// Cannot send after transport endpoint shutdown
SHUTDOWN = 108,
/// Too many references: cannot splice
TOOMANYREFS = 109,
/// Connection timed out
TIMEDOUT = 110,
/// Connection refused
CONNREFUSED = 111,
/// Host is down
HOSTDOWN = 112,
/// No route to host
HOSTUNREACH = 113,
/// Operation already in progress
ALREADY = 114,
/// Operation now in progress
INPROGRESS = 115,
/// Stale NFS file handle
STALE = 116,
/// Structure needs cleaning
UCLEAN = 117,
/// Not a XENIX named type file
NOTNAM = 118,
/// No XENIX semaphores available
NAVAIL = 119,
/// Is a named type file
ISNAM = 120,
/// Remote I/O error
REMOTEIO = 121,
/// Quota exceeded
DQUOT = 122,
/// No medium found
NOMEDIUM = 123,
/// Wrong medium type
MEDIUMTYPE = 124,
/// Operation canceled
CANCELED = 125,
/// Required key not available
NOKEY = 126,
/// Key has expired
KEYEXPIRED = 127,
/// Key has been revoked
KEYREVOKED = 128,
/// Key was rejected by service
KEYREJECTED = 129,
// for robust mutexes
/// Owner died
OWNERDEAD = 130,
/// State not recoverable
NOTRECOVERABLE = 131,
/// Operation not possible due to RF-kill
RFKILL = 132,
/// Memory page has hardware error
HWPOISON = 133,
// nameserver query return codes
/// DNS server returned answer with no data
NSRNODATA = 160,
/// DNS server claims query was misformatted
NSRFORMERR = 161,
/// DNS server returned general failure
NSRSERVFAIL = 162,
/// Domain name not found
NSRNOTFOUND = 163,
/// DNS server does not implement requested operation
NSRNOTIMP = 164,
/// DNS server refused query
NSRREFUSED = 165,
/// Misformatted DNS query
NSRBADQUERY = 166,
/// Misformatted domain name
NSRBADNAME = 167,
/// Unsupported address family
NSRBADFAMILY = 168,
/// Misformatted DNS reply
NSRBADRESP = 169,
/// Could not contact DNS servers
NSRCONNREFUSED = 170,
/// Timeout while contacting DNS servers
NSRTIMEOUT = 171,
/// End of file
NSROF = 172,
/// Error reading file
NSRFILE = 173,
/// Out of memory
NSRNOMEM = 174,
/// Application terminated lookup
NSRDESTRUCTION = 175,
/// Domain name is too long
NSRQUERYDOMAINTOOLONG = 176,
/// Domain name is too long
NSRCNAMELOOP = 177,
_,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/sublang.zig | pub const NEUTRAL = 0x00;
pub const DEFAULT = 0x01;
pub const SYS_DEFAULT = 0x02;
pub const CUSTOM_DEFAULT = 0x03;
pub const CUSTOM_UNSPECIFIED = 0x04;
pub const UI_CUSTOM_DEFAULT = 0x05;
pub const AFRIKAANS_SOUTH_AFRICA = 0x01;
pub const ALBANIAN_ALBANIA = 0x01;
pub const ALSATIAN_FRANCE = 0x01;
pub const AMHARIC_ETHIOPIA = 0x01;
pub const ARABIC_SAUDI_ARABIA = 0x01;
pub const ARABIC_IRAQ = 0x02;
pub const ARABIC_EGYPT = 0x03;
pub const ARABIC_LIBYA = 0x04;
pub const ARABIC_ALGERIA = 0x05;
pub const ARABIC_MOROCCO = 0x06;
pub const ARABIC_TUNISIA = 0x07;
pub const ARABIC_OMAN = 0x08;
pub const ARABIC_YEMEN = 0x09;
pub const ARABIC_SYRIA = 0x0a;
pub const ARABIC_JORDAN = 0x0b;
pub const ARABIC_LEBANON = 0x0c;
pub const ARABIC_KUWAIT = 0x0d;
pub const ARABIC_UAE = 0x0e;
pub const ARABIC_BAHRAIN = 0x0f;
pub const ARABIC_QATAR = 0x10;
pub const ARMENIAN_ARMENIA = 0x01;
pub const ASSAMESE_INDIA = 0x01;
pub const AZERI_LATIN = 0x01;
pub const AZERI_CYRILLIC = 0x02;
pub const AZERBAIJANI_AZERBAIJAN_LATIN = 0x01;
pub const AZERBAIJANI_AZERBAIJAN_CYRILLIC = 0x02;
pub const BANGLA_INDIA = 0x01;
pub const BANGLA_BANGLADESH = 0x02;
pub const BASHKIR_RUSSIA = 0x01;
pub const BASQUE_BASQUE = 0x01;
pub const BELARUSIAN_BELARUS = 0x01;
pub const BENGALI_INDIA = 0x01;
pub const BENGALI_BANGLADESH = 0x02;
pub const BOSNIAN_BOSNIA_HERZEGOVINA_LATIN = 0x05;
pub const BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 0x08;
pub const BRETON_FRANCE = 0x01;
pub const BULGARIAN_BULGARIA = 0x01;
pub const CATALAN_CATALAN = 0x01;
pub const CENTRAL_KURDISH_IRAQ = 0x01;
pub const CHEROKEE_CHEROKEE = 0x01;
pub const CHINESE_TRADITIONAL = 0x01;
pub const CHINESE_SIMPLIFIED = 0x02;
pub const CHINESE_HONGKONG = 0x03;
pub const CHINESE_SINGAPORE = 0x04;
pub const CHINESE_MACAU = 0x05;
pub const CORSICAN_FRANCE = 0x01;
pub const CZECH_CZECH_REPUBLIC = 0x01;
pub const CROATIAN_CROATIA = 0x01;
pub const CROATIAN_BOSNIA_HERZEGOVINA_LATIN = 0x04;
pub const DANISH_DENMARK = 0x01;
pub const DARI_AFGHANISTAN = 0x01;
pub const DIVEHI_MALDIVES = 0x01;
pub const DUTCH = 0x01;
pub const DUTCH_BELGIAN = 0x02;
pub const ENGLISH_US = 0x01;
pub const ENGLISH_UK = 0x02;
pub const ENGLISH_AUS = 0x03;
pub const ENGLISH_CAN = 0x04;
pub const ENGLISH_NZ = 0x05;
pub const ENGLISH_EIRE = 0x06;
pub const ENGLISH_SOUTH_AFRICA = 0x07;
pub const ENGLISH_JAMAICA = 0x08;
pub const ENGLISH_CARIBBEAN = 0x09;
pub const ENGLISH_BELIZE = 0x0a;
pub const ENGLISH_TRINIDAD = 0x0b;
pub const ENGLISH_ZIMBABWE = 0x0c;
pub const ENGLISH_PHILIPPINES = 0x0d;
pub const ENGLISH_INDIA = 0x10;
pub const ENGLISH_MALAYSIA = 0x11;
pub const ENGLISH_SINGAPORE = 0x12;
pub const ESTONIAN_ESTONIA = 0x01;
pub const FAEROESE_FAROE_ISLANDS = 0x01;
pub const FILIPINO_PHILIPPINES = 0x01;
pub const FINNISH_FINLAND = 0x01;
pub const FRENCH = 0x01;
pub const FRENCH_BELGIAN = 0x02;
pub const FRENCH_CANADIAN = 0x03;
pub const FRENCH_SWISS = 0x04;
pub const FRENCH_LUXEMBOURG = 0x05;
pub const FRENCH_MONACO = 0x06;
pub const FRISIAN_NETHERLANDS = 0x01;
pub const FULAH_SENEGAL = 0x02;
pub const GALICIAN_GALICIAN = 0x01;
pub const GEORGIAN_GEORGIA = 0x01;
pub const GERMAN = 0x01;
pub const GERMAN_SWISS = 0x02;
pub const GERMAN_AUSTRIAN = 0x03;
pub const GERMAN_LUXEMBOURG = 0x04;
pub const GERMAN_LIECHTENSTEIN = 0x05;
pub const GREEK_GREECE = 0x01;
pub const GREENLANDIC_GREENLAND = 0x01;
pub const GUJARATI_INDIA = 0x01;
pub const HAUSA_NIGERIA_LATIN = 0x01;
pub const HAWAIIAN_US = 0x01;
pub const HEBREW_ISRAEL = 0x01;
pub const HINDI_INDIA = 0x01;
pub const HUNGARIAN_HUNGARY = 0x01;
pub const ICELANDIC_ICELAND = 0x01;
pub const IGBO_NIGERIA = 0x01;
pub const INDONESIAN_INDONESIA = 0x01;
pub const INUKTITUT_CANADA = 0x01;
pub const INUKTITUT_CANADA_LATIN = 0x02;
pub const IRISH_IRELAND = 0x02;
pub const ITALIAN = 0x01;
pub const ITALIAN_SWISS = 0x02;
pub const JAPANESE_JAPAN = 0x01;
pub const KANNADA_INDIA = 0x01;
pub const KASHMIRI_SASIA = 0x02;
pub const KASHMIRI_INDIA = 0x02;
pub const KAZAK_KAZAKHSTAN = 0x01;
pub const KHMER_CAMBODIA = 0x01;
pub const KICHE_GUATEMALA = 0x01;
pub const KINYARWANDA_RWANDA = 0x01;
pub const KONKANI_INDIA = 0x01;
pub const KOREAN = 0x01;
pub const KYRGYZ_KYRGYZSTAN = 0x01;
pub const LAO_LAO = 0x01;
pub const LATVIAN_LATVIA = 0x01;
pub const LITHUANIAN = 0x01;
pub const LOWER_SORBIAN_GERMANY = 0x02;
pub const LUXEMBOURGISH_LUXEMBOURG = 0x01;
pub const MACEDONIAN_MACEDONIA = 0x01;
pub const MALAY_MALAYSIA = 0x01;
pub const MALAY_BRUNEI_DARUSSALAM = 0x02;
pub const MALAYALAM_INDIA = 0x01;
pub const MALTESE_MALTA = 0x01;
pub const MAORI_NEW_ZEALAND = 0x01;
pub const MAPUDUNGUN_CHILE = 0x01;
pub const MARATHI_INDIA = 0x01;
pub const MOHAWK_MOHAWK = 0x01;
pub const MONGOLIAN_CYRILLIC_MONGOLIA = 0x01;
pub const MONGOLIAN_PRC = 0x02;
pub const NEPALI_INDIA = 0x02;
pub const NEPALI_NEPAL = 0x01;
pub const NORWEGIAN_BOKMAL = 0x01;
pub const NORWEGIAN_NYNORSK = 0x02;
pub const OCCITAN_FRANCE = 0x01;
pub const ODIA_INDIA = 0x01;
pub const ORIYA_INDIA = 0x01;
pub const PASHTO_AFGHANISTAN = 0x01;
pub const PERSIAN_IRAN = 0x01;
pub const POLISH_POLAND = 0x01;
pub const PORTUGUESE = 0x02;
pub const PORTUGUESE_BRAZILIAN = 0x01;
pub const PULAR_SENEGAL = 0x02;
pub const PUNJABI_INDIA = 0x01;
pub const PUNJABI_PAKISTAN = 0x02;
pub const QUECHUA_BOLIVIA = 0x01;
pub const QUECHUA_ECUADOR = 0x02;
pub const QUECHUA_PERU = 0x03;
pub const ROMANIAN_ROMANIA = 0x01;
pub const ROMANSH_SWITZERLAND = 0x01;
pub const RUSSIAN_RUSSIA = 0x01;
pub const SAKHA_RUSSIA = 0x01;
pub const SAMI_NORTHERN_NORWAY = 0x01;
pub const SAMI_NORTHERN_SWEDEN = 0x02;
pub const SAMI_NORTHERN_FINLAND = 0x03;
pub const SAMI_LULE_NORWAY = 0x04;
pub const SAMI_LULE_SWEDEN = 0x05;
pub const SAMI_SOUTHERN_NORWAY = 0x06;
pub const SAMI_SOUTHERN_SWEDEN = 0x07;
pub const SAMI_SKOLT_FINLAND = 0x08;
pub const SAMI_INARI_FINLAND = 0x09;
pub const SANSKRIT_INDIA = 0x01;
pub const SCOTTISH_GAELIC = 0x01;
pub const SERBIAN_BOSNIA_HERZEGOVINA_LATIN = 0x06;
pub const SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 0x07;
pub const SERBIAN_MONTENEGRO_LATIN = 0x0b;
pub const SERBIAN_MONTENEGRO_CYRILLIC = 0x0c;
pub const SERBIAN_SERBIA_LATIN = 0x09;
pub const SERBIAN_SERBIA_CYRILLIC = 0x0a;
pub const SERBIAN_CROATIA = 0x01;
pub const SERBIAN_LATIN = 0x02;
pub const SERBIAN_CYRILLIC = 0x03;
pub const SINDHI_INDIA = 0x01;
pub const SINDHI_PAKISTAN = 0x02;
pub const SINDHI_AFGHANISTAN = 0x02;
pub const SINHALESE_SRI_LANKA = 0x01;
pub const SOTHO_NORTHERN_SOUTH_AFRICA = 0x01;
pub const SLOVAK_SLOVAKIA = 0x01;
pub const SLOVENIAN_SLOVENIA = 0x01;
pub const SPANISH = 0x01;
pub const SPANISH_MEXICAN = 0x02;
pub const SPANISH_MODERN = 0x03;
pub const SPANISH_GUATEMALA = 0x04;
pub const SPANISH_COSTA_RICA = 0x05;
pub const SPANISH_PANAMA = 0x06;
pub const SPANISH_DOMINICAN_REPUBLIC = 0x07;
pub const SPANISH_VENEZUELA = 0x08;
pub const SPANISH_COLOMBIA = 0x09;
pub const SPANISH_PERU = 0x0a;
pub const SPANISH_ARGENTINA = 0x0b;
pub const SPANISH_ECUADOR = 0x0c;
pub const SPANISH_CHILE = 0x0d;
pub const SPANISH_URUGUAY = 0x0e;
pub const SPANISH_PARAGUAY = 0x0f;
pub const SPANISH_BOLIVIA = 0x10;
pub const SPANISH_EL_SALVADOR = 0x11;
pub const SPANISH_HONDURAS = 0x12;
pub const SPANISH_NICARAGUA = 0x13;
pub const SPANISH_PUERTO_RICO = 0x14;
pub const SPANISH_US = 0x15;
pub const SWAHILI_KENYA = 0x01;
pub const SWEDISH = 0x01;
pub const SWEDISH_FINLAND = 0x02;
pub const SYRIAC_SYRIA = 0x01;
pub const TAJIK_TAJIKISTAN = 0x01;
pub const TAMAZIGHT_ALGERIA_LATIN = 0x02;
pub const TAMAZIGHT_MOROCCO_TIFINAGH = 0x04;
pub const TAMIL_INDIA = 0x01;
pub const TAMIL_SRI_LANKA = 0x02;
pub const TATAR_RUSSIA = 0x01;
pub const TELUGU_INDIA = 0x01;
pub const THAI_THAILAND = 0x01;
pub const TIBETAN_PRC = 0x01;
pub const TIGRIGNA_ERITREA = 0x02;
pub const TIGRINYA_ERITREA = 0x02;
pub const TIGRINYA_ETHIOPIA = 0x01;
pub const TSWANA_BOTSWANA = 0x02;
pub const TSWANA_SOUTH_AFRICA = 0x01;
pub const TURKISH_TURKEY = 0x01;
pub const TURKMEN_TURKMENISTAN = 0x01;
pub const UIGHUR_PRC = 0x01;
pub const UKRAINIAN_UKRAINE = 0x01;
pub const UPPER_SORBIAN_GERMANY = 0x01;
pub const URDU_PAKISTAN = 0x01;
pub const URDU_INDIA = 0x02;
pub const UZBEK_LATIN = 0x01;
pub const UZBEK_CYRILLIC = 0x02;
pub const VALENCIAN_VALENCIA = 0x02;
pub const VIETNAMESE_VIETNAM = 0x01;
pub const WELSH_UNITED_KINGDOM = 0x01;
pub const WOLOF_SENEGAL = 0x01;
pub const XHOSA_SOUTH_AFRICA = 0x01;
pub const YAKUT_RUSSIA = 0x01;
pub const YI_PRC = 0x01;
pub const YORUBA_NIGERIA = 0x01;
pub const ZULU_SOUTH_AFRICA = 0x01;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/user32.zig | const std = @import("../../std.zig");
const builtin = @import("builtin");
const assert = std.debug.assert;
const windows = std.os.windows;
const GetLastError = windows.kernel32.GetLastError;
const SetLastError = windows.kernel32.SetLastError;
const unexpectedError = windows.unexpectedError;
const HWND = windows.HWND;
const UINT = windows.UINT;
const HDC = windows.HDC;
const LONG = windows.LONG;
const LONG_PTR = windows.LONG_PTR;
const WINAPI = windows.WINAPI;
const RECT = windows.RECT;
const DWORD = windows.DWORD;
const BOOL = windows.BOOL;
const TRUE = windows.TRUE;
const HMENU = windows.HMENU;
const HINSTANCE = windows.HINSTANCE;
const LPVOID = windows.LPVOID;
const ATOM = windows.ATOM;
const WPARAM = windows.WPARAM;
const LRESULT = windows.LRESULT;
const HICON = windows.HICON;
const LPARAM = windows.LPARAM;
const POINT = windows.POINT;
const HCURSOR = windows.HCURSOR;
const HBRUSH = windows.HBRUSH;
fn selectSymbol(comptime function_static: anytype, function_dynamic: @TypeOf(function_static), comptime os: std.Target.Os.WindowsVersion) @TypeOf(function_static) {
comptime {
const sym_ok = builtin.os.isAtLeast(.windows, os);
if (sym_ok == true) return function_static;
if (sym_ok == null) return function_dynamic;
if (sym_ok == false) @compileError("Target OS range does not support function, at least " ++ @tagName(os) ++ " is required");
}
}
// === Messages ===
pub const WNDPROC = fn (hwnd: HWND, uMsg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
pub const MSG = extern struct {
hWnd: ?HWND,
message: UINT,
wParam: WPARAM,
lParam: LPARAM,
time: DWORD,
pt: POINT,
lPrivate: DWORD,
};
// Compiled by the WINE team @ https://wiki.winehq.org/List_Of_Windows_Messages
pub const WM_NULL = 0x0000;
pub const WM_CREATE = 0x0001;
pub const WM_DESTROY = 0x0002;
pub const WM_MOVE = 0x0003;
pub const WM_SIZE = 0x0005;
pub const WM_ACTIVATE = 0x0006;
pub const WM_SETFOCUS = 0x0007;
pub const WM_KILLFOCUS = 0x0008;
pub const WM_ENABLE = 0x000A;
pub const WM_SETREDRAW = 0x000B;
pub const WM_SETTEXT = 0x000C;
pub const WM_GETTEXT = 0x000D;
pub const WM_GETTEXTLENGTH = 0x000E;
pub const WM_PAINT = 0x000F;
pub const WM_CLOSE = 0x0010;
pub const WM_QUERYENDSESSION = 0x0011;
pub const WM_QUIT = 0x0012;
pub const WM_QUERYOPEN = 0x0013;
pub const WM_ERASEBKGND = 0x0014;
pub const WM_SYSCOLORCHANGE = 0x0015;
pub const WM_ENDSESSION = 0x0016;
pub const WM_SHOWWINDOW = 0x0018;
pub const WM_CTLCOLOR = 0x0019;
pub const WM_WININICHANGE = 0x001A;
pub const WM_DEVMODECHANGE = 0x001B;
pub const WM_ACTIVATEAPP = 0x001C;
pub const WM_FONTCHANGE = 0x001D;
pub const WM_TIMECHANGE = 0x001E;
pub const WM_CANCELMODE = 0x001F;
pub const WM_SETCURSOR = 0x0020;
pub const WM_MOUSEACTIVATE = 0x0021;
pub const WM_CHILDACTIVATE = 0x0022;
pub const WM_QUEUESYNC = 0x0023;
pub const WM_GETMINMAXINFO = 0x0024;
pub const WM_PAINTICON = 0x0026;
pub const WM_ICONERASEBKGND = 0x0027;
pub const WM_NEXTDLGCTL = 0x0028;
pub const WM_SPOOLERSTATUS = 0x002A;
pub const WM_DRAWITEM = 0x002B;
pub const WM_MEASUREITEM = 0x002C;
pub const WM_DELETEITEM = 0x002D;
pub const WM_VKEYTOITEM = 0x002E;
pub const WM_CHARTOITEM = 0x002F;
pub const WM_SETFONT = 0x0030;
pub const WM_GETFONT = 0x0031;
pub const WM_SETHOTKEY = 0x0032;
pub const WM_GETHOTKEY = 0x0033;
pub const WM_QUERYDRAGICON = 0x0037;
pub const WM_COMPAREITEM = 0x0039;
pub const WM_GETOBJECT = 0x003D;
pub const WM_COMPACTING = 0x0041;
pub const WM_COMMNOTIFY = 0x0044;
pub const WM_WINDOWPOSCHANGING = 0x0046;
pub const WM_WINDOWPOSCHANGED = 0x0047;
pub const WM_POWER = 0x0048;
pub const WM_COPYGLOBALDATA = 0x0049;
pub const WM_COPYDATA = 0x004A;
pub const WM_CANCELJOURNAL = 0x004B;
pub const WM_NOTIFY = 0x004E;
pub const WM_INPUTLANGCHANGEREQUEST = 0x0050;
pub const WM_INPUTLANGCHANGE = 0x0051;
pub const WM_TCARD = 0x0052;
pub const WM_HELP = 0x0053;
pub const WM_USERCHANGED = 0x0054;
pub const WM_NOTIFYFORMAT = 0x0055;
pub const WM_CONTEXTMENU = 0x007B;
pub const WM_STYLECHANGING = 0x007C;
pub const WM_STYLECHANGED = 0x007D;
pub const WM_DISPLAYCHANGE = 0x007E;
pub const WM_GETICON = 0x007F;
pub const WM_SETICON = 0x0080;
pub const WM_NCCREATE = 0x0081;
pub const WM_NCDESTROY = 0x0082;
pub const WM_NCCALCSIZE = 0x0083;
pub const WM_NCHITTEST = 0x0084;
pub const WM_NCPAINT = 0x0085;
pub const WM_NCACTIVATE = 0x0086;
pub const WM_GETDLGCODE = 0x0087;
pub const WM_SYNCPAINT = 0x0088;
pub const WM_NCMOUSEMOVE = 0x00A0;
pub const WM_NCLBUTTONDOWN = 0x00A1;
pub const WM_NCLBUTTONUP = 0x00A2;
pub const WM_NCLBUTTONDBLCLK = 0x00A3;
pub const WM_NCRBUTTONDOWN = 0x00A4;
pub const WM_NCRBUTTONUP = 0x00A5;
pub const WM_NCRBUTTONDBLCLK = 0x00A6;
pub const WM_NCMBUTTONDOWN = 0x00A7;
pub const WM_NCMBUTTONUP = 0x00A8;
pub const WM_NCMBUTTONDBLCLK = 0x00A9;
pub const WM_NCXBUTTONDOWN = 0x00AB;
pub const WM_NCXBUTTONUP = 0x00AC;
pub const WM_NCXBUTTONDBLCLK = 0x00AD;
pub const EM_GETSEL = 0x00B0;
pub const EM_SETSEL = 0x00B1;
pub const EM_GETRECT = 0x00B2;
pub const EM_SETRECT = 0x00B3;
pub const EM_SETRECTNP = 0x00B4;
pub const EM_SCROLL = 0x00B5;
pub const EM_LINESCROLL = 0x00B6;
pub const EM_SCROLLCARET = 0x00B7;
pub const EM_GETMODIFY = 0x00B8;
pub const EM_SETMODIFY = 0x00B9;
pub const EM_GETLINECOUNT = 0x00BA;
pub const EM_LINEINDEX = 0x00BB;
pub const EM_SETHANDLE = 0x00BC;
pub const EM_GETHANDLE = 0x00BD;
pub const EM_GETTHUMB = 0x00BE;
pub const EM_LINELENGTH = 0x00C1;
pub const EM_REPLACESEL = 0x00C2;
pub const EM_SETFONT = 0x00C3;
pub const EM_GETLINE = 0x00C4;
pub const EM_LIMITTEXT = 0x00C5;
pub const EM_SETLIMITTEXT = 0x00C5;
pub const EM_CANUNDO = 0x00C6;
pub const EM_UNDO = 0x00C7;
pub const EM_FMTLINES = 0x00C8;
pub const EM_LINEFROMCHAR = 0x00C9;
pub const EM_SETWORDBREAK = 0x00CA;
pub const EM_SETTABSTOPS = 0x00CB;
pub const EM_SETPASSWORDCHAR = 0x00CC;
pub const EM_EMPTYUNDOBUFFER = 0x00CD;
pub const EM_GETFIRSTVISIBLELINE = 0x00CE;
pub const EM_SETREADONLY = 0x00CF;
pub const EM_SETWORDBREAKPROC = 0x00D0;
pub const EM_GETWORDBREAKPROC = 0x00D1;
pub const EM_GETPASSWORDCHAR = 0x00D2;
pub const EM_SETMARGINS = 0x00D3;
pub const EM_GETMARGINS = 0x00D4;
pub const EM_GETLIMITTEXT = 0x00D5;
pub const EM_POSFROMCHAR = 0x00D6;
pub const EM_CHARFROMPOS = 0x00D7;
pub const EM_SETIMESTATUS = 0x00D8;
pub const EM_GETIMESTATUS = 0x00D9;
pub const SBM_SETPOS = 0x00E0;
pub const SBM_GETPOS = 0x00E1;
pub const SBM_SETRANGE = 0x00E2;
pub const SBM_GETRANGE = 0x00E3;
pub const SBM_ENABLE_ARROWS = 0x00E4;
pub const SBM_SETRANGEREDRAW = 0x00E6;
pub const SBM_SETSCROLLINFO = 0x00E9;
pub const SBM_GETSCROLLINFO = 0x00EA;
pub const SBM_GETSCROLLBARINFO = 0x00EB;
pub const BM_GETCHECK = 0x00F0;
pub const BM_SETCHECK = 0x00F1;
pub const BM_GETSTATE = 0x00F2;
pub const BM_SETSTATE = 0x00F3;
pub const BM_SETSTYLE = 0x00F4;
pub const BM_CLICK = 0x00F5;
pub const BM_GETIMAGE = 0x00F6;
pub const BM_SETIMAGE = 0x00F7;
pub const BM_SETDONTCLICK = 0x00F8;
pub const WM_INPUT = 0x00FF;
pub const WM_KEYDOWN = 0x0100;
pub const WM_KEYUP = 0x0101;
pub const WM_CHAR = 0x0102;
pub const WM_DEADCHAR = 0x0103;
pub const WM_SYSKEYDOWN = 0x0104;
pub const WM_SYSKEYUP = 0x0105;
pub const WM_SYSCHAR = 0x0106;
pub const WM_SYSDEADCHAR = 0x0107;
pub const WM_UNICHAR = 0x0109;
pub const WM_WNT_CONVERTREQUESTEX = 0x0109;
pub const WM_CONVERTREQUEST = 0x010A;
pub const WM_CONVERTRESULT = 0x010B;
pub const WM_INTERIM = 0x010C;
pub const WM_IME_STARTCOMPOSITION = 0x010D;
pub const WM_IME_ENDCOMPOSITION = 0x010E;
pub const WM_IME_COMPOSITION = 0x010F;
pub const WM_INITDIALOG = 0x0110;
pub const WM_COMMAND = 0x0111;
pub const WM_SYSCOMMAND = 0x0112;
pub const WM_TIMER = 0x0113;
pub const WM_HSCROLL = 0x0114;
pub const WM_VSCROLL = 0x0115;
pub const WM_INITMENU = 0x0116;
pub const WM_INITMENUPOPUP = 0x0117;
pub const WM_SYSTIMER = 0x0118;
pub const WM_MENUSELECT = 0x011F;
pub const WM_MENUCHAR = 0x0120;
pub const WM_ENTERIDLE = 0x0121;
pub const WM_MENURBUTTONUP = 0x0122;
pub const WM_MENUDRAG = 0x0123;
pub const WM_MENUGETOBJECT = 0x0124;
pub const WM_UNINITMENUPOPUP = 0x0125;
pub const WM_MENUCOMMAND = 0x0126;
pub const WM_CHANGEUISTATE = 0x0127;
pub const WM_UPDATEUISTATE = 0x0128;
pub const WM_QUERYUISTATE = 0x0129;
pub const WM_CTLCOLORMSGBOX = 0x0132;
pub const WM_CTLCOLOREDIT = 0x0133;
pub const WM_CTLCOLORLISTBOX = 0x0134;
pub const WM_CTLCOLORBTN = 0x0135;
pub const WM_CTLCOLORDLG = 0x0136;
pub const WM_CTLCOLORSCROLLBAR = 0x0137;
pub const WM_CTLCOLORSTATIC = 0x0138;
pub const WM_MOUSEMOVE = 0x0200;
pub const WM_LBUTTONDOWN = 0x0201;
pub const WM_LBUTTONUP = 0x0202;
pub const WM_LBUTTONDBLCLK = 0x0203;
pub const WM_RBUTTONDOWN = 0x0204;
pub const WM_RBUTTONUP = 0x0205;
pub const WM_RBUTTONDBLCLK = 0x0206;
pub const WM_MBUTTONDOWN = 0x0207;
pub const WM_MBUTTONUP = 0x0208;
pub const WM_MBUTTONDBLCLK = 0x0209;
pub const WM_MOUSEWHEEL = 0x020A;
pub const WM_XBUTTONDOWN = 0x020B;
pub const WM_XBUTTONUP = 0x020C;
pub const WM_XBUTTONDBLCLK = 0x020D;
pub const WM_MOUSEHWHEEL = 0x020E;
pub const WM_PARENTNOTIFY = 0x0210;
pub const WM_ENTERMENULOOP = 0x0211;
pub const WM_EXITMENULOOP = 0x0212;
pub const WM_NEXTMENU = 0x0213;
pub const WM_SIZING = 0x0214;
pub const WM_CAPTURECHANGED = 0x0215;
pub const WM_MOVING = 0x0216;
pub const WM_POWERBROADCAST = 0x0218;
pub const WM_DEVICECHANGE = 0x0219;
pub const WM_MDICREATE = 0x0220;
pub const WM_MDIDESTROY = 0x0221;
pub const WM_MDIACTIVATE = 0x0222;
pub const WM_MDIRESTORE = 0x0223;
pub const WM_MDINEXT = 0x0224;
pub const WM_MDIMAXIMIZE = 0x0225;
pub const WM_MDITILE = 0x0226;
pub const WM_MDICASCADE = 0x0227;
pub const WM_MDIICONARRANGE = 0x0228;
pub const WM_MDIGETACTIVE = 0x0229;
pub const WM_MDISETMENU = 0x0230;
pub const WM_ENTERSIZEMOVE = 0x0231;
pub const WM_EXITSIZEMOVE = 0x0232;
pub const WM_DROPFILES = 0x0233;
pub const WM_MDIREFRESHMENU = 0x0234;
pub const WM_IME_REPORT = 0x0280;
pub const WM_IME_SETCONTEXT = 0x0281;
pub const WM_IME_NOTIFY = 0x0282;
pub const WM_IME_CONTROL = 0x0283;
pub const WM_IME_COMPOSITIONFULL = 0x0284;
pub const WM_IME_SELECT = 0x0285;
pub const WM_IME_CHAR = 0x0286;
pub const WM_IME_REQUEST = 0x0288;
pub const WM_IMEKEYDOWN = 0x0290;
pub const WM_IME_KEYDOWN = 0x0290;
pub const WM_IMEKEYUP = 0x0291;
pub const WM_IME_KEYUP = 0x0291;
pub const WM_NCMOUSEHOVER = 0x02A0;
pub const WM_MOUSEHOVER = 0x02A1;
pub const WM_NCMOUSELEAVE = 0x02A2;
pub const WM_MOUSELEAVE = 0x02A3;
pub const WM_CUT = 0x0300;
pub const WM_COPY = 0x0301;
pub const WM_PASTE = 0x0302;
pub const WM_CLEAR = 0x0303;
pub const WM_UNDO = 0x0304;
pub const WM_RENDERFORMAT = 0x0305;
pub const WM_RENDERALLFORMATS = 0x0306;
pub const WM_DESTROYCLIPBOARD = 0x0307;
pub const WM_DRAWCLIPBOARD = 0x0308;
pub const WM_PAINTCLIPBOARD = 0x0309;
pub const WM_VSCROLLCLIPBOARD = 0x030A;
pub const WM_SIZECLIPBOARD = 0x030B;
pub const WM_ASKCBFORMATNAME = 0x030C;
pub const WM_CHANGECBCHAIN = 0x030D;
pub const WM_HSCROLLCLIPBOARD = 0x030E;
pub const WM_QUERYNEWPALETTE = 0x030F;
pub const WM_PALETTEISCHANGING = 0x0310;
pub const WM_PALETTECHANGED = 0x0311;
pub const WM_HOTKEY = 0x0312;
pub const WM_PRINT = 0x0317;
pub const WM_PRINTCLIENT = 0x0318;
pub const WM_APPCOMMAND = 0x0319;
pub const WM_RCRESULT = 0x0381;
pub const WM_HOOKRCRESULT = 0x0382;
pub const WM_GLOBALRCCHANGE = 0x0383;
pub const WM_PENMISCINFO = 0x0383;
pub const WM_SKB = 0x0384;
pub const WM_HEDITCTL = 0x0385;
pub const WM_PENCTL = 0x0385;
pub const WM_PENMISC = 0x0386;
pub const WM_CTLINIT = 0x0387;
pub const WM_PENEVENT = 0x0388;
pub const WM_CARET_CREATE = 0x03E0;
pub const WM_CARET_DESTROY = 0x03E1;
pub const WM_CARET_BLINK = 0x03E2;
pub const WM_FDINPUT = 0x03F0;
pub const WM_FDOUTPUT = 0x03F1;
pub const WM_FDEXCEPT = 0x03F2;
pub const DDM_SETFMT = 0x0400;
pub const DM_GETDEFID = 0x0400;
pub const NIN_SELECT = 0x0400;
pub const TBM_GETPOS = 0x0400;
pub const WM_PSD_PAGESETUPDLG = 0x0400;
pub const WM_USER = 0x0400;
pub const CBEM_INSERTITEMA = 0x0401;
pub const DDM_DRAW = 0x0401;
pub const DM_SETDEFID = 0x0401;
pub const HKM_SETHOTKEY = 0x0401;
pub const PBM_SETRANGE = 0x0401;
pub const RB_INSERTBANDA = 0x0401;
pub const SB_SETTEXTA = 0x0401;
pub const TB_ENABLEBUTTON = 0x0401;
pub const TBM_GETRANGEMIN = 0x0401;
pub const TTM_ACTIVATE = 0x0401;
pub const WM_CHOOSEFONT_GETLOGFONT = 0x0401;
pub const WM_PSD_FULLPAGERECT = 0x0401;
pub const CBEM_SETIMAGELIST = 0x0402;
pub const DDM_CLOSE = 0x0402;
pub const DM_REPOSITION = 0x0402;
pub const HKM_GETHOTKEY = 0x0402;
pub const PBM_SETPOS = 0x0402;
pub const RB_DELETEBAND = 0x0402;
pub const SB_GETTEXTA = 0x0402;
pub const TB_CHECKBUTTON = 0x0402;
pub const TBM_GETRANGEMAX = 0x0402;
pub const WM_PSD_MINMARGINRECT = 0x0402;
pub const CBEM_GETIMAGELIST = 0x0403;
pub const DDM_BEGIN = 0x0403;
pub const HKM_SETRULES = 0x0403;
pub const PBM_DELTAPOS = 0x0403;
pub const RB_GETBARINFO = 0x0403;
pub const SB_GETTEXTLENGTHA = 0x0403;
pub const TBM_GETTIC = 0x0403;
pub const TB_PRESSBUTTON = 0x0403;
pub const TTM_SETDELAYTIME = 0x0403;
pub const WM_PSD_MARGINRECT = 0x0403;
pub const CBEM_GETITEMA = 0x0404;
pub const DDM_END = 0x0404;
pub const PBM_SETSTEP = 0x0404;
pub const RB_SETBARINFO = 0x0404;
pub const SB_SETPARTS = 0x0404;
pub const TB_HIDEBUTTON = 0x0404;
pub const TBM_SETTIC = 0x0404;
pub const TTM_ADDTOOLA = 0x0404;
pub const WM_PSD_GREEKTEXTRECT = 0x0404;
pub const CBEM_SETITEMA = 0x0405;
pub const PBM_STEPIT = 0x0405;
pub const TB_INDETERMINATE = 0x0405;
pub const TBM_SETPOS = 0x0405;
pub const TTM_DELTOOLA = 0x0405;
pub const WM_PSD_ENVSTAMPRECT = 0x0405;
pub const CBEM_GETCOMBOCONTROL = 0x0406;
pub const PBM_SETRANGE32 = 0x0406;
pub const RB_SETBANDINFOA = 0x0406;
pub const SB_GETPARTS = 0x0406;
pub const TB_MARKBUTTON = 0x0406;
pub const TBM_SETRANGE = 0x0406;
pub const TTM_NEWTOOLRECTA = 0x0406;
pub const WM_PSD_YAFULLPAGERECT = 0x0406;
pub const CBEM_GETEDITCONTROL = 0x0407;
pub const PBM_GETRANGE = 0x0407;
pub const RB_SETPARENT = 0x0407;
pub const SB_GETBORDERS = 0x0407;
pub const TBM_SETRANGEMIN = 0x0407;
pub const TTM_RELAYEVENT = 0x0407;
pub const CBEM_SETEXSTYLE = 0x0408;
pub const PBM_GETPOS = 0x0408;
pub const RB_HITTEST = 0x0408;
pub const SB_SETMINHEIGHT = 0x0408;
pub const TBM_SETRANGEMAX = 0x0408;
pub const TTM_GETTOOLINFOA = 0x0408;
pub const CBEM_GETEXSTYLE = 0x0409;
pub const CBEM_GETEXTENDEDSTYLE = 0x0409;
pub const PBM_SETBARCOLOR = 0x0409;
pub const RB_GETRECT = 0x0409;
pub const SB_SIMPLE = 0x0409;
pub const TB_ISBUTTONENABLED = 0x0409;
pub const TBM_CLEARTICS = 0x0409;
pub const TTM_SETTOOLINFOA = 0x0409;
pub const CBEM_HASEDITCHANGED = 0x040A;
pub const RB_INSERTBANDW = 0x040A;
pub const SB_GETRECT = 0x040A;
pub const TB_ISBUTTONCHECKED = 0x040A;
pub const TBM_SETSEL = 0x040A;
pub const TTM_HITTESTA = 0x040A;
pub const WIZ_QUERYNUMPAGES = 0x040A;
pub const CBEM_INSERTITEMW = 0x040B;
pub const RB_SETBANDINFOW = 0x040B;
pub const SB_SETTEXTW = 0x040B;
pub const TB_ISBUTTONPRESSED = 0x040B;
pub const TBM_SETSELSTART = 0x040B;
pub const TTM_GETTEXTA = 0x040B;
pub const WIZ_NEXT = 0x040B;
pub const CBEM_SETITEMW = 0x040C;
pub const RB_GETBANDCOUNT = 0x040C;
pub const SB_GETTEXTLENGTHW = 0x040C;
pub const TB_ISBUTTONHIDDEN = 0x040C;
pub const TBM_SETSELEND = 0x040C;
pub const TTM_UPDATETIPTEXTA = 0x040C;
pub const WIZ_PREV = 0x040C;
pub const CBEM_GETITEMW = 0x040D;
pub const RB_GETROWCOUNT = 0x040D;
pub const SB_GETTEXTW = 0x040D;
pub const TB_ISBUTTONINDETERMINATE = 0x040D;
pub const TTM_GETTOOLCOUNT = 0x040D;
pub const CBEM_SETEXTENDEDSTYLE = 0x040E;
pub const RB_GETROWHEIGHT = 0x040E;
pub const SB_ISSIMPLE = 0x040E;
pub const TB_ISBUTTONHIGHLIGHTED = 0x040E;
pub const TBM_GETPTICS = 0x040E;
pub const TTM_ENUMTOOLSA = 0x040E;
pub const SB_SETICON = 0x040F;
pub const TBM_GETTICPOS = 0x040F;
pub const TTM_GETCURRENTTOOLA = 0x040F;
pub const RB_IDTOINDEX = 0x0410;
pub const SB_SETTIPTEXTA = 0x0410;
pub const TBM_GETNUMTICS = 0x0410;
pub const TTM_WINDOWFROMPOINT = 0x0410;
pub const RB_GETTOOLTIPS = 0x0411;
pub const SB_SETTIPTEXTW = 0x0411;
pub const TBM_GETSELSTART = 0x0411;
pub const TB_SETSTATE = 0x0411;
pub const TTM_TRACKACTIVATE = 0x0411;
pub const RB_SETTOOLTIPS = 0x0412;
pub const SB_GETTIPTEXTA = 0x0412;
pub const TB_GETSTATE = 0x0412;
pub const TBM_GETSELEND = 0x0412;
pub const TTM_TRACKPOSITION = 0x0412;
pub const RB_SETBKCOLOR = 0x0413;
pub const SB_GETTIPTEXTW = 0x0413;
pub const TB_ADDBITMAP = 0x0413;
pub const TBM_CLEARSEL = 0x0413;
pub const TTM_SETTIPBKCOLOR = 0x0413;
pub const RB_GETBKCOLOR = 0x0414;
pub const SB_GETICON = 0x0414;
pub const TB_ADDBUTTONSA = 0x0414;
pub const TBM_SETTICFREQ = 0x0414;
pub const TTM_SETTIPTEXTCOLOR = 0x0414;
pub const RB_SETTEXTCOLOR = 0x0415;
pub const TB_INSERTBUTTONA = 0x0415;
pub const TBM_SETPAGESIZE = 0x0415;
pub const TTM_GETDELAYTIME = 0x0415;
pub const RB_GETTEXTCOLOR = 0x0416;
pub const TB_DELETEBUTTON = 0x0416;
pub const TBM_GETPAGESIZE = 0x0416;
pub const TTM_GETTIPBKCOLOR = 0x0416;
pub const RB_SIZETORECT = 0x0417;
pub const TB_GETBUTTON = 0x0417;
pub const TBM_SETLINESIZE = 0x0417;
pub const TTM_GETTIPTEXTCOLOR = 0x0417;
pub const RB_BEGINDRAG = 0x0418;
pub const TB_BUTTONCOUNT = 0x0418;
pub const TBM_GETLINESIZE = 0x0418;
pub const TTM_SETMAXTIPWIDTH = 0x0418;
pub const RB_ENDDRAG = 0x0419;
pub const TB_COMMANDTOINDEX = 0x0419;
pub const TBM_GETTHUMBRECT = 0x0419;
pub const TTM_GETMAXTIPWIDTH = 0x0419;
pub const RB_DRAGMOVE = 0x041A;
pub const TBM_GETCHANNELRECT = 0x041A;
pub const TB_SAVERESTOREA = 0x041A;
pub const TTM_SETMARGIN = 0x041A;
pub const RB_GETBARHEIGHT = 0x041B;
pub const TB_CUSTOMIZE = 0x041B;
pub const TBM_SETTHUMBLENGTH = 0x041B;
pub const TTM_GETMARGIN = 0x041B;
pub const RB_GETBANDINFOW = 0x041C;
pub const TB_ADDSTRINGA = 0x041C;
pub const TBM_GETTHUMBLENGTH = 0x041C;
pub const TTM_POP = 0x041C;
pub const RB_GETBANDINFOA = 0x041D;
pub const TB_GETITEMRECT = 0x041D;
pub const TBM_SETTOOLTIPS = 0x041D;
pub const TTM_UPDATE = 0x041D;
pub const RB_MINIMIZEBAND = 0x041E;
pub const TB_BUTTONSTRUCTSIZE = 0x041E;
pub const TBM_GETTOOLTIPS = 0x041E;
pub const TTM_GETBUBBLESIZE = 0x041E;
pub const RB_MAXIMIZEBAND = 0x041F;
pub const TBM_SETTIPSIDE = 0x041F;
pub const TB_SETBUTTONSIZE = 0x041F;
pub const TTM_ADJUSTRECT = 0x041F;
pub const TBM_SETBUDDY = 0x0420;
pub const TB_SETBITMAPSIZE = 0x0420;
pub const TTM_SETTITLEA = 0x0420;
pub const MSG_FTS_JUMP_VA = 0x0421;
pub const TB_AUTOSIZE = 0x0421;
pub const TBM_GETBUDDY = 0x0421;
pub const TTM_SETTITLEW = 0x0421;
pub const RB_GETBANDBORDERS = 0x0422;
pub const MSG_FTS_JUMP_QWORD = 0x0423;
pub const RB_SHOWBAND = 0x0423;
pub const TB_GETTOOLTIPS = 0x0423;
pub const MSG_REINDEX_REQUEST = 0x0424;
pub const TB_SETTOOLTIPS = 0x0424;
pub const MSG_FTS_WHERE_IS_IT = 0x0425;
pub const RB_SETPALETTE = 0x0425;
pub const TB_SETPARENT = 0x0425;
pub const RB_GETPALETTE = 0x0426;
pub const RB_MOVEBAND = 0x0427;
pub const TB_SETROWS = 0x0427;
pub const TB_GETROWS = 0x0428;
pub const TB_GETBITMAPFLAGS = 0x0429;
pub const TB_SETCMDID = 0x042A;
pub const RB_PUSHCHEVRON = 0x042B;
pub const TB_CHANGEBITMAP = 0x042B;
pub const TB_GETBITMAP = 0x042C;
pub const MSG_GET_DEFFONT = 0x042D;
pub const TB_GETBUTTONTEXTA = 0x042D;
pub const TB_REPLACEBITMAP = 0x042E;
pub const TB_SETINDENT = 0x042F;
pub const TB_SETIMAGELIST = 0x0430;
pub const TB_GETIMAGELIST = 0x0431;
pub const TB_LOADIMAGES = 0x0432;
pub const EM_CANPASTE = 0x0432;
pub const TTM_ADDTOOLW = 0x0432;
pub const EM_DISPLAYBAND = 0x0433;
pub const TB_GETRECT = 0x0433;
pub const TTM_DELTOOLW = 0x0433;
pub const EM_EXGETSEL = 0x0434;
pub const TB_SETHOTIMAGELIST = 0x0434;
pub const TTM_NEWTOOLRECTW = 0x0434;
pub const EM_EXLIMITTEXT = 0x0435;
pub const TB_GETHOTIMAGELIST = 0x0435;
pub const TTM_GETTOOLINFOW = 0x0435;
pub const EM_EXLINEFROMCHAR = 0x0436;
pub const TB_SETDISABLEDIMAGELIST = 0x0436;
pub const TTM_SETTOOLINFOW = 0x0436;
pub const EM_EXSETSEL = 0x0437;
pub const TB_GETDISABLEDIMAGELIST = 0x0437;
pub const TTM_HITTESTW = 0x0437;
pub const EM_FINDTEXT = 0x0438;
pub const TB_SETSTYLE = 0x0438;
pub const TTM_GETTEXTW = 0x0438;
pub const EM_FORMATRANGE = 0x0439;
pub const TB_GETSTYLE = 0x0439;
pub const TTM_UPDATETIPTEXTW = 0x0439;
pub const EM_GETCHARFORMAT = 0x043A;
pub const TB_GETBUTTONSIZE = 0x043A;
pub const TTM_ENUMTOOLSW = 0x043A;
pub const EM_GETEVENTMASK = 0x043B;
pub const TB_SETBUTTONWIDTH = 0x043B;
pub const TTM_GETCURRENTTOOLW = 0x043B;
pub const EM_GETOLEINTERFACE = 0x043C;
pub const TB_SETMAXTEXTROWS = 0x043C;
pub const EM_GETPARAFORMAT = 0x043D;
pub const TB_GETTEXTROWS = 0x043D;
pub const EM_GETSELTEXT = 0x043E;
pub const TB_GETOBJECT = 0x043E;
pub const EM_HIDESELECTION = 0x043F;
pub const TB_GETBUTTONINFOW = 0x043F;
pub const EM_PASTESPECIAL = 0x0440;
pub const TB_SETBUTTONINFOW = 0x0440;
pub const EM_REQUESTRESIZE = 0x0441;
pub const TB_GETBUTTONINFOA = 0x0441;
pub const EM_SELECTIONTYPE = 0x0442;
pub const TB_SETBUTTONINFOA = 0x0442;
pub const EM_SETBKGNDCOLOR = 0x0443;
pub const TB_INSERTBUTTONW = 0x0443;
pub const EM_SETCHARFORMAT = 0x0444;
pub const TB_ADDBUTTONSW = 0x0444;
pub const EM_SETEVENTMASK = 0x0445;
pub const TB_HITTEST = 0x0445;
pub const EM_SETOLECALLBACK = 0x0446;
pub const TB_SETDRAWTEXTFLAGS = 0x0446;
pub const EM_SETPARAFORMAT = 0x0447;
pub const TB_GETHOTITEM = 0x0447;
pub const EM_SETTARGETDEVICE = 0x0448;
pub const TB_SETHOTITEM = 0x0448;
pub const EM_STREAMIN = 0x0449;
pub const TB_SETANCHORHIGHLIGHT = 0x0449;
pub const EM_STREAMOUT = 0x044A;
pub const TB_GETANCHORHIGHLIGHT = 0x044A;
pub const EM_GETTEXTRANGE = 0x044B;
pub const TB_GETBUTTONTEXTW = 0x044B;
pub const EM_FINDWORDBREAK = 0x044C;
pub const TB_SAVERESTOREW = 0x044C;
pub const EM_SETOPTIONS = 0x044D;
pub const TB_ADDSTRINGW = 0x044D;
pub const EM_GETOPTIONS = 0x044E;
pub const TB_MAPACCELERATORA = 0x044E;
pub const EM_FINDTEXTEX = 0x044F;
pub const TB_GETINSERTMARK = 0x044F;
pub const EM_GETWORDBREAKPROCEX = 0x0450;
pub const TB_SETINSERTMARK = 0x0450;
pub const EM_SETWORDBREAKPROCEX = 0x0451;
pub const TB_INSERTMARKHITTEST = 0x0451;
pub const EM_SETUNDOLIMIT = 0x0452;
pub const TB_MOVEBUTTON = 0x0452;
pub const TB_GETMAXSIZE = 0x0453;
pub const EM_REDO = 0x0454;
pub const TB_SETEXTENDEDSTYLE = 0x0454;
pub const EM_CANREDO = 0x0455;
pub const TB_GETEXTENDEDSTYLE = 0x0455;
pub const EM_GETUNDONAME = 0x0456;
pub const TB_GETPADDING = 0x0456;
pub const EM_GETREDONAME = 0x0457;
pub const TB_SETPADDING = 0x0457;
pub const EM_STOPGROUPTYPING = 0x0458;
pub const TB_SETINSERTMARKCOLOR = 0x0458;
pub const EM_SETTEXTMODE = 0x0459;
pub const TB_GETINSERTMARKCOLOR = 0x0459;
pub const EM_GETTEXTMODE = 0x045A;
pub const TB_MAPACCELERATORW = 0x045A;
pub const EM_AUTOURLDETECT = 0x045B;
pub const TB_GETSTRINGW = 0x045B;
pub const EM_GETAUTOURLDETECT = 0x045C;
pub const TB_GETSTRINGA = 0x045C;
pub const EM_SETPALETTE = 0x045D;
pub const EM_GETTEXTEX = 0x045E;
pub const EM_GETTEXTLENGTHEX = 0x045F;
pub const EM_SHOWSCROLLBAR = 0x0460;
pub const EM_SETTEXTEX = 0x0461;
pub const TAPI_REPLY = 0x0463;
pub const ACM_OPENA = 0x0464;
pub const BFFM_SETSTATUSTEXTA = 0x0464;
pub const CDM_GETSPEC = 0x0464;
pub const EM_SETPUNCTUATION = 0x0464;
pub const IPM_CLEARADDRESS = 0x0464;
pub const WM_CAP_UNICODE_START = 0x0464;
pub const ACM_PLAY = 0x0465;
pub const BFFM_ENABLEOK = 0x0465;
pub const CDM_GETFILEPATH = 0x0465;
pub const EM_GETPUNCTUATION = 0x0465;
pub const IPM_SETADDRESS = 0x0465;
pub const PSM_SETCURSEL = 0x0465;
pub const UDM_SETRANGE = 0x0465;
pub const WM_CHOOSEFONT_SETLOGFONT = 0x0465;
pub const ACM_STOP = 0x0466;
pub const BFFM_SETSELECTIONA = 0x0466;
pub const CDM_GETFOLDERPATH = 0x0466;
pub const EM_SETWORDWRAPMODE = 0x0466;
pub const IPM_GETADDRESS = 0x0466;
pub const PSM_REMOVEPAGE = 0x0466;
pub const UDM_GETRANGE = 0x0466;
pub const WM_CAP_SET_CALLBACK_ERRORW = 0x0466;
pub const WM_CHOOSEFONT_SETFLAGS = 0x0466;
pub const ACM_OPENW = 0x0467;
pub const BFFM_SETSELECTIONW = 0x0467;
pub const CDM_GETFOLDERIDLIST = 0x0467;
pub const EM_GETWORDWRAPMODE = 0x0467;
pub const IPM_SETRANGE = 0x0467;
pub const PSM_ADDPAGE = 0x0467;
pub const UDM_SETPOS = 0x0467;
pub const WM_CAP_SET_CALLBACK_STATUSW = 0x0467;
pub const BFFM_SETSTATUSTEXTW = 0x0468;
pub const CDM_SETCONTROLTEXT = 0x0468;
pub const EM_SETIMECOLOR = 0x0468;
pub const IPM_SETFOCUS = 0x0468;
pub const PSM_CHANGED = 0x0468;
pub const UDM_GETPOS = 0x0468;
pub const CDM_HIDECONTROL = 0x0469;
pub const EM_GETIMECOLOR = 0x0469;
pub const IPM_ISBLANK = 0x0469;
pub const PSM_RESTARTWINDOWS = 0x0469;
pub const UDM_SETBUDDY = 0x0469;
pub const CDM_SETDEFEXT = 0x046A;
pub const EM_SETIMEOPTIONS = 0x046A;
pub const PSM_REBOOTSYSTEM = 0x046A;
pub const UDM_GETBUDDY = 0x046A;
pub const EM_GETIMEOPTIONS = 0x046B;
pub const PSM_CANCELTOCLOSE = 0x046B;
pub const UDM_SETACCEL = 0x046B;
pub const EM_CONVPOSITION = 0x046C;
pub const PSM_QUERYSIBLINGS = 0x046C;
pub const UDM_GETACCEL = 0x046C;
pub const MCIWNDM_GETZOOM = 0x046D;
pub const PSM_UNCHANGED = 0x046D;
pub const UDM_SETBASE = 0x046D;
pub const PSM_APPLY = 0x046E;
pub const UDM_GETBASE = 0x046E;
pub const PSM_SETTITLEA = 0x046F;
pub const UDM_SETRANGE32 = 0x046F;
pub const PSM_SETWIZBUTTONS = 0x0470;
pub const UDM_GETRANGE32 = 0x0470;
pub const WM_CAP_DRIVER_GET_NAMEW = 0x0470;
pub const PSM_PRESSBUTTON = 0x0471;
pub const UDM_SETPOS32 = 0x0471;
pub const WM_CAP_DRIVER_GET_VERSIONW = 0x0471;
pub const PSM_SETCURSELID = 0x0472;
pub const UDM_GETPOS32 = 0x0472;
pub const PSM_SETFINISHTEXTA = 0x0473;
pub const PSM_GETTABCONTROL = 0x0474;
pub const PSM_ISDIALOGMESSAGE = 0x0475;
pub const MCIWNDM_REALIZE = 0x0476;
pub const PSM_GETCURRENTPAGEHWND = 0x0476;
pub const MCIWNDM_SETTIMEFORMATA = 0x0477;
pub const PSM_INSERTPAGE = 0x0477;
pub const EM_SETLANGOPTIONS = 0x0478;
pub const MCIWNDM_GETTIMEFORMATA = 0x0478;
pub const PSM_SETTITLEW = 0x0478;
pub const WM_CAP_FILE_SET_CAPTURE_FILEW = 0x0478;
pub const EM_GETLANGOPTIONS = 0x0479;
pub const MCIWNDM_VALIDATEMEDIA = 0x0479;
pub const PSM_SETFINISHTEXTW = 0x0479;
pub const WM_CAP_FILE_GET_CAPTURE_FILEW = 0x0479;
pub const EM_GETIMECOMPMODE = 0x047A;
pub const EM_FINDTEXTW = 0x047B;
pub const MCIWNDM_PLAYTO = 0x047B;
pub const WM_CAP_FILE_SAVEASW = 0x047B;
pub const EM_FINDTEXTEXW = 0x047C;
pub const MCIWNDM_GETFILENAMEA = 0x047C;
pub const EM_RECONVERSION = 0x047D;
pub const MCIWNDM_GETDEVICEA = 0x047D;
pub const PSM_SETHEADERTITLEA = 0x047D;
pub const WM_CAP_FILE_SAVEDIBW = 0x047D;
pub const EM_SETIMEMODEBIAS = 0x047E;
pub const MCIWNDM_GETPALETTE = 0x047E;
pub const PSM_SETHEADERTITLEW = 0x047E;
pub const EM_GETIMEMODEBIAS = 0x047F;
pub const MCIWNDM_SETPALETTE = 0x047F;
pub const PSM_SETHEADERSUBTITLEA = 0x047F;
pub const MCIWNDM_GETERRORA = 0x0480;
pub const PSM_SETHEADERSUBTITLEW = 0x0480;
pub const PSM_HWNDTOINDEX = 0x0481;
pub const PSM_INDEXTOHWND = 0x0482;
pub const MCIWNDM_SETINACTIVETIMER = 0x0483;
pub const PSM_PAGETOINDEX = 0x0483;
pub const PSM_INDEXTOPAGE = 0x0484;
pub const DL_BEGINDRAG = 0x0485;
pub const MCIWNDM_GETINACTIVETIMER = 0x0485;
pub const PSM_IDTOINDEX = 0x0485;
pub const DL_DRAGGING = 0x0486;
pub const PSM_INDEXTOID = 0x0486;
pub const DL_DROPPED = 0x0487;
pub const PSM_GETRESULT = 0x0487;
pub const DL_CANCELDRAG = 0x0488;
pub const PSM_RECALCPAGESIZES = 0x0488;
pub const MCIWNDM_GET_SOURCE = 0x048C;
pub const MCIWNDM_PUT_SOURCE = 0x048D;
pub const MCIWNDM_GET_DEST = 0x048E;
pub const MCIWNDM_PUT_DEST = 0x048F;
pub const MCIWNDM_CAN_PLAY = 0x0490;
pub const MCIWNDM_CAN_WINDOW = 0x0491;
pub const MCIWNDM_CAN_RECORD = 0x0492;
pub const MCIWNDM_CAN_SAVE = 0x0493;
pub const MCIWNDM_CAN_EJECT = 0x0494;
pub const MCIWNDM_CAN_CONFIG = 0x0495;
pub const IE_GETINK = 0x0496;
pub const MCIWNDM_PALETTEKICK = 0x0496;
pub const IE_SETINK = 0x0497;
pub const IE_GETPENTIP = 0x0498;
pub const IE_SETPENTIP = 0x0499;
pub const IE_GETERASERTIP = 0x049A;
pub const IE_SETERASERTIP = 0x049B;
pub const IE_GETBKGND = 0x049C;
pub const IE_SETBKGND = 0x049D;
pub const IE_GETGRIDORIGIN = 0x049E;
pub const IE_SETGRIDORIGIN = 0x049F;
pub const IE_GETGRIDPEN = 0x04A0;
pub const IE_SETGRIDPEN = 0x04A1;
pub const IE_GETGRIDSIZE = 0x04A2;
pub const IE_SETGRIDSIZE = 0x04A3;
pub const IE_GETMODE = 0x04A4;
pub const IE_SETMODE = 0x04A5;
pub const IE_GETINKRECT = 0x04A6;
pub const WM_CAP_SET_MCI_DEVICEW = 0x04A6;
pub const WM_CAP_GET_MCI_DEVICEW = 0x04A7;
pub const WM_CAP_PAL_OPENW = 0x04B4;
pub const WM_CAP_PAL_SAVEW = 0x04B5;
pub const IE_GETAPPDATA = 0x04B8;
pub const IE_SETAPPDATA = 0x04B9;
pub const IE_GETDRAWOPTS = 0x04BA;
pub const IE_SETDRAWOPTS = 0x04BB;
pub const IE_GETFORMAT = 0x04BC;
pub const IE_SETFORMAT = 0x04BD;
pub const IE_GETINKINPUT = 0x04BE;
pub const IE_SETINKINPUT = 0x04BF;
pub const IE_GETNOTIFY = 0x04C0;
pub const IE_SETNOTIFY = 0x04C1;
pub const IE_GETRECOG = 0x04C2;
pub const IE_SETRECOG = 0x04C3;
pub const IE_GETSECURITY = 0x04C4;
pub const IE_SETSECURITY = 0x04C5;
pub const IE_GETSEL = 0x04C6;
pub const IE_SETSEL = 0x04C7;
pub const EM_SETBIDIOPTIONS = 0x04C8;
pub const IE_DOCOMMAND = 0x04C8;
pub const MCIWNDM_NOTIFYMODE = 0x04C8;
pub const EM_GETBIDIOPTIONS = 0x04C9;
pub const IE_GETCOMMAND = 0x04C9;
pub const EM_SETTYPOGRAPHYOPTIONS = 0x04CA;
pub const IE_GETCOUNT = 0x04CA;
pub const EM_GETTYPOGRAPHYOPTIONS = 0x04CB;
pub const IE_GETGESTURE = 0x04CB;
pub const MCIWNDM_NOTIFYMEDIA = 0x04CB;
pub const EM_SETEDITSTYLE = 0x04CC;
pub const IE_GETMENU = 0x04CC;
pub const EM_GETEDITSTYLE = 0x04CD;
pub const IE_GETPAINTDC = 0x04CD;
pub const MCIWNDM_NOTIFYERROR = 0x04CD;
pub const IE_GETPDEVENT = 0x04CE;
pub const IE_GETSELCOUNT = 0x04CF;
pub const IE_GETSELITEMS = 0x04D0;
pub const IE_GETSTYLE = 0x04D1;
pub const MCIWNDM_SETTIMEFORMATW = 0x04DB;
pub const EM_OUTLINE = 0x04DC;
pub const MCIWNDM_GETTIMEFORMATW = 0x04DC;
pub const EM_GETSCROLLPOS = 0x04DD;
pub const EM_SETSCROLLPOS = 0x04DE;
pub const EM_SETFONTSIZE = 0x04DF;
pub const EM_GETZOOM = 0x04E0;
pub const MCIWNDM_GETFILENAMEW = 0x04E0;
pub const EM_SETZOOM = 0x04E1;
pub const MCIWNDM_GETDEVICEW = 0x04E1;
pub const EM_GETVIEWKIND = 0x04E2;
pub const EM_SETVIEWKIND = 0x04E3;
pub const EM_GETPAGE = 0x04E4;
pub const MCIWNDM_GETERRORW = 0x04E4;
pub const EM_SETPAGE = 0x04E5;
pub const EM_GETHYPHENATEINFO = 0x04E6;
pub const EM_SETHYPHENATEINFO = 0x04E7;
pub const EM_GETPAGEROTATE = 0x04EB;
pub const EM_SETPAGEROTATE = 0x04EC;
pub const EM_GETCTFMODEBIAS = 0x04ED;
pub const EM_SETCTFMODEBIAS = 0x04EE;
pub const EM_GETCTFOPENSTATUS = 0x04F0;
pub const EM_SETCTFOPENSTATUS = 0x04F1;
pub const EM_GETIMECOMPTEXT = 0x04F2;
pub const EM_ISIME = 0x04F3;
pub const EM_GETIMEPROPERTY = 0x04F4;
pub const EM_GETQUERYRTFOBJ = 0x050D;
pub const EM_SETQUERYRTFOBJ = 0x050E;
pub const FM_GETFOCUS = 0x0600;
pub const FM_GETDRIVEINFOA = 0x0601;
pub const FM_GETSELCOUNT = 0x0602;
pub const FM_GETSELCOUNTLFN = 0x0603;
pub const FM_GETFILESELA = 0x0604;
pub const FM_GETFILESELLFNA = 0x0605;
pub const FM_REFRESH_WINDOWS = 0x0606;
pub const FM_RELOAD_EXTENSIONS = 0x0607;
pub const FM_GETDRIVEINFOW = 0x0611;
pub const FM_GETFILESELW = 0x0614;
pub const FM_GETFILESELLFNW = 0x0615;
pub const WLX_WM_SAS = 0x0659;
pub const SM_GETSELCOUNT = 0x07E8;
pub const UM_GETSELCOUNT = 0x07E8;
pub const WM_CPL_LAUNCH = 0x07E8;
pub const SM_GETSERVERSELA = 0x07E9;
pub const UM_GETUSERSELA = 0x07E9;
pub const WM_CPL_LAUNCHED = 0x07E9;
pub const SM_GETSERVERSELW = 0x07EA;
pub const UM_GETUSERSELW = 0x07EA;
pub const SM_GETCURFOCUSA = 0x07EB;
pub const UM_GETGROUPSELA = 0x07EB;
pub const SM_GETCURFOCUSW = 0x07EC;
pub const UM_GETGROUPSELW = 0x07EC;
pub const SM_GETOPTIONS = 0x07ED;
pub const UM_GETCURFOCUSA = 0x07ED;
pub const UM_GETCURFOCUSW = 0x07EE;
pub const UM_GETOPTIONS = 0x07EF;
pub const UM_GETOPTIONS2 = 0x07F0;
pub const LVM_GETBKCOLOR = 0x1000;
pub const LVM_SETBKCOLOR = 0x1001;
pub const LVM_GETIMAGELIST = 0x1002;
pub const LVM_SETIMAGELIST = 0x1003;
pub const LVM_GETITEMCOUNT = 0x1004;
pub const LVM_GETITEMA = 0x1005;
pub const LVM_SETITEMA = 0x1006;
pub const LVM_INSERTITEMA = 0x1007;
pub const LVM_DELETEITEM = 0x1008;
pub const LVM_DELETEALLITEMS = 0x1009;
pub const LVM_GETCALLBACKMASK = 0x100A;
pub const LVM_SETCALLBACKMASK = 0x100B;
pub const LVM_GETNEXTITEM = 0x100C;
pub const LVM_FINDITEMA = 0x100D;
pub const LVM_GETITEMRECT = 0x100E;
pub const LVM_SETITEMPOSITION = 0x100F;
pub const LVM_GETITEMPOSITION = 0x1010;
pub const LVM_GETSTRINGWIDTHA = 0x1011;
pub const LVM_HITTEST = 0x1012;
pub const LVM_ENSUREVISIBLE = 0x1013;
pub const LVM_SCROLL = 0x1014;
pub const LVM_REDRAWITEMS = 0x1015;
pub const LVM_ARRANGE = 0x1016;
pub const LVM_EDITLABELA = 0x1017;
pub const LVM_GETEDITCONTROL = 0x1018;
pub const LVM_GETCOLUMNA = 0x1019;
pub const LVM_SETCOLUMNA = 0x101A;
pub const LVM_INSERTCOLUMNA = 0x101B;
pub const LVM_DELETECOLUMN = 0x101C;
pub const LVM_GETCOLUMNWIDTH = 0x101D;
pub const LVM_SETCOLUMNWIDTH = 0x101E;
pub const LVM_GETHEADER = 0x101F;
pub const LVM_CREATEDRAGIMAGE = 0x1021;
pub const LVM_GETVIEWRECT = 0x1022;
pub const LVM_GETTEXTCOLOR = 0x1023;
pub const LVM_SETTEXTCOLOR = 0x1024;
pub const LVM_GETTEXTBKCOLOR = 0x1025;
pub const LVM_SETTEXTBKCOLOR = 0x1026;
pub const LVM_GETTOPINDEX = 0x1027;
pub const LVM_GETCOUNTPERPAGE = 0x1028;
pub const LVM_GETORIGIN = 0x1029;
pub const LVM_UPDATE = 0x102A;
pub const LVM_SETITEMSTATE = 0x102B;
pub const LVM_GETITEMSTATE = 0x102C;
pub const LVM_GETITEMTEXTA = 0x102D;
pub const LVM_SETITEMTEXTA = 0x102E;
pub const LVM_SETITEMCOUNT = 0x102F;
pub const LVM_SORTITEMS = 0x1030;
pub const LVM_SETITEMPOSITION32 = 0x1031;
pub const LVM_GETSELECTEDCOUNT = 0x1032;
pub const LVM_GETITEMSPACING = 0x1033;
pub const LVM_GETISEARCHSTRINGA = 0x1034;
pub const LVM_SETICONSPACING = 0x1035;
pub const LVM_SETEXTENDEDLISTVIEWSTYLE = 0x1036;
pub const LVM_GETEXTENDEDLISTVIEWSTYLE = 0x1037;
pub const LVM_GETSUBITEMRECT = 0x1038;
pub const LVM_SUBITEMHITTEST = 0x1039;
pub const LVM_SETCOLUMNORDERARRAY = 0x103A;
pub const LVM_GETCOLUMNORDERARRAY = 0x103B;
pub const LVM_SETHOTITEM = 0x103C;
pub const LVM_GETHOTITEM = 0x103D;
pub const LVM_SETHOTCURSOR = 0x103E;
pub const LVM_GETHOTCURSOR = 0x103F;
pub const LVM_APPROXIMATEVIEWRECT = 0x1040;
pub const LVM_SETWORKAREAS = 0x1041;
pub const LVM_GETSELECTIONMARK = 0x1042;
pub const LVM_SETSELECTIONMARK = 0x1043;
pub const LVM_SETBKIMAGEA = 0x1044;
pub const LVM_GETBKIMAGEA = 0x1045;
pub const LVM_GETWORKAREAS = 0x1046;
pub const LVM_SETHOVERTIME = 0x1047;
pub const LVM_GETHOVERTIME = 0x1048;
pub const LVM_GETNUMBEROFWORKAREAS = 0x1049;
pub const LVM_SETTOOLTIPS = 0x104A;
pub const LVM_GETITEMW = 0x104B;
pub const LVM_SETITEMW = 0x104C;
pub const LVM_INSERTITEMW = 0x104D;
pub const LVM_GETTOOLTIPS = 0x104E;
pub const LVM_FINDITEMW = 0x1053;
pub const LVM_GETSTRINGWIDTHW = 0x1057;
pub const LVM_GETCOLUMNW = 0x105F;
pub const LVM_SETCOLUMNW = 0x1060;
pub const LVM_INSERTCOLUMNW = 0x1061;
pub const LVM_GETITEMTEXTW = 0x1073;
pub const LVM_SETITEMTEXTW = 0x1074;
pub const LVM_GETISEARCHSTRINGW = 0x1075;
pub const LVM_EDITLABELW = 0x1076;
pub const LVM_GETBKIMAGEW = 0x108B;
pub const LVM_SETSELECTEDCOLUMN = 0x108C;
pub const LVM_SETTILEWIDTH = 0x108D;
pub const LVM_SETVIEW = 0x108E;
pub const LVM_GETVIEW = 0x108F;
pub const LVM_INSERTGROUP = 0x1091;
pub const LVM_SETGROUPINFO = 0x1093;
pub const LVM_GETGROUPINFO = 0x1095;
pub const LVM_REMOVEGROUP = 0x1096;
pub const LVM_MOVEGROUP = 0x1097;
pub const LVM_MOVEITEMTOGROUP = 0x109A;
pub const LVM_SETGROUPMETRICS = 0x109B;
pub const LVM_GETGROUPMETRICS = 0x109C;
pub const LVM_ENABLEGROUPVIEW = 0x109D;
pub const LVM_SORTGROUPS = 0x109E;
pub const LVM_INSERTGROUPSORTED = 0x109F;
pub const LVM_REMOVEALLGROUPS = 0x10A0;
pub const LVM_HASGROUP = 0x10A1;
pub const LVM_SETTILEVIEWINFO = 0x10A2;
pub const LVM_GETTILEVIEWINFO = 0x10A3;
pub const LVM_SETTILEINFO = 0x10A4;
pub const LVM_GETTILEINFO = 0x10A5;
pub const LVM_SETINSERTMARK = 0x10A6;
pub const LVM_GETINSERTMARK = 0x10A7;
pub const LVM_INSERTMARKHITTEST = 0x10A8;
pub const LVM_GETINSERTMARKRECT = 0x10A9;
pub const LVM_SETINSERTMARKCOLOR = 0x10AA;
pub const LVM_GETINSERTMARKCOLOR = 0x10AB;
pub const LVM_SETINFOTIP = 0x10AD;
pub const LVM_GETSELECTEDCOLUMN = 0x10AE;
pub const LVM_ISGROUPVIEWENABLED = 0x10AF;
pub const LVM_GETOUTLINECOLOR = 0x10B0;
pub const LVM_SETOUTLINECOLOR = 0x10B1;
pub const LVM_CANCELEDITLABEL = 0x10B3;
pub const LVM_MAPINDEXTOID = 0x10B4;
pub const LVM_MAPIDTOINDEX = 0x10B5;
pub const LVM_ISITEMVISIBLE = 0x10B6;
pub const OCM__BASE = 0x2000;
pub const LVM_SETUNICODEFORMAT = 0x2005;
pub const LVM_GETUNICODEFORMAT = 0x2006;
pub const OCM_CTLCOLOR = 0x2019;
pub const OCM_DRAWITEM = 0x202B;
pub const OCM_MEASUREITEM = 0x202C;
pub const OCM_DELETEITEM = 0x202D;
pub const OCM_VKEYTOITEM = 0x202E;
pub const OCM_CHARTOITEM = 0x202F;
pub const OCM_COMPAREITEM = 0x2039;
pub const OCM_NOTIFY = 0x204E;
pub const OCM_COMMAND = 0x2111;
pub const OCM_HSCROLL = 0x2114;
pub const OCM_VSCROLL = 0x2115;
pub const OCM_CTLCOLORMSGBOX = 0x2132;
pub const OCM_CTLCOLOREDIT = 0x2133;
pub const OCM_CTLCOLORLISTBOX = 0x2134;
pub const OCM_CTLCOLORBTN = 0x2135;
pub const OCM_CTLCOLORDLG = 0x2136;
pub const OCM_CTLCOLORSCROLLBAR = 0x2137;
pub const OCM_CTLCOLORSTATIC = 0x2138;
pub const OCM_PARENTNOTIFY = 0x2210;
pub const WM_APP = 0x8000;
pub const WM_RASDIALEVENT = 0xCCCD;
pub extern "user32" fn GetMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) callconv(WINAPI) BOOL;
pub fn getMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void {
const r = GetMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (r == 0) return error.Quit;
if (r != -1) return;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn GetMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT) callconv(WINAPI) BOOL;
pub var pfnGetMessageW: @TypeOf(GetMessageW) = undefined;
pub fn getMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32) !void {
const function = selectSymbol(GetMessageW, pfnGetMessageW, .win2k);
const r = function(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax);
if (r == 0) return error.Quit;
if (r != -1) return;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub const PM_NOREMOVE = 0x0000;
pub const PM_REMOVE = 0x0001;
pub const PM_NOYIELD = 0x0002;
pub extern "user32" fn PeekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) callconv(WINAPI) BOOL;
pub fn peekMessageA(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool {
const r = PeekMessageA(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (r == 0) return false;
if (r != -1) return true;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn PeekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: UINT, wMsgFilterMax: UINT, wRemoveMsg: UINT) callconv(WINAPI) BOOL;
pub var pfnPeekMessageW: @TypeOf(PeekMessageW) = undefined;
pub fn peekMessageW(lpMsg: *MSG, hWnd: ?HWND, wMsgFilterMin: u32, wMsgFilterMax: u32, wRemoveMsg: u32) !bool {
const function = selectSymbol(PeekMessageW, pfnPeekMessageW, .win2k);
const r = function(lpMsg, hWnd, wMsgFilterMin, wMsgFilterMax, wRemoveMsg);
if (r == 0) return false;
if (r != -1) return true;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn TranslateMessage(lpMsg: *const MSG) callconv(WINAPI) BOOL;
pub fn translateMessage(lpMsg: *const MSG) bool {
return if (TranslateMessage(lpMsg) == 0) false else true;
}
pub extern "user32" fn DispatchMessageA(lpMsg: *const MSG) callconv(WINAPI) LRESULT;
pub fn dispatchMessageA(lpMsg: *const MSG) LRESULT {
return DispatchMessageA(lpMsg);
}
pub extern "user32" fn DispatchMessageW(lpMsg: *const MSG) callconv(WINAPI) LRESULT;
pub var pfnDispatchMessageW: @TypeOf(DispatchMessageW) = undefined;
pub fn dispatchMessageW(lpMsg: *const MSG) LRESULT {
const function = selectSymbol(DispatchMessageW, pfnDispatchMessageW, .win2k);
return function(lpMsg);
}
pub extern "user32" fn PostQuitMessage(nExitCode: i32) callconv(WINAPI) void;
pub fn postQuitMessage(nExitCode: i32) void {
PostQuitMessage(nExitCode);
}
pub extern "user32" fn DefWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
pub fn defWindowProcA(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT {
return DefWindowProcA(hWnd, Msg, wParam, lParam);
}
pub extern "user32" fn DefWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) callconv(WINAPI) LRESULT;
pub var pfnDefWindowProcW: @TypeOf(DefWindowProcW) = undefined;
pub fn defWindowProcW(hWnd: HWND, Msg: UINT, wParam: WPARAM, lParam: LPARAM) LRESULT {
const function = selectSymbol(DefWindowProcW, pfnDefWindowProcW, .win2k);
return function(hWnd, Msg, wParam, lParam);
}
// === Windows ===
pub const CS_VREDRAW = 0x0001;
pub const CS_HREDRAW = 0x0002;
pub const CS_DBLCLKS = 0x0008;
pub const CS_OWNDC = 0x0020;
pub const CS_CLASSDC = 0x0040;
pub const CS_PARENTDC = 0x0080;
pub const CS_NOCLOSE = 0x0200;
pub const CS_SAVEBITS = 0x0800;
pub const CS_BYTEALIGNCLIENT = 0x1000;
pub const CS_BYTEALIGNWINDOW = 0x2000;
pub const CS_GLOBALCLASS = 0x4000;
pub const WNDCLASSEXA = extern struct {
cbSize: UINT = @sizeOf(WNDCLASSEXA),
style: UINT,
lpfnWndProc: WNDPROC,
cbClsExtra: i32 = 0,
cbWndExtra: i32 = 0,
hInstance: HINSTANCE,
hIcon: ?HICON,
hCursor: ?HCURSOR,
hbrBackground: ?HBRUSH,
lpszMenuName: ?[*:0]const u8,
lpszClassName: [*:0]const u8,
hIconSm: ?HICON,
};
pub const WNDCLASSEXW = extern struct {
cbSize: UINT = @sizeOf(WNDCLASSEXW),
style: UINT,
lpfnWndProc: WNDPROC,
cbClsExtra: i32 = 0,
cbWndExtra: i32 = 0,
hInstance: HINSTANCE,
hIcon: ?HICON,
hCursor: ?HCURSOR,
hbrBackground: ?HBRUSH,
lpszMenuName: ?[*:0]const u16,
lpszClassName: [*:0]const u16,
hIconSm: ?HICON,
};
pub extern "user32" fn RegisterClassExA(*const WNDCLASSEXA) callconv(WINAPI) ATOM;
pub fn registerClassExA(window_class: *const WNDCLASSEXA) !ATOM {
const atom = RegisterClassExA(window_class);
if (atom != 0) return atom;
switch (GetLastError()) {
.CLASS_ALREADY_EXISTS => return error.AlreadyExists,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn RegisterClassExW(*const WNDCLASSEXW) callconv(WINAPI) ATOM;
pub var pfnRegisterClassExW: @TypeOf(RegisterClassExW) = undefined;
pub fn registerClassExW(window_class: *const WNDCLASSEXW) !ATOM {
const function = selectSymbol(RegisterClassExW, pfnRegisterClassExW, .win2k);
const atom = function(window_class);
if (atom != 0) return atom;
switch (GetLastError()) {
.CLASS_ALREADY_EXISTS => return error.AlreadyExists,
.CALL_NOT_IMPLEMENTED => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn UnregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) callconv(WINAPI) BOOL;
pub fn unregisterClassA(lpClassName: [*:0]const u8, hInstance: HINSTANCE) !void {
if (UnregisterClassA(lpClassName, hInstance) == 0) {
switch (GetLastError()) {
.CLASS_DOES_NOT_EXIST => return error.ClassDoesNotExist,
else => |err| return windows.unexpectedError(err),
}
}
}
pub extern "user32" fn UnregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) callconv(WINAPI) BOOL;
pub var pfnUnregisterClassW: @TypeOf(UnregisterClassW) = undefined;
pub fn unregisterClassW(lpClassName: [*:0]const u16, hInstance: HINSTANCE) !void {
const function = selectSymbol(UnregisterClassW, pfnUnregisterClassW, .win2k);
if (function(lpClassName, hInstance) == 0) {
switch (GetLastError()) {
.CLASS_DOES_NOT_EXIST => return error.ClassDoesNotExist,
else => |err| return windows.unexpectedError(err),
}
}
}
pub const WS_OVERLAPPED = 0x00000000;
pub const WS_POPUP = 0x80000000;
pub const WS_CHILD = 0x40000000;
pub const WS_MINIMIZE = 0x20000000;
pub const WS_VISIBLE = 0x10000000;
pub const WS_DISABLED = 0x08000000;
pub const WS_CLIPSIBLINGS = 0x04000000;
pub const WS_CLIPCHILDREN = 0x02000000;
pub const WS_MAXIMIZE = 0x01000000;
pub const WS_CAPTION = WS_BORDER | WS_DLGFRAME;
pub const WS_BORDER = 0x00800000;
pub const WS_DLGFRAME = 0x00400000;
pub const WS_VSCROLL = 0x00200000;
pub const WS_HSCROLL = 0x00100000;
pub const WS_SYSMENU = 0x00080000;
pub const WS_THICKFRAME = 0x00040000;
pub const WS_GROUP = 0x00020000;
pub const WS_TABSTOP = 0x00010000;
pub const WS_MINIMIZEBOX = 0x00020000;
pub const WS_MAXIMIZEBOX = 0x00010000;
pub const WS_TILED = WS_OVERLAPPED;
pub const WS_ICONIC = WS_MINIMIZE;
pub const WS_SIZEBOX = WS_THICKFRAME;
pub const WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW;
pub const WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX;
pub const WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU;
pub const WS_CHILDWINDOW = WS_CHILD;
pub const WS_EX_DLGMODALFRAME = 0x00000001;
pub const WS_EX_NOPARENTNOTIFY = 0x00000004;
pub const WS_EX_TOPMOST = 0x00000008;
pub const WS_EX_ACCEPTFILES = 0x00000010;
pub const WS_EX_TRANSPARENT = 0x00000020;
pub const WS_EX_MDICHILD = 0x00000040;
pub const WS_EX_TOOLWINDOW = 0x00000080;
pub const WS_EX_WINDOWEDGE = 0x00000100;
pub const WS_EX_CLIENTEDGE = 0x00000200;
pub const WS_EX_CONTEXTHELP = 0x00000400;
pub const WS_EX_RIGHT = 0x00001000;
pub const WS_EX_LEFT = 0x00000000;
pub const WS_EX_RTLREADING = 0x00002000;
pub const WS_EX_LTRREADING = 0x00000000;
pub const WS_EX_LEFTSCROLLBAR = 0x00004000;
pub const WS_EX_RIGHTSCROLLBAR = 0x00000000;
pub const WS_EX_CONTROLPARENT = 0x00010000;
pub const WS_EX_STATICEDGE = 0x00020000;
pub const WS_EX_APPWINDOW = 0x00040000;
pub const WS_EX_LAYERED = 0x00080000;
pub const WS_EX_OVERLAPPEDWINDOW = WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE;
pub const WS_EX_PALETTEWINDOW = WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST;
pub const CW_USEDEFAULT = @as(i32, @bitCast(@as(u32, 0x80000000)));
pub extern "user32" fn CreateWindowExA(dwExStyle: DWORD, lpClassName: [*:0]const u8, lpWindowName: [*:0]const u8, dwStyle: DWORD, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?LPVOID) callconv(WINAPI) ?HWND;
pub fn createWindowExA(dwExStyle: u32, lpClassName: [*:0]const u8, lpWindowName: [*:0]const u8, dwStyle: u32, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?*anyopaque) !HWND {
const window = CreateWindowExA(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWindParent, hMenu, hInstance, lpParam);
if (window) |win| return win;
switch (GetLastError()) {
.CLASS_DOES_NOT_EXIST => return error.ClassDoesNotExist,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn CreateWindowExW(dwExStyle: DWORD, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: DWORD, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?LPVOID) callconv(WINAPI) ?HWND;
pub var pfnCreateWindowExW: @TypeOf(CreateWindowExW) = undefined;
pub fn createWindowExW(dwExStyle: u32, lpClassName: [*:0]const u16, lpWindowName: [*:0]const u16, dwStyle: u32, X: i32, Y: i32, nWidth: i32, nHeight: i32, hWindParent: ?HWND, hMenu: ?HMENU, hInstance: HINSTANCE, lpParam: ?*anyopaque) !HWND {
const function = selectSymbol(CreateWindowExW, pfnCreateWindowExW, .win2k);
const window = function(dwExStyle, lpClassName, lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWindParent, hMenu, hInstance, lpParam);
if (window) |win| return win;
switch (GetLastError()) {
.CLASS_DOES_NOT_EXIST => return error.ClassDoesNotExist,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn DestroyWindow(hWnd: HWND) callconv(WINAPI) BOOL;
pub fn destroyWindow(hWnd: HWND) !void {
if (DestroyWindow(hWnd) == 0) {
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
}
pub const SW_HIDE = 0;
pub const SW_SHOWNORMAL = 1;
pub const SW_NORMAL = 1;
pub const SW_SHOWMINIMIZED = 2;
pub const SW_SHOWMAXIMIZED = 3;
pub const SW_MAXIMIZE = 3;
pub const SW_SHOWNOACTIVATE = 4;
pub const SW_SHOW = 5;
pub const SW_MINIMIZE = 6;
pub const SW_SHOWMINNOACTIVE = 7;
pub const SW_SHOWNA = 8;
pub const SW_RESTORE = 9;
pub const SW_SHOWDEFAULT = 10;
pub const SW_FORCEMINIMIZE = 11;
pub const SW_MAX = 11;
pub extern "user32" fn ShowWindow(hWnd: HWND, nCmdShow: i32) callconv(WINAPI) BOOL;
pub fn showWindow(hWnd: HWND, nCmdShow: i32) bool {
return (ShowWindow(hWnd, nCmdShow) == TRUE);
}
pub extern "user32" fn UpdateWindow(hWnd: HWND) callconv(WINAPI) BOOL;
pub fn updateWindow(hWnd: HWND) !void {
if (UpdateWindow(hWnd) == 0) {
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
}
pub extern "user32" fn AdjustWindowRectEx(lpRect: *RECT, dwStyle: DWORD, bMenu: BOOL, dwExStyle: DWORD) callconv(WINAPI) BOOL;
pub fn adjustWindowRectEx(lpRect: *RECT, dwStyle: u32, bMenu: bool, dwExStyle: u32) !void {
assert(dwStyle & WS_OVERLAPPED == 0);
if (AdjustWindowRectEx(lpRect, dwStyle, @intFromBool(bMenu), dwExStyle) == 0) {
switch (GetLastError()) {
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
}
pub const GWL_WNDPROC = -4;
pub const GWL_HINSTANCE = -6;
pub const GWL_HWNDPARENT = -8;
pub const GWL_STYLE = -16;
pub const GWL_EXSTYLE = -20;
pub const GWL_USERDATA = -21;
pub const GWL_ID = -12;
pub extern "user32" fn GetWindowLongA(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG;
pub fn getWindowLongA(hWnd: HWND, nIndex: i32) !i32 {
const value = GetWindowLongA(hWnd, nIndex);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn GetWindowLongW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG;
pub var pfnGetWindowLongW: @TypeOf(GetWindowLongW) = undefined;
pub fn getWindowLongW(hWnd: HWND, nIndex: i32) !i32 {
const function = selectSymbol(GetWindowLongW, pfnGetWindowLongW, .win2k);
const value = function(hWnd, nIndex);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn GetWindowLongPtrA(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG_PTR;
pub fn getWindowLongPtrA(hWnd: HWND, nIndex: i32) !isize {
// "When compiling for 32-bit Windows, GetWindowLongPtr is defined as a call to the GetWindowLong function."
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowlongptrw
if (@sizeOf(LONG_PTR) == 4) return getWindowLongA(hWnd, nIndex);
const value = GetWindowLongPtrA(hWnd, nIndex);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn GetWindowLongPtrW(hWnd: HWND, nIndex: i32) callconv(WINAPI) LONG_PTR;
pub var pfnGetWindowLongPtrW: @TypeOf(GetWindowLongPtrW) = undefined;
pub fn getWindowLongPtrW(hWnd: HWND, nIndex: i32) !isize {
if (@sizeOf(LONG_PTR) == 4) return getWindowLongW(hWnd, nIndex);
const function = selectSymbol(GetWindowLongPtrW, pfnGetWindowLongPtrW, .win2k);
const value = function(hWnd, nIndex);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn SetWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: LONG) callconv(WINAPI) LONG;
pub fn setWindowLongA(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
// [...] you should clear the last error information by calling SetLastError with 0 before calling SetWindowLong.
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setwindowlonga
SetLastError(.SUCCESS);
const value = SetWindowLongA(hWnd, nIndex, dwNewLong);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn SetWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: LONG) callconv(WINAPI) LONG;
pub var pfnSetWindowLongW: @TypeOf(SetWindowLongW) = undefined;
pub fn setWindowLongW(hWnd: HWND, nIndex: i32, dwNewLong: i32) !i32 {
const function = selectSymbol(SetWindowLongW, pfnSetWindowLongW, .win2k);
SetLastError(.SUCCESS);
const value = function(hWnd, nIndex, dwNewLong);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn SetWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: LONG_PTR) callconv(WINAPI) LONG_PTR;
pub fn setWindowLongPtrA(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
// "When compiling for 32-bit Windows, GetWindowLongPtr is defined as a call to the GetWindowLong function."
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getwindowlongptrw
if (@sizeOf(LONG_PTR) == 4) return setWindowLongA(hWnd, nIndex, dwNewLong);
SetLastError(.SUCCESS);
const value = SetWindowLongPtrA(hWnd, nIndex, dwNewLong);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn SetWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: LONG_PTR) callconv(WINAPI) LONG_PTR;
pub var pfnSetWindowLongPtrW: @TypeOf(SetWindowLongPtrW) = undefined;
pub fn setWindowLongPtrW(hWnd: HWND, nIndex: i32, dwNewLong: isize) !isize {
if (@sizeOf(LONG_PTR) == 4) return setWindowLongW(hWnd, nIndex, dwNewLong);
const function = selectSymbol(SetWindowLongPtrW, pfnSetWindowLongPtrW, .win2k);
SetLastError(.SUCCESS);
const value = function(hWnd, nIndex, dwNewLong);
if (value != 0) return value;
switch (GetLastError()) {
.SUCCESS => return 0,
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn GetDC(hWnd: ?HWND) callconv(WINAPI) ?HDC;
pub fn getDC(hWnd: ?HWND) !HDC {
const hdc = GetDC(hWnd);
if (hdc) |h| return h;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn ReleaseDC(hWnd: ?HWND, hDC: HDC) callconv(WINAPI) i32;
pub fn releaseDC(hWnd: ?HWND, hDC: HDC) bool {
return if (ReleaseDC(hWnd, hDC) == 1) true else false;
}
// === Modal dialogue boxes ===
pub const MB_OK = 0x00000000;
pub const MB_OKCANCEL = 0x00000001;
pub const MB_ABORTRETRYIGNORE = 0x00000002;
pub const MB_YESNOCANCEL = 0x00000003;
pub const MB_YESNO = 0x00000004;
pub const MB_RETRYCANCEL = 0x00000005;
pub const MB_CANCELTRYCONTINUE = 0x00000006;
pub const MB_ICONHAND = 0x00000010;
pub const MB_ICONQUESTION = 0x00000020;
pub const MB_ICONEXCLAMATION = 0x00000030;
pub const MB_ICONASTERISK = 0x00000040;
pub const MB_USERICON = 0x00000080;
pub const MB_ICONWARNING = MB_ICONEXCLAMATION;
pub const MB_ICONERROR = MB_ICONHAND;
pub const MB_ICONINFORMATION = MB_ICONASTERISK;
pub const MB_ICONSTOP = MB_ICONHAND;
pub const MB_DEFBUTTON1 = 0x00000000;
pub const MB_DEFBUTTON2 = 0x00000100;
pub const MB_DEFBUTTON3 = 0x00000200;
pub const MB_DEFBUTTON4 = 0x00000300;
pub const MB_APPLMODAL = 0x00000000;
pub const MB_SYSTEMMODAL = 0x00001000;
pub const MB_TASKMODAL = 0x00002000;
pub const MB_HELP = 0x00004000;
pub const MB_NOFOCUS = 0x00008000;
pub const MB_SETFOREGROUND = 0x00010000;
pub const MB_DEFAULT_DESKTOP_ONLY = 0x00020000;
pub const MB_TOPMOST = 0x00040000;
pub const MB_RIGHT = 0x00080000;
pub const MB_RTLREADING = 0x00100000;
pub const MB_TYPEMASK = 0x0000000F;
pub const MB_ICONMASK = 0x000000F0;
pub const MB_DEFMASK = 0x00000F00;
pub const MB_MODEMASK = 0x00003000;
pub const MB_MISCMASK = 0x0000C000;
pub const IDOK = 1;
pub const IDCANCEL = 2;
pub const IDABORT = 3;
pub const IDRETRY = 4;
pub const IDIGNORE = 5;
pub const IDYES = 6;
pub const IDNO = 7;
pub const IDCLOSE = 8;
pub const IDHELP = 9;
pub const IDTRYAGAIN = 10;
pub const IDCONTINUE = 11;
pub extern "user32" fn MessageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8, uType: UINT) callconv(WINAPI) i32;
pub fn messageBoxA(hWnd: ?HWND, lpText: [*:0]const u8, lpCaption: [*:0]const u8, uType: u32) !i32 {
const value = MessageBoxA(hWnd, lpText, lpCaption, uType);
if (value != 0) return value;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
pub extern "user32" fn MessageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: ?[*:0]const u16, uType: UINT) callconv(WINAPI) i32;
pub var pfnMessageBoxW: @TypeOf(MessageBoxW) = undefined;
pub fn messageBoxW(hWnd: ?HWND, lpText: [*:0]const u16, lpCaption: [*:0]const u16, uType: u32) !i32 {
const function = selectSymbol(MessageBoxW, pfnMessageBoxW, .win2k);
const value = function(hWnd, lpText, lpCaption, uType);
if (value != 0) return value;
switch (GetLastError()) {
.INVALID_WINDOW_HANDLE => unreachable,
.INVALID_PARAMETER => unreachable,
else => |err| return windows.unexpectedError(err),
}
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/ntdll.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const BOOL = windows.BOOL;
const DWORD = windows.DWORD;
const ULONG = windows.ULONG;
const WINAPI = windows.WINAPI;
const NTSTATUS = windows.NTSTATUS;
const WORD = windows.WORD;
const HANDLE = windows.HANDLE;
const ACCESS_MASK = windows.ACCESS_MASK;
const IO_APC_ROUTINE = windows.IO_APC_ROUTINE;
const BOOLEAN = windows.BOOLEAN;
const OBJECT_ATTRIBUTES = windows.OBJECT_ATTRIBUTES;
const PVOID = windows.PVOID;
const IO_STATUS_BLOCK = windows.IO_STATUS_BLOCK;
const LARGE_INTEGER = windows.LARGE_INTEGER;
const OBJECT_INFORMATION_CLASS = windows.OBJECT_INFORMATION_CLASS;
const FILE_INFORMATION_CLASS = windows.FILE_INFORMATION_CLASS;
const UNICODE_STRING = windows.UNICODE_STRING;
const RTL_OSVERSIONINFOW = windows.RTL_OSVERSIONINFOW;
const FILE_BASIC_INFORMATION = windows.FILE_BASIC_INFORMATION;
const SIZE_T = windows.SIZE_T;
const CURDIR = windows.CURDIR;
pub extern "NtDll" fn RtlGetVersion(
lpVersionInformation: *RTL_OSVERSIONINFOW,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn RtlCaptureStackBackTrace(
FramesToSkip: DWORD,
FramesToCapture: DWORD,
BackTrace: **anyopaque,
BackTraceHash: ?*DWORD,
) callconv(WINAPI) WORD;
pub extern "NtDll" fn NtQueryInformationFile(
FileHandle: HANDLE,
IoStatusBlock: *IO_STATUS_BLOCK,
FileInformation: *anyopaque,
Length: ULONG,
FileInformationClass: FILE_INFORMATION_CLASS,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtSetInformationFile(
FileHandle: HANDLE,
IoStatusBlock: *IO_STATUS_BLOCK,
FileInformation: PVOID,
Length: ULONG,
FileInformationClass: FILE_INFORMATION_CLASS,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtQueryAttributesFile(
ObjectAttributes: *OBJECT_ATTRIBUTES,
FileAttributes: *FILE_BASIC_INFORMATION,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtCreateFile(
FileHandle: *HANDLE,
DesiredAccess: ACCESS_MASK,
ObjectAttributes: *OBJECT_ATTRIBUTES,
IoStatusBlock: *IO_STATUS_BLOCK,
AllocationSize: ?*LARGE_INTEGER,
FileAttributes: ULONG,
ShareAccess: ULONG,
CreateDisposition: ULONG,
CreateOptions: ULONG,
EaBuffer: ?*anyopaque,
EaLength: ULONG,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtDeviceIoControlFile(
FileHandle: HANDLE,
Event: ?HANDLE,
ApcRoutine: ?IO_APC_ROUTINE,
ApcContext: ?*anyopaque,
IoStatusBlock: *IO_STATUS_BLOCK,
IoControlCode: ULONG,
InputBuffer: ?*const anyopaque,
InputBufferLength: ULONG,
OutputBuffer: ?PVOID,
OutputBufferLength: ULONG,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtFsControlFile(
FileHandle: HANDLE,
Event: ?HANDLE,
ApcRoutine: ?IO_APC_ROUTINE,
ApcContext: ?*anyopaque,
IoStatusBlock: *IO_STATUS_BLOCK,
FsControlCode: ULONG,
InputBuffer: ?*const anyopaque,
InputBufferLength: ULONG,
OutputBuffer: ?PVOID,
OutputBufferLength: ULONG,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtClose(Handle: HANDLE) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn RtlDosPathNameToNtPathName_U(
DosPathName: [*:0]const u16,
NtPathName: *UNICODE_STRING,
NtFileNamePart: ?*?[*:0]const u16,
DirectoryInfo: ?*CURDIR,
) callconv(WINAPI) BOOL;
pub extern "NtDll" fn RtlFreeUnicodeString(UnicodeString: *UNICODE_STRING) callconv(WINAPI) void;
pub extern "NtDll" fn NtQueryDirectoryFile(
FileHandle: HANDLE,
Event: ?HANDLE,
ApcRoutine: ?IO_APC_ROUTINE,
ApcContext: ?*anyopaque,
IoStatusBlock: *IO_STATUS_BLOCK,
FileInformation: *anyopaque,
Length: ULONG,
FileInformationClass: FILE_INFORMATION_CLASS,
ReturnSingleEntry: BOOLEAN,
FileName: ?*UNICODE_STRING,
RestartScan: BOOLEAN,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtCreateKeyedEvent(
KeyedEventHandle: *HANDLE,
DesiredAccess: ACCESS_MASK,
ObjectAttributes: ?PVOID,
Flags: ULONG,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtReleaseKeyedEvent(
EventHandle: ?HANDLE,
Key: ?*const anyopaque,
Alertable: BOOLEAN,
Timeout: ?*const LARGE_INTEGER,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtWaitForKeyedEvent(
EventHandle: ?HANDLE,
Key: ?*const anyopaque,
Alertable: BOOLEAN,
Timeout: ?*const LARGE_INTEGER,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn RtlSetCurrentDirectory_U(PathName: *UNICODE_STRING) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtQueryObject(
Handle: HANDLE,
ObjectInformationClass: OBJECT_INFORMATION_CLASS,
ObjectInformation: PVOID,
ObjectInformationLength: ULONG,
ReturnLength: ?*ULONG,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn RtlWakeAddressAll(
Address: ?*const anyopaque,
) callconv(WINAPI) void;
pub extern "NtDll" fn RtlWakeAddressSingle(
Address: ?*const anyopaque,
) callconv(WINAPI) void;
pub extern "NtDll" fn RtlWaitOnAddress(
Address: ?*const anyopaque,
CompareAddress: ?*const anyopaque,
AddressSize: SIZE_T,
Timeout: ?*const LARGE_INTEGER,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtLockFile(
FileHandle: HANDLE,
Event: ?HANDLE,
ApcRoutine: ?*IO_APC_ROUTINE,
ApcContext: ?*anyopaque,
IoStatusBlock: *IO_STATUS_BLOCK,
ByteOffset: *const LARGE_INTEGER,
Length: *const LARGE_INTEGER,
Key: ?*ULONG,
FailImmediately: BOOLEAN,
ExclusiveLock: BOOLEAN,
) callconv(WINAPI) NTSTATUS;
pub extern "NtDll" fn NtUnlockFile(
FileHandle: HANDLE,
IoStatusBlock: *IO_STATUS_BLOCK,
ByteOffset: *const LARGE_INTEGER,
Length: *const LARGE_INTEGER,
Key: ?*ULONG,
) callconv(WINAPI) NTSTATUS;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/winmm.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const WINAPI = windows.WINAPI;
const UINT = windows.UINT;
const BYTE = windows.BYTE;
const DWORD = windows.DWORD;
pub const MMRESULT = UINT;
pub const MMSYSERR_BASE = 0;
pub const TIMERR_BASE = 96;
pub const MMSYSERR_ERROR = MMSYSERR_BASE + 1;
pub const MMSYSERR_BADDEVICEID = MMSYSERR_BASE + 2;
pub const MMSYSERR_NOTENABLED = MMSYSERR_BASE + 3;
pub const MMSYSERR_ALLOCATED = MMSYSERR_BASE + 4;
pub const MMSYSERR_INVALHANDLE = MMSYSERR_BASE + 5;
pub const MMSYSERR_NODRIVER = MMSYSERR_BASE + 6;
pub const MMSYSERR_NOMEM = MMSYSERR_BASE + 7;
pub const MMSYSERR_NOTSUPPORTED = MMSYSERR_BASE + 8;
pub const MMSYSERR_BADERRNUM = MMSYSERR_BASE + 9;
pub const MMSYSERR_INVALFLAG = MMSYSERR_BASE + 10;
pub const MMSYSERR_INVALPARAM = MMSYSERR_BASE + 11;
pub const MMSYSERR_HANDLEBUSY = MMSYSERR_BASE + 12;
pub const MMSYSERR_INVALIDALIAS = MMSYSERR_BASE + 13;
pub const MMSYSERR_BADDB = MMSYSERR_BASE + 14;
pub const MMSYSERR_KEYNOTFOUND = MMSYSERR_BASE + 15;
pub const MMSYSERR_READERROR = MMSYSERR_BASE + 16;
pub const MMSYSERR_WRITEERROR = MMSYSERR_BASE + 17;
pub const MMSYSERR_DELETEERROR = MMSYSERR_BASE + 18;
pub const MMSYSERR_VALNOTFOUND = MMSYSERR_BASE + 19;
pub const MMSYSERR_NODRIVERCB = MMSYSERR_BASE + 20;
pub const MMSYSERR_MOREDATA = MMSYSERR_BASE + 21;
pub const MMSYSERR_LASTERROR = MMSYSERR_BASE + 21;
pub const MMTIME = extern struct {
wType: UINT,
u: extern union {
ms: DWORD,
sample: DWORD,
cb: DWORD,
ticks: DWORD,
smpte: extern struct {
hour: BYTE,
min: BYTE,
sec: BYTE,
frame: BYTE,
fps: BYTE,
dummy: BYTE,
pad: [2]BYTE,
},
midi: extern struct {
songptrpos: DWORD,
},
},
};
pub const LPMMTIME = *MMTIME;
pub const TIME_MS = 0x0001;
pub const TIME_SAMPLES = 0x0002;
pub const TIME_BYTES = 0x0004;
pub const TIME_SMPTE = 0x0008;
pub const TIME_MIDI = 0x0010;
pub const TIME_TICKS = 0x0020;
// timeapi.h
pub const TIMECAPS = extern struct { wPeriodMin: UINT, wPeriodMax: UINT };
pub const LPTIMECAPS = *TIMECAPS;
pub const TIMERR_NOERROR = 0;
pub const TIMERR_NOCANDO = TIMERR_BASE + 1;
pub const TIMERR_STRUCT = TIMERR_BASE + 33;
pub extern "winmm" fn timeBeginPeriod(uPeriod: UINT) callconv(WINAPI) MMRESULT;
pub extern "winmm" fn timeEndPeriod(uPeriod: UINT) callconv(WINAPI) MMRESULT;
pub extern "winmm" fn timeGetDevCaps(ptc: LPTIMECAPS, cbtc: UINT) callconv(WINAPI) MMRESULT;
pub extern "winmm" fn timeGetSystemTime(pmmt: LPMMTIME, cbmmt: UINT) callconv(WINAPI) MMRESULT;
pub extern "winmm" fn timeGetTime() callconv(WINAPI) DWORD;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/win32error.zig | /// Codes are from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/18d8fbe8-a967-4f1c-ae50-99ca8e491d2d
pub const Win32Error = enum(u16) {
/// The operation completed successfully.
SUCCESS = 0,
/// Incorrect function.
INVALID_FUNCTION = 1,
/// The system cannot find the file specified.
FILE_NOT_FOUND = 2,
/// The system cannot find the path specified.
PATH_NOT_FOUND = 3,
/// The system cannot open the file.
TOO_MANY_OPEN_FILES = 4,
/// Access is denied.
ACCESS_DENIED = 5,
/// The handle is invalid.
INVALID_HANDLE = 6,
/// The storage control blocks were destroyed.
ARENA_TRASHED = 7,
/// Not enough storage is available to process this command.
NOT_ENOUGH_MEMORY = 8,
/// The storage control block address is invalid.
INVALID_BLOCK = 9,
/// The environment is incorrect.
BAD_ENVIRONMENT = 10,
/// An attempt was made to load a program with an incorrect format.
BAD_FORMAT = 11,
/// The access code is invalid.
INVALID_ACCESS = 12,
/// The data is invalid.
INVALID_DATA = 13,
/// Not enough storage is available to complete this operation.
OUTOFMEMORY = 14,
/// The system cannot find the drive specified.
INVALID_DRIVE = 15,
/// The directory cannot be removed.
CURRENT_DIRECTORY = 16,
/// The system cannot move the file to a different disk drive.
NOT_SAME_DEVICE = 17,
/// There are no more files.
NO_MORE_FILES = 18,
/// The media is write protected.
WRITE_PROTECT = 19,
/// The system cannot find the device specified.
BAD_UNIT = 20,
/// The device is not ready.
NOT_READY = 21,
/// The device does not recognize the command.
BAD_COMMAND = 22,
/// Data error (cyclic redundancy check).
CRC = 23,
/// The program issued a command but the command length is incorrect.
BAD_LENGTH = 24,
/// The drive cannot locate a specific area or track on the disk.
SEEK = 25,
/// The specified disk or diskette cannot be accessed.
NOT_DOS_DISK = 26,
/// The drive cannot find the sector requested.
SECTOR_NOT_FOUND = 27,
/// The printer is out of paper.
OUT_OF_PAPER = 28,
/// The system cannot write to the specified device.
WRITE_FAULT = 29,
/// The system cannot read from the specified device.
READ_FAULT = 30,
/// A device attached to the system is not functioning.
GEN_FAILURE = 31,
/// The process cannot access the file because it is being used by another process.
SHARING_VIOLATION = 32,
/// The process cannot access the file because another process has locked a portion of the file.
LOCK_VIOLATION = 33,
/// The wrong diskette is in the drive.
/// Insert %2 (Volume Serial Number: %3) into drive %1.
WRONG_DISK = 34,
/// Too many files opened for sharing.
SHARING_BUFFER_EXCEEDED = 36,
/// Reached the end of the file.
HANDLE_EOF = 38,
/// The disk is full.
HANDLE_DISK_FULL = 39,
/// The request is not supported.
NOT_SUPPORTED = 50,
/// Windows cannot find the network path.
/// Verify that the network path is correct and the destination computer is not busy or turned off.
/// If Windows still cannot find the network path, contact your network administrator.
REM_NOT_LIST = 51,
/// You were not connected because a duplicate name exists on the network.
/// If joining a domain, go to System in Control Panel to change the computer name and try again.
/// If joining a workgroup, choose another workgroup name.
DUP_NAME = 52,
/// The network path was not found.
BAD_NETPATH = 53,
/// The network is busy.
NETWORK_BUSY = 54,
/// The specified network resource or device is no longer available.
DEV_NOT_EXIST = 55,
/// The network BIOS command limit has been reached.
TOO_MANY_CMDS = 56,
/// A network adapter hardware error occurred.
ADAP_HDW_ERR = 57,
/// The specified server cannot perform the requested operation.
BAD_NET_RESP = 58,
/// An unexpected network error occurred.
UNEXP_NET_ERR = 59,
/// The remote adapter is not compatible.
BAD_REM_ADAP = 60,
/// The printer queue is full.
PRINTQ_FULL = 61,
/// Space to store the file waiting to be printed is not available on the server.
NO_SPOOL_SPACE = 62,
/// Your file waiting to be printed was deleted.
PRINT_CANCELLED = 63,
/// The specified network name is no longer available.
NETNAME_DELETED = 64,
/// Network access is denied.
NETWORK_ACCESS_DENIED = 65,
/// The network resource type is not correct.
BAD_DEV_TYPE = 66,
/// The network name cannot be found.
BAD_NET_NAME = 67,
/// The name limit for the local computer network adapter card was exceeded.
TOO_MANY_NAMES = 68,
/// The network BIOS session limit was exceeded.
TOO_MANY_SESS = 69,
/// The remote server has been paused or is in the process of being started.
SHARING_PAUSED = 70,
/// No more connections can be made to this remote computer at this time because there are already as many connections as the computer can accept.
REQ_NOT_ACCEP = 71,
/// The specified printer or disk device has been paused.
REDIR_PAUSED = 72,
/// The file exists.
FILE_EXISTS = 80,
/// The directory or file cannot be created.
CANNOT_MAKE = 82,
/// Fail on INT 24.
FAIL_I24 = 83,
/// Storage to process this request is not available.
OUT_OF_STRUCTURES = 84,
/// The local device name is already in use.
ALREADY_ASSIGNED = 85,
/// The specified network password is not correct.
INVALID_PASSWORD = 86,
/// The parameter is incorrect.
INVALID_PARAMETER = 87,
/// A write fault occurred on the network.
NET_WRITE_FAULT = 88,
/// The system cannot start another process at this time.
NO_PROC_SLOTS = 89,
/// Cannot create another system semaphore.
TOO_MANY_SEMAPHORES = 100,
/// The exclusive semaphore is owned by another process.
EXCL_SEM_ALREADY_OWNED = 101,
/// The semaphore is set and cannot be closed.
SEM_IS_SET = 102,
/// The semaphore cannot be set again.
TOO_MANY_SEM_REQUESTS = 103,
/// Cannot request exclusive semaphores at interrupt time.
INVALID_AT_INTERRUPT_TIME = 104,
/// The previous ownership of this semaphore has ended.
SEM_OWNER_DIED = 105,
/// Insert the diskette for drive %1.
SEM_USER_LIMIT = 106,
/// The program stopped because an alternate diskette was not inserted.
DISK_CHANGE = 107,
/// The disk is in use or locked by another process.
DRIVE_LOCKED = 108,
/// The pipe has been ended.
BROKEN_PIPE = 109,
/// The system cannot open the device or file specified.
OPEN_FAILED = 110,
/// The file name is too long.
BUFFER_OVERFLOW = 111,
/// There is not enough space on the disk.
DISK_FULL = 112,
/// No more internal file identifiers available.
NO_MORE_SEARCH_HANDLES = 113,
/// The target internal file identifier is incorrect.
INVALID_TARGET_HANDLE = 114,
/// The IOCTL call made by the application program is not correct.
INVALID_CATEGORY = 117,
/// The verify-on-write switch parameter value is not correct.
INVALID_VERIFY_SWITCH = 118,
/// The system does not support the command requested.
BAD_DRIVER_LEVEL = 119,
/// This function is not supported on this system.
CALL_NOT_IMPLEMENTED = 120,
/// The semaphore timeout period has expired.
SEM_TIMEOUT = 121,
/// The data area passed to a system call is too small.
INSUFFICIENT_BUFFER = 122,
/// The filename, directory name, or volume label syntax is incorrect.
INVALID_NAME = 123,
/// The system call level is not correct.
INVALID_LEVEL = 124,
/// The disk has no volume label.
NO_VOLUME_LABEL = 125,
/// The specified module could not be found.
MOD_NOT_FOUND = 126,
/// The specified procedure could not be found.
PROC_NOT_FOUND = 127,
/// There are no child processes to wait for.
WAIT_NO_CHILDREN = 128,
/// The %1 application cannot be run in Win32 mode.
CHILD_NOT_COMPLETE = 129,
/// Attempt to use a file handle to an open disk partition for an operation other than raw disk I/O.
DIRECT_ACCESS_HANDLE = 130,
/// An attempt was made to move the file pointer before the beginning of the file.
NEGATIVE_SEEK = 131,
/// The file pointer cannot be set on the specified device or file.
SEEK_ON_DEVICE = 132,
/// A JOIN or SUBST command cannot be used for a drive that contains previously joined drives.
IS_JOIN_TARGET = 133,
/// An attempt was made to use a JOIN or SUBST command on a drive that has already been joined.
IS_JOINED = 134,
/// An attempt was made to use a JOIN or SUBST command on a drive that has already been substituted.
IS_SUBSTED = 135,
/// The system tried to delete the JOIN of a drive that is not joined.
NOT_JOINED = 136,
/// The system tried to delete the substitution of a drive that is not substituted.
NOT_SUBSTED = 137,
/// The system tried to join a drive to a directory on a joined drive.
JOIN_TO_JOIN = 138,
/// The system tried to substitute a drive to a directory on a substituted drive.
SUBST_TO_SUBST = 139,
/// The system tried to join a drive to a directory on a substituted drive.
JOIN_TO_SUBST = 140,
/// The system tried to SUBST a drive to a directory on a joined drive.
SUBST_TO_JOIN = 141,
/// The system cannot perform a JOIN or SUBST at this time.
BUSY_DRIVE = 142,
/// The system cannot join or substitute a drive to or for a directory on the same drive.
SAME_DRIVE = 143,
/// The directory is not a subdirectory of the root directory.
DIR_NOT_ROOT = 144,
/// The directory is not empty.
DIR_NOT_EMPTY = 145,
/// The path specified is being used in a substitute.
IS_SUBST_PATH = 146,
/// Not enough resources are available to process this command.
IS_JOIN_PATH = 147,
/// The path specified cannot be used at this time.
PATH_BUSY = 148,
/// An attempt was made to join or substitute a drive for which a directory on the drive is the target of a previous substitute.
IS_SUBST_TARGET = 149,
/// System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed.
SYSTEM_TRACE = 150,
/// The number of specified semaphore events for DosMuxSemWait is not correct.
INVALID_EVENT_COUNT = 151,
/// DosMuxSemWait did not execute; too many semaphores are already set.
TOO_MANY_MUXWAITERS = 152,
/// The DosMuxSemWait list is not correct.
INVALID_LIST_FORMAT = 153,
/// The volume label you entered exceeds the label character limit of the target file system.
LABEL_TOO_LONG = 154,
/// Cannot create another thread.
TOO_MANY_TCBS = 155,
/// The recipient process has refused the signal.
SIGNAL_REFUSED = 156,
/// The segment is already discarded and cannot be locked.
DISCARDED = 157,
/// The segment is already unlocked.
NOT_LOCKED = 158,
/// The address for the thread ID is not correct.
BAD_THREADID_ADDR = 159,
/// One or more arguments are not correct.
BAD_ARGUMENTS = 160,
/// The specified path is invalid.
BAD_PATHNAME = 161,
/// A signal is already pending.
SIGNAL_PENDING = 162,
/// No more threads can be created in the system.
MAX_THRDS_REACHED = 164,
/// Unable to lock a region of a file.
LOCK_FAILED = 167,
/// The requested resource is in use.
BUSY = 170,
/// Device's command support detection is in progress.
DEVICE_SUPPORT_IN_PROGRESS = 171,
/// A lock request was not outstanding for the supplied cancel region.
CANCEL_VIOLATION = 173,
/// The file system does not support atomic changes to the lock type.
ATOMIC_LOCKS_NOT_SUPPORTED = 174,
/// The system detected a segment number that was not correct.
INVALID_SEGMENT_NUMBER = 180,
/// The operating system cannot run %1.
INVALID_ORDINAL = 182,
/// Cannot create a file when that file already exists.
ALREADY_EXISTS = 183,
/// The flag passed is not correct.
INVALID_FLAG_NUMBER = 186,
/// The specified system semaphore name was not found.
SEM_NOT_FOUND = 187,
/// The operating system cannot run %1.
INVALID_STARTING_CODESEG = 188,
/// The operating system cannot run %1.
INVALID_STACKSEG = 189,
/// The operating system cannot run %1.
INVALID_MODULETYPE = 190,
/// Cannot run %1 in Win32 mode.
INVALID_EXE_SIGNATURE = 191,
/// The operating system cannot run %1.
EXE_MARKED_INVALID = 192,
/// %1 is not a valid Win32 application.
BAD_EXE_FORMAT = 193,
/// The operating system cannot run %1.
ITERATED_DATA_EXCEEDS_64k = 194,
/// The operating system cannot run %1.
INVALID_MINALLOCSIZE = 195,
/// The operating system cannot run this application program.
DYNLINK_FROM_INVALID_RING = 196,
/// The operating system is not presently configured to run this application.
IOPL_NOT_ENABLED = 197,
/// The operating system cannot run %1.
INVALID_SEGDPL = 198,
/// The operating system cannot run this application program.
AUTODATASEG_EXCEEDS_64k = 199,
/// The code segment cannot be greater than or equal to 64K.
RING2SEG_MUST_BE_MOVABLE = 200,
/// The operating system cannot run %1.
RELOC_CHAIN_XEEDS_SEGLIM = 201,
/// The operating system cannot run %1.
INFLOOP_IN_RELOC_CHAIN = 202,
/// The system could not find the environment option that was entered.
ENVVAR_NOT_FOUND = 203,
/// No process in the command subtree has a signal handler.
NO_SIGNAL_SENT = 205,
/// The filename or extension is too long.
FILENAME_EXCED_RANGE = 206,
/// The ring 2 stack is in use.
RING2_STACK_IN_USE = 207,
/// The global filename characters, * or ?, are entered incorrectly or too many global filename characters are specified.
META_EXPANSION_TOO_LONG = 208,
/// The signal being posted is not correct.
INVALID_SIGNAL_NUMBER = 209,
/// The signal handler cannot be set.
THREAD_1_INACTIVE = 210,
/// The segment is locked and cannot be reallocated.
LOCKED = 212,
/// Too many dynamic-link modules are attached to this program or dynamic-link module.
TOO_MANY_MODULES = 214,
/// Cannot nest calls to LoadModule.
NESTING_NOT_ALLOWED = 215,
/// This version of %1 is not compatible with the version of Windows you're running.
/// Check your computer's system information and then contact the software publisher.
EXE_MACHINE_TYPE_MISMATCH = 216,
/// The image file %1 is signed, unable to modify.
EXE_CANNOT_MODIFY_SIGNED_BINARY = 217,
/// The image file %1 is strong signed, unable to modify.
EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY = 218,
/// This file is checked out or locked for editing by another user.
FILE_CHECKED_OUT = 220,
/// The file must be checked out before saving changes.
CHECKOUT_REQUIRED = 221,
/// The file type being saved or retrieved has been blocked.
BAD_FILE_TYPE = 222,
/// The file size exceeds the limit allowed and cannot be saved.
FILE_TOO_LARGE = 223,
/// Access Denied. Before opening files in this location, you must first add the web site to your trusted sites list, browse to the web site, and select the option to login automatically.
FORMS_AUTH_REQUIRED = 224,
/// Operation did not complete successfully because the file contains a virus or potentially unwanted software.
VIRUS_INFECTED = 225,
/// This file contains a virus or potentially unwanted software and cannot be opened.
/// Due to the nature of this virus or potentially unwanted software, the file has been removed from this location.
VIRUS_DELETED = 226,
/// The pipe is local.
PIPE_LOCAL = 229,
/// The pipe state is invalid.
BAD_PIPE = 230,
/// All pipe instances are busy.
PIPE_BUSY = 231,
/// The pipe is being closed.
NO_DATA = 232,
/// No process is on the other end of the pipe.
PIPE_NOT_CONNECTED = 233,
/// More data is available.
MORE_DATA = 234,
/// The session was canceled.
VC_DISCONNECTED = 240,
/// The specified extended attribute name was invalid.
INVALID_EA_NAME = 254,
/// The extended attributes are inconsistent.
EA_LIST_INCONSISTENT = 255,
/// The wait operation timed out.
IMEOUT = 258,
/// No more data is available.
NO_MORE_ITEMS = 259,
/// The copy functions cannot be used.
CANNOT_COPY = 266,
/// The directory name is invalid.
DIRECTORY = 267,
/// The extended attributes did not fit in the buffer.
EAS_DIDNT_FIT = 275,
/// The extended attribute file on the mounted file system is corrupt.
EA_FILE_CORRUPT = 276,
/// The extended attribute table file is full.
EA_TABLE_FULL = 277,
/// The specified extended attribute handle is invalid.
INVALID_EA_HANDLE = 278,
/// The mounted file system does not support extended attributes.
EAS_NOT_SUPPORTED = 282,
/// Attempt to release mutex not owned by caller.
NOT_OWNER = 288,
/// Too many posts were made to a semaphore.
TOO_MANY_POSTS = 298,
/// Only part of a ReadProcessMemory or WriteProcessMemory request was completed.
PARTIAL_COPY = 299,
/// The oplock request is denied.
OPLOCK_NOT_GRANTED = 300,
/// An invalid oplock acknowledgment was received by the system.
INVALID_OPLOCK_PROTOCOL = 301,
/// The volume is too fragmented to complete this operation.
DISK_TOO_FRAGMENTED = 302,
/// The file cannot be opened because it is in the process of being deleted.
DELETE_PENDING = 303,
/// Short name settings may not be changed on this volume due to the global registry setting.
INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 304,
/// Short names are not enabled on this volume.
SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 305,
/// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.
SECURITY_STREAM_IS_INCONSISTENT = 306,
/// A requested file lock operation cannot be processed due to an invalid byte range.
INVALID_LOCK_RANGE = 307,
/// The subsystem needed to support the image type is not present.
IMAGE_SUBSYSTEM_NOT_PRESENT = 308,
/// The specified file already has a notification GUID associated with it.
NOTIFICATION_GUID_ALREADY_DEFINED = 309,
/// An invalid exception handler routine has been detected.
INVALID_EXCEPTION_HANDLER = 310,
/// Duplicate privileges were specified for the token.
DUPLICATE_PRIVILEGES = 311,
/// No ranges for the specified operation were able to be processed.
NO_RANGES_PROCESSED = 312,
/// Operation is not allowed on a file system internal file.
NOT_ALLOWED_ON_SYSTEM_FILE = 313,
/// The physical resources of this disk have been exhausted.
DISK_RESOURCES_EXHAUSTED = 314,
/// The token representing the data is invalid.
INVALID_TOKEN = 315,
/// The device does not support the command feature.
DEVICE_FEATURE_NOT_SUPPORTED = 316,
/// The system cannot find message text for message number 0x%1 in the message file for %2.
MR_MID_NOT_FOUND = 317,
/// The scope specified was not found.
SCOPE_NOT_FOUND = 318,
/// The Central Access Policy specified is not defined on the target machine.
UNDEFINED_SCOPE = 319,
/// The Central Access Policy obtained from Active Directory is invalid.
INVALID_CAP = 320,
/// The device is unreachable.
DEVICE_UNREACHABLE = 321,
/// The target device has insufficient resources to complete the operation.
DEVICE_NO_RESOURCES = 322,
/// A data integrity checksum error occurred. Data in the file stream is corrupt.
DATA_CHECKSUM_ERROR = 323,
/// An attempt was made to modify both a KERNEL and normal Extended Attribute (EA) in the same operation.
INTERMIXED_KERNEL_EA_OPERATION = 324,
/// Device does not support file-level TRIM.
FILE_LEVEL_TRIM_NOT_SUPPORTED = 326,
/// The command specified a data offset that does not align to the device's granularity/alignment.
OFFSET_ALIGNMENT_VIOLATION = 327,
/// The command specified an invalid field in its parameter list.
INVALID_FIELD_IN_PARAMETER_LIST = 328,
/// An operation is currently in progress with the device.
OPERATION_IN_PROGRESS = 329,
/// An attempt was made to send down the command via an invalid path to the target device.
BAD_DEVICE_PATH = 330,
/// The command specified a number of descriptors that exceeded the maximum supported by the device.
TOO_MANY_DESCRIPTORS = 331,
/// Scrub is disabled on the specified file.
SCRUB_DATA_DISABLED = 332,
/// The storage device does not provide redundancy.
NOT_REDUNDANT_STORAGE = 333,
/// An operation is not supported on a resident file.
RESIDENT_FILE_NOT_SUPPORTED = 334,
/// An operation is not supported on a compressed file.
COMPRESSED_FILE_NOT_SUPPORTED = 335,
/// An operation is not supported on a directory.
DIRECTORY_NOT_SUPPORTED = 336,
/// The specified copy of the requested data could not be read.
NOT_READ_FROM_COPY = 337,
/// No action was taken as a system reboot is required.
FAIL_NOACTION_REBOOT = 350,
/// The shutdown operation failed.
FAIL_SHUTDOWN = 351,
/// The restart operation failed.
FAIL_RESTART = 352,
/// The maximum number of sessions has been reached.
MAX_SESSIONS_REACHED = 353,
/// The thread is already in background processing mode.
THREAD_MODE_ALREADY_BACKGROUND = 400,
/// The thread is not in background processing mode.
THREAD_MODE_NOT_BACKGROUND = 401,
/// The process is already in background processing mode.
PROCESS_MODE_ALREADY_BACKGROUND = 402,
/// The process is not in background processing mode.
PROCESS_MODE_NOT_BACKGROUND = 403,
/// Attempt to access invalid address.
INVALID_ADDRESS = 487,
/// User profile cannot be loaded.
USER_PROFILE_LOAD = 500,
/// Arithmetic result exceeded 32 bits.
ARITHMETIC_OVERFLOW = 534,
/// There is a process on other end of the pipe.
PIPE_CONNECTED = 535,
/// Waiting for a process to open the other end of the pipe.
PIPE_LISTENING = 536,
/// Application verifier has found an error in the current process.
VERIFIER_STOP = 537,
/// An error occurred in the ABIOS subsystem.
ABIOS_ERROR = 538,
/// A warning occurred in the WX86 subsystem.
WX86_WARNING = 539,
/// An error occurred in the WX86 subsystem.
WX86_ERROR = 540,
/// An attempt was made to cancel or set a timer that has an associated APC and the subject thread is not the thread that originally set the timer with an associated APC routine.
TIMER_NOT_CANCELED = 541,
/// Unwind exception code.
UNWIND = 542,
/// An invalid or unaligned stack was encountered during an unwind operation.
BAD_STACK = 543,
/// An invalid unwind target was encountered during an unwind operation.
INVALID_UNWIND_TARGET = 544,
/// Invalid Object Attributes specified to NtCreatePort or invalid Port Attributes specified to NtConnectPort
INVALID_PORT_ATTRIBUTES = 545,
/// Length of message passed to NtRequestPort or NtRequestWaitReplyPort was longer than the maximum message allowed by the port.
PORT_MESSAGE_TOO_LONG = 546,
/// An attempt was made to lower a quota limit below the current usage.
INVALID_QUOTA_LOWER = 547,
/// An attempt was made to attach to a device that was already attached to another device.
DEVICE_ALREADY_ATTACHED = 548,
/// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.
INSTRUCTION_MISALIGNMENT = 549,
/// Profiling not started.
PROFILING_NOT_STARTED = 550,
/// Profiling not stopped.
PROFILING_NOT_STOPPED = 551,
/// The passed ACL did not contain the minimum required information.
COULD_NOT_INTERPRET = 552,
/// The number of active profiling objects is at the maximum and no more may be started.
PROFILING_AT_LIMIT = 553,
/// Used to indicate that an operation cannot continue without blocking for I/O.
CANT_WAIT = 554,
/// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process.
CANT_TERMINATE_SELF = 555,
/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter.
/// In this case information is lost, however, the filter correctly handles the exception.
UNEXPECTED_MM_CREATE_ERR = 556,
/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter.
/// In this case information is lost, however, the filter correctly handles the exception.
UNEXPECTED_MM_MAP_ERROR = 557,
/// If an MM error is returned which is not defined in the standard FsRtl filter, it is converted to one of the following errors which is guaranteed to be in the filter.
/// In this case information is lost, however, the filter correctly handles the exception.
UNEXPECTED_MM_EXTEND_ERR = 558,
/// A malformed function table was encountered during an unwind operation.
BAD_FUNCTION_TABLE = 559,
/// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system.
/// This causes the protection attempt to fail, which may cause a file creation attempt to fail.
NO_GUID_TRANSLATION = 560,
/// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors.
INVALID_LDT_SIZE = 561,
/// Indicates that the starting value for the LDT information was not an integral multiple of the selector size.
INVALID_LDT_OFFSET = 563,
/// Indicates that the user supplied an invalid descriptor when trying to set up Ldt descriptors.
INVALID_LDT_DESCRIPTOR = 564,
/// Indicates a process has too many threads to perform the requested action.
/// For example, assignment of a primary token may only be performed when a process has zero or one threads.
TOO_MANY_THREADS = 565,
/// An attempt was made to operate on a thread within a specific process, but the thread specified is not in the process specified.
THREAD_NOT_IN_PROCESS = 566,
/// Page file quota was exceeded.
PAGEFILE_QUOTA_EXCEEDED = 567,
/// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role.
LOGON_SERVER_CONFLICT = 568,
/// The SAM database on a Windows Server is significantly out of synchronization with the copy on the Domain Controller. A complete synchronization is required.
SYNCHRONIZATION_REQUIRED = 569,
/// The NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines.
NET_OPEN_FAILED = 570,
/// {Privilege Failed} The I/O permissions for the process could not be changed.
IO_PRIVILEGE_FAILED = 571,
/// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.
CONTROL_C_EXIT = 572,
/// {Missing System File} The required system file %hs is bad or missing.
MISSING_SYSTEMFILE = 573,
/// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx.
UNHANDLED_EXCEPTION = 574,
/// {Application Error} The application was unable to start correctly (0x%lx). Click OK to close the application.
APP_INIT_FAILURE = 575,
/// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld.
PAGEFILE_CREATE_FAILED = 576,
/// Windows cannot verify the digital signature for this file.
/// A recent hardware or software change might have installed a file that is signed incorrectly or damaged, or that might be malicious software from an unknown source.
INVALID_IMAGE_HASH = 577,
/// {No Paging File Specified} No paging file was specified in the system configuration.
NO_PAGEFILE = 578,
/// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present.
ILLEGAL_FLOAT_CONTEXT = 579,
/// An event pair synchronization operation was performed using the thread specific client/server event pair object, but no event pair object was associated with the thread.
NO_EVENT_PAIR = 580,
/// A Windows Server has an incorrect configuration.
DOMAIN_CTRLR_CONFIG_ERROR = 581,
/// An illegal character was encountered.
/// For a multi-byte character set this includes a lead byte without a succeeding trail byte.
/// For the Unicode character set this includes the characters 0xFFFF and 0xFFFE.
ILLEGAL_CHARACTER = 582,
/// The Unicode character is not defined in the Unicode character set installed on the system.
UNDEFINED_CHARACTER = 583,
/// The paging file cannot be created on a floppy diskette.
FLOPPY_VOLUME = 584,
/// The system BIOS failed to connect a system interrupt to the device or bus for which the device is connected.
BIOS_FAILED_TO_CONNECT_INTERRUPT = 585,
/// This operation is only allowed for the Primary Domain Controller of the domain.
BACKUP_CONTROLLER = 586,
/// An attempt was made to acquire a mutant such that its maximum count would have been exceeded.
MUTANT_LIMIT_EXCEEDED = 587,
/// A volume has been accessed for which a file system driver is required that has not yet been loaded.
FS_DRIVER_REQUIRED = 588,
/// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable.
CANNOT_LOAD_REGISTRY_FILE = 589,
/// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request.
/// You may choose OK to terminate the process, or Cancel to ignore the error.
DEBUG_ATTACH_FAILED = 590,
/// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down.
SYSTEM_PROCESS_TERMINATED = 591,
/// {Data Not Accepted} The TDI client could not handle the data received during an indication.
DATA_NOT_ACCEPTED = 592,
/// NTVDM encountered a hard error.
VDM_HARD_ERROR = 593,
/// {Cancel Timeout} The driver %hs failed to complete a cancelled I/O request in the allotted time.
DRIVER_CANCEL_TIMEOUT = 594,
/// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message.
REPLY_MESSAGE_MISMATCH = 595,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost.
/// This error may be caused by a failure of your computer hardware or network connection. Please try to save this file elsewhere.
LOST_WRITEBEHIND_DATA = 596,
/// The parameter(s) passed to the server in the client/server shared memory window were invalid.
/// Too much data may have been put in the shared memory window.
CLIENT_SERVER_PARAMETERS_INVALID = 597,
/// The stream is not a tiny stream.
NOT_TINY_STREAM = 598,
/// The request must be handled by the stack overflow code.
STACK_OVERFLOW_READ = 599,
/// Internal OFS status codes indicating how an allocation operation is handled.
/// Either it is retried after the containing onode is moved or the extent stream is converted to a large stream.
CONVERT_TO_LARGE = 600,
/// The attempt to find the object found an object matching by ID on the volume but it is out of the scope of the handle used for the operation.
FOUND_OUT_OF_SCOPE = 601,
/// The bucket array must be grown. Retry transaction after doing so.
ALLOCATE_BUCKET = 602,
/// The user/kernel marshalling buffer has overflowed.
MARSHALL_OVERFLOW = 603,
/// The supplied variant structure contains invalid data.
INVALID_VARIANT = 604,
/// The specified buffer contains ill-formed data.
BAD_COMPRESSION_BUFFER = 605,
/// {Audit Failed} An attempt to generate a security audit failed.
AUDIT_FAILED = 606,
/// The timer resolution was not previously set by the current process.
TIMER_RESOLUTION_NOT_SET = 607,
/// There is insufficient account information to log you on.
INSUFFICIENT_LOGON_INFO = 608,
/// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly.
/// The stack pointer has been left in an inconsistent state.
/// The entrypoint should be declared as WINAPI or STDCALL.
/// Select YES to fail the DLL load. Select NO to continue execution.
/// Selecting NO may cause the application to operate incorrectly.
BAD_DLL_ENTRYPOINT = 609,
/// {Invalid Service Callback Entrypoint} The %hs service is not written correctly.
/// The stack pointer has been left in an inconsistent state.
/// The callback entrypoint should be declared as WINAPI or STDCALL.
/// Selecting OK will cause the service to continue operation.
/// However, the service process may operate incorrectly.
BAD_SERVICE_ENTRYPOINT = 610,
/// There is an IP address conflict with another system on the network.
IP_ADDRESS_CONFLICT1 = 611,
/// There is an IP address conflict with another system on the network.
IP_ADDRESS_CONFLICT2 = 612,
/// {Low On Registry Space} The system has reached the maximum size allowed for the system part of the registry. Additional storage requests will be ignored.
REGISTRY_QUOTA_LIMIT = 613,
/// A callback return system service cannot be executed when no callback is active.
NO_CALLBACK_ACTIVE = 614,
/// The password provided is too short to meet the policy of your user account. Please choose a longer password.
PWD_TOO_SHORT = 615,
/// The policy of your user account does not allow you to change passwords too frequently.
/// This is done to prevent users from changing back to a familiar, but potentially discovered, password.
/// If you feel your password has been compromised then please contact your administrator immediately to have a new one assigned.
PWD_TOO_RECENT = 616,
/// You have attempted to change your password to one that you have used in the past.
/// The policy of your user account does not allow this.
/// Please select a password that you have not previously used.
PWD_HISTORY_CONFLICT = 617,
/// The specified compression format is unsupported.
UNSUPPORTED_COMPRESSION = 618,
/// The specified hardware profile configuration is invalid.
INVALID_HW_PROFILE = 619,
/// The specified Plug and Play registry device path is invalid.
INVALID_PLUGPLAY_DEVICE_PATH = 620,
/// The specified quota list is internally inconsistent with its descriptor.
QUOTA_LIST_INCONSISTENT = 621,
/// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour.
/// To restore access to this installation of Windows, please upgrade this installation using a licensed distribution of this product.
EVALUATION_EXPIRATION = 622,
/// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly.
/// The relocation occurred because the DLL %hs occupied an address range reserved for Windows system DLLs.
/// The vendor supplying the DLL should be contacted for a new DLL.
ILLEGAL_DLL_RELOCATION = 623,
/// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down.
DLL_INIT_FAILED_LOGOFF = 624,
/// The validation process needs to continue on to the next step.
VALIDATE_CONTINUE = 625,
/// There are no more matches for the current index enumeration.
NO_MORE_MATCHES = 626,
/// The range could not be added to the range list because of a conflict.
RANGE_LIST_CONFLICT = 627,
/// The server process is running under a SID different than that required by client.
SERVER_SID_MISMATCH = 628,
/// A group marked use for deny only cannot be enabled.
CANT_ENABLE_DENY_ONLY = 629,
/// {EXCEPTION} Multiple floating point faults.
FLOAT_MULTIPLE_FAULTS = 630,
/// {EXCEPTION} Multiple floating point traps.
FLOAT_MULTIPLE_TRAPS = 631,
/// The requested interface is not supported.
NOINTERFACE = 632,
/// {System Standby Failed} The driver %hs does not support standby mode.
/// Updating this driver may allow the system to go to standby mode.
DRIVER_FAILED_SLEEP = 633,
/// The system file %1 has become corrupt and has been replaced.
CORRUPT_SYSTEM_FILE = 634,
/// {Virtual Memory Minimum Too Low} Your system is low on virtual memory.
/// Windows is increasing the size of your virtual memory paging file.
/// During this process, memory requests for some applications may be denied. For more information, see Help.
COMMITMENT_MINIMUM = 635,
/// A device was removed so enumeration must be restarted.
PNP_RESTART_ENUMERATION = 636,
/// {Fatal System Error} The system image %s is not properly signed.
/// The file has been replaced with the signed file. The system has been shut down.
SYSTEM_IMAGE_BAD_SIGNATURE = 637,
/// Device will not start without a reboot.
PNP_REBOOT_REQUIRED = 638,
/// There is not enough power to complete the requested operation.
INSUFFICIENT_POWER = 639,
/// ERROR_MULTIPLE_FAULT_VIOLATION
MULTIPLE_FAULT_VIOLATION = 640,
/// The system is in the process of shutting down.
SYSTEM_SHUTDOWN = 641,
/// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process.
PORT_NOT_SET = 642,
/// This version of Windows is not compatible with the behavior version of directory forest, domain or domain controller.
DS_VERSION_CHECK_FAILURE = 643,
/// The specified range could not be found in the range list.
RANGE_NOT_FOUND = 644,
/// The driver was not loaded because the system is booting into safe mode.
NOT_SAFE_MODE_DRIVER = 646,
/// The driver was not loaded because it failed its initialization call.
FAILED_DRIVER_ENTRY = 647,
/// The "%hs" encountered an error while applying power or reading the device configuration.
/// This may be caused by a failure of your hardware or by a poor connection.
DEVICE_ENUMERATION_ERROR = 648,
/// The create operation failed because the name contained at least one mount point which resolves to a volume to which the specified device object is not attached.
MOUNT_POINT_NOT_RESOLVED = 649,
/// The device object parameter is either not a valid device object or is not attached to the volume specified by the file name.
INVALID_DEVICE_OBJECT_PARAMETER = 650,
/// A Machine Check Error has occurred.
/// Please check the system eventlog for additional information.
MCA_OCCURED = 651,
/// There was error [%2] processing the driver database.
DRIVER_DATABASE_ERROR = 652,
/// System hive size has exceeded its limit.
SYSTEM_HIVE_TOO_LARGE = 653,
/// The driver could not be loaded because a previous version of the driver is still in memory.
DRIVER_FAILED_PRIOR_UNLOAD = 654,
/// {Volume Shadow Copy Service} Please wait while the Volume Shadow Copy Service prepares volume %hs for hibernation.
VOLSNAP_PREPARE_HIBERNATE = 655,
/// The system has failed to hibernate (The error code is %hs).
/// Hibernation will be disabled until the system is restarted.
HIBERNATION_FAILURE = 656,
/// The password provided is too long to meet the policy of your user account. Please choose a shorter password.
PWD_TOO_LONG = 657,
/// The requested operation could not be completed due to a file system limitation.
FILE_SYSTEM_LIMITATION = 665,
/// An assertion failure has occurred.
ASSERTION_FAILURE = 668,
/// An error occurred in the ACPI subsystem.
ACPI_ERROR = 669,
/// WOW Assertion Error.
WOW_ASSERTION = 670,
/// A device is missing in the system BIOS MPS table. This device will not be used.
/// Please contact your system vendor for system BIOS update.
PNP_BAD_MPS_TABLE = 671,
/// A translator failed to translate resources.
PNP_TRANSLATION_FAILED = 672,
/// A IRQ translator failed to translate resources.
PNP_IRQ_TRANSLATION_FAILED = 673,
/// Driver %2 returned invalid ID for a child device (%3).
PNP_INVALID_ID = 674,
/// {Kernel Debugger Awakened} the system debugger was awakened by an interrupt.
WAKE_SYSTEM_DEBUGGER = 675,
/// {Handles Closed} Handles to objects have been automatically closed as a result of the requested operation.
HANDLES_CLOSED = 676,
/// {Too Much Information} The specified access control list (ACL) contained more information than was expected.
EXTRANEOUS_INFORMATION = 677,
/// This warning level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted.
/// The commit has NOT been completed, but has not been rolled back either (so it may still be committed if desired).
RXACT_COMMIT_NECESSARY = 678,
/// {Media Changed} The media may have changed.
MEDIA_CHECK = 679,
/// {GUID Substitution} During the translation of a global identifier (GUID) to a Windows security ID (SID), no administratively-defined GUID prefix was found.
/// A substitute prefix was used, which will not compromise system security.
/// However, this may provide a more restrictive access than intended.
GUID_SUBSTITUTION_MADE = 680,
/// The create operation stopped after reaching a symbolic link.
STOPPED_ON_SYMLINK = 681,
/// A long jump has been executed.
LONGJUMP = 682,
/// The Plug and Play query operation was not successful.
PLUGPLAY_QUERY_VETOED = 683,
/// A frame consolidation has been executed.
UNWIND_CONSOLIDATE = 684,
/// {Registry Hive Recovered} Registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost.
REGISTRY_HIVE_RECOVERED = 685,
/// The application is attempting to run executable code from the module %hs. This may be insecure.
/// An alternative, %hs, is available. Should the application use the secure module %hs?
DLL_MIGHT_BE_INSECURE = 686,
/// The application is loading executable code from the module %hs.
/// This is secure, but may be incompatible with previous releases of the operating system.
/// An alternative, %hs, is available. Should the application use the secure module %hs?
DLL_MIGHT_BE_INCOMPATIBLE = 687,
/// Debugger did not handle the exception.
DBG_EXCEPTION_NOT_HANDLED = 688,
/// Debugger will reply later.
DBG_REPLY_LATER = 689,
/// Debugger cannot provide handle.
DBG_UNABLE_TO_PROVIDE_HANDLE = 690,
/// Debugger terminated thread.
DBG_TERMINATE_THREAD = 691,
/// Debugger terminated process.
DBG_TERMINATE_PROCESS = 692,
/// Debugger got control C.
DBG_CONTROL_C = 693,
/// Debugger printed exception on control C.
DBG_PRINTEXCEPTION_C = 694,
/// Debugger received RIP exception.
DBG_RIPEXCEPTION = 695,
/// Debugger received control break.
DBG_CONTROL_BREAK = 696,
/// Debugger command communication exception.
DBG_COMMAND_EXCEPTION = 697,
/// {Object Exists} An attempt was made to create an object and the object name already existed.
OBJECT_NAME_EXISTS = 698,
/// {Thread Suspended} A thread termination occurred while the thread was suspended.
/// The thread was resumed, and termination proceeded.
THREAD_WAS_SUSPENDED = 699,
/// {Image Relocated} An image file could not be mapped at the address specified in the image file. Local fixups must be performed on this image.
IMAGE_NOT_AT_BASE = 700,
/// This informational level status indicates that a specified registry sub-tree transaction state did not yet exist and had to be created.
RXACT_STATE_CREATED = 701,
/// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image.
/// An exception is raised so a debugger can load, unload or track symbols and breakpoints within these 16-bit segments.
SEGMENT_NOTIFICATION = 702,
/// {Invalid Current Directory} The process cannot switch to the startup current directory %hs.
/// Select OK to set current directory to %hs, or select CANCEL to exit.
BAD_CURRENT_DIRECTORY = 703,
/// {Redundant Read} To satisfy a read request, the NT fault-tolerant file system successfully read the requested data from a redundant copy.
/// This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was unable to reassign the failing area of the device.
FT_READ_RECOVERY_FROM_BACKUP = 704,
/// {Redundant Write} To satisfy a write request, the NT fault-tolerant file system successfully wrote a redundant copy of the information.
/// This was done because the file system encountered a failure on a member of the fault-tolerant volume, but was not able to reassign the failing area of the device.
FT_WRITE_RECOVERY = 705,
/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine.
/// Select OK to continue, or CANCEL to fail the DLL load.
IMAGE_MACHINE_TYPE_MISMATCH = 706,
/// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later.
RECEIVE_PARTIAL = 707,
/// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system.
RECEIVE_EXPEDITED = 708,
/// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later.
RECEIVE_PARTIAL_EXPEDITED = 709,
/// {TDI Event Done} The TDI indication has completed successfully.
EVENT_DONE = 710,
/// {TDI Event Pending} The TDI indication has entered the pending state.
EVENT_PENDING = 711,
/// Checking file system on %wZ.
CHECKING_FILE_SYSTEM = 712,
/// {Fatal Application Exit} %hs.
FATAL_APP_EXIT = 713,
/// The specified registry key is referenced by a predefined handle.
PREDEFINED_HANDLE = 714,
/// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process.
WAS_UNLOCKED = 715,
/// %hs
SERVICE_NOTIFICATION = 716,
/// {Page Locked} One of the pages to lock was already locked.
WAS_LOCKED = 717,
/// Application popup: %1 : %2
LOG_HARD_ERROR = 718,
/// ERROR_ALREADY_WIN32
ALREADY_WIN32 = 719,
/// {Machine Type Mismatch} The image file %hs is valid, but is for a machine type other than the current machine.
IMAGE_MACHINE_TYPE_MISMATCH_EXE = 720,
/// A yield execution was performed and no thread was available to run.
NO_YIELD_PERFORMED = 721,
/// The resumable flag to a timer API was ignored.
TIMER_RESUME_IGNORED = 722,
/// The arbiter has deferred arbitration of these resources to its parent.
ARBITRATION_UNHANDLED = 723,
/// The inserted CardBus device cannot be started because of a configuration error on "%hs".
CARDBUS_NOT_SUPPORTED = 724,
/// The CPUs in this multiprocessor system are not all the same revision level.
/// To use all processors the operating system restricts itself to the features of the least capable processor in the system.
/// Should problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported.
MP_PROCESSOR_MISMATCH = 725,
/// The system was put into hibernation.
HIBERNATED = 726,
/// The system was resumed from hibernation.
RESUME_HIBERNATION = 727,
/// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3].
FIRMWARE_UPDATED = 728,
/// A device driver is leaking locked I/O pages causing system degradation.
/// The system has automatically enabled tracking code in order to try and catch the culprit.
DRIVERS_LEAKING_LOCKED_PAGES = 729,
/// The system has awoken.
WAKE_SYSTEM = 730,
/// ERROR_WAIT_1
WAIT_1 = 731,
/// ERROR_WAIT_2
WAIT_2 = 732,
/// ERROR_WAIT_3
WAIT_3 = 733,
/// ERROR_WAIT_63
WAIT_63 = 734,
/// ERROR_ABANDONED_WAIT_0
ABANDONED_WAIT_0 = 735,
/// ERROR_ABANDONED_WAIT_63
ABANDONED_WAIT_63 = 736,
/// ERROR_USER_APC
USER_APC = 737,
/// ERROR_KERNEL_APC
KERNEL_APC = 738,
/// ERROR_ALERTED
ALERTED = 739,
/// The requested operation requires elevation.
ELEVATION_REQUIRED = 740,
/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.
REPARSE = 741,
/// An open/create operation completed while an oplock break is underway.
OPLOCK_BREAK_IN_PROGRESS = 742,
/// A new volume has been mounted by a file system.
VOLUME_MOUNTED = 743,
/// This success level status indicates that the transaction state already exists for the registry sub-tree, but that a transaction commit was previously aborted. The commit has now been completed.
RXACT_COMMITTED = 744,
/// This indicates that a notify change request has been completed due to closing the handle which made the notify change request.
NOTIFY_CLEANUP = 745,
/// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed.
/// The computer WAS able to connect on a secondary transport.
PRIMARY_TRANSPORT_CONNECT_FAILED = 746,
/// Page fault was a transition fault.
PAGE_FAULT_TRANSITION = 747,
/// Page fault was a demand zero fault.
PAGE_FAULT_DEMAND_ZERO = 748,
/// Page fault was a demand zero fault.
PAGE_FAULT_COPY_ON_WRITE = 749,
/// Page fault was a demand zero fault.
PAGE_FAULT_GUARD_PAGE = 750,
/// Page fault was satisfied by reading from a secondary storage device.
PAGE_FAULT_PAGING_FILE = 751,
/// Cached page was locked during operation.
CACHE_PAGE_LOCKED = 752,
/// Crash dump exists in paging file.
CRASH_DUMP = 753,
/// Specified buffer contains all zeros.
BUFFER_ALL_ZEROS = 754,
/// A reparse should be performed by the Object Manager since the name of the file resulted in a symbolic link.
REPARSE_OBJECT = 755,
/// The device has succeeded a query-stop and its resource requirements have changed.
RESOURCE_REQUIREMENTS_CHANGED = 756,
/// The translator has translated these resources into the global space and no further translations should be performed.
TRANSLATION_COMPLETE = 757,
/// A process being terminated has no threads to terminate.
NOTHING_TO_TERMINATE = 758,
/// The specified process is not part of a job.
PROCESS_NOT_IN_JOB = 759,
/// The specified process is part of a job.
PROCESS_IN_JOB = 760,
/// {Volume Shadow Copy Service} The system is now ready for hibernation.
VOLSNAP_HIBERNATE_READY = 761,
/// A file system or file system filter driver has successfully completed an FsFilter operation.
FSFILTER_OP_COMPLETED_SUCCESSFULLY = 762,
/// The specified interrupt vector was already connected.
INTERRUPT_VECTOR_ALREADY_CONNECTED = 763,
/// The specified interrupt vector is still connected.
INTERRUPT_STILL_CONNECTED = 764,
/// An operation is blocked waiting for an oplock.
WAIT_FOR_OPLOCK = 765,
/// Debugger handled exception.
DBG_EXCEPTION_HANDLED = 766,
/// Debugger continued.
DBG_CONTINUE = 767,
/// An exception occurred in a user mode callback and the kernel callback frame should be removed.
CALLBACK_POP_STACK = 768,
/// Compression is disabled for this volume.
COMPRESSION_DISABLED = 769,
/// The data provider cannot fetch backwards through a result set.
CANTFETCHBACKWARDS = 770,
/// The data provider cannot scroll backwards through a result set.
CANTSCROLLBACKWARDS = 771,
/// The data provider requires that previously fetched data is released before asking for more data.
ROWSNOTRELEASED = 772,
/// The data provider was not able to interpret the flags set for a column binding in an accessor.
BAD_ACCESSOR_FLAGS = 773,
/// One or more errors occurred while processing the request.
ERRORS_ENCOUNTERED = 774,
/// The implementation is not capable of performing the request.
NOT_CAPABLE = 775,
/// The client of a component requested an operation which is not valid given the state of the component instance.
REQUEST_OUT_OF_SEQUENCE = 776,
/// A version number could not be parsed.
VERSION_PARSE_ERROR = 777,
/// The iterator's start position is invalid.
BADSTARTPOSITION = 778,
/// The hardware has reported an uncorrectable memory error.
MEMORY_HARDWARE = 779,
/// The attempted operation required self healing to be enabled.
DISK_REPAIR_DISABLED = 780,
/// The Desktop heap encountered an error while allocating session memory.
/// There is more information in the system event log.
INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 781,
/// The system power state is transitioning from %2 to %3.
SYSTEM_POWERSTATE_TRANSITION = 782,
/// The system power state is transitioning from %2 to %3 but could enter %4.
SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 783,
/// A thread is getting dispatched with MCA EXCEPTION because of MCA.
MCA_EXCEPTION = 784,
/// Access to %1 is monitored by policy rule %2.
ACCESS_AUDIT_BY_POLICY = 785,
/// Access to %1 has been restricted by your Administrator by policy rule %2.
ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 786,
/// A valid hibernation file has been invalidated and should be abandoned.
ABANDON_HIBERFILE = 787,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost.
/// This error may be caused by network connectivity issues. Please try to save this file elsewhere.
LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 788,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost.
/// This error was returned by the server on which the file exists. Please try to save this file elsewhere.
LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 789,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost.
/// This error may be caused if the device has been removed or the media is write-protected.
LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 790,
/// The resources required for this device conflict with the MCFG table.
BAD_MCFG_TABLE = 791,
/// The volume repair could not be performed while it is online.
/// Please schedule to take the volume offline so that it can be repaired.
DISK_REPAIR_REDIRECTED = 792,
/// The volume repair was not successful.
DISK_REPAIR_UNSUCCESSFUL = 793,
/// One of the volume corruption logs is full.
/// Further corruptions that may be detected won't be logged.
CORRUPT_LOG_OVERFULL = 794,
/// One of the volume corruption logs is internally corrupted and needs to be recreated.
/// The volume may contain undetected corruptions and must be scanned.
CORRUPT_LOG_CORRUPTED = 795,
/// One of the volume corruption logs is unavailable for being operated on.
CORRUPT_LOG_UNAVAILABLE = 796,
/// One of the volume corruption logs was deleted while still having corruption records in them.
/// The volume contains detected corruptions and must be scanned.
CORRUPT_LOG_DELETED_FULL = 797,
/// One of the volume corruption logs was cleared by chkdsk and no longer contains real corruptions.
CORRUPT_LOG_CLEARED = 798,
/// Orphaned files exist on the volume but could not be recovered because no more new names could be created in the recovery directory. Files must be moved from the recovery directory.
ORPHAN_NAME_EXHAUSTED = 799,
/// The oplock that was associated with this handle is now associated with a different handle.
OPLOCK_SWITCHED_TO_NEW_HANDLE = 800,
/// An oplock of the requested level cannot be granted. An oplock of a lower level may be available.
CANNOT_GRANT_REQUESTED_OPLOCK = 801,
/// The operation did not complete successfully because it would cause an oplock to be broken.
/// The caller has requested that existing oplocks not be broken.
CANNOT_BREAK_OPLOCK = 802,
/// The handle with which this oplock was associated has been closed. The oplock is now broken.
OPLOCK_HANDLE_CLOSED = 803,
/// The specified access control entry (ACE) does not contain a condition.
NO_ACE_CONDITION = 804,
/// The specified access control entry (ACE) contains an invalid condition.
INVALID_ACE_CONDITION = 805,
/// Access to the specified file handle has been revoked.
FILE_HANDLE_REVOKED = 806,
/// An image file was mapped at a different address from the one specified in the image file but fixups will still be automatically performed on the image.
IMAGE_AT_DIFFERENT_BASE = 807,
/// Access to the extended attribute was denied.
EA_ACCESS_DENIED = 994,
/// The I/O operation has been aborted because of either a thread exit or an application request.
OPERATION_ABORTED = 995,
/// Overlapped I/O event is not in a signaled state.
IO_INCOMPLETE = 996,
/// Overlapped I/O operation is in progress.
IO_PENDING = 997,
/// Invalid access to memory location.
NOACCESS = 998,
/// Error performing inpage operation.
SWAPERROR = 999,
/// Recursion too deep; the stack overflowed.
STACK_OVERFLOW = 1001,
/// The window cannot act on the sent message.
INVALID_MESSAGE = 1002,
/// Cannot complete this function.
CAN_NOT_COMPLETE = 1003,
/// Invalid flags.
INVALID_FLAGS = 1004,
/// The volume does not contain a recognized file system.
/// Please make sure that all required file system drivers are loaded and that the volume is not corrupted.
UNRECOGNIZED_VOLUME = 1005,
/// The volume for a file has been externally altered so that the opened file is no longer valid.
FILE_INVALID = 1006,
/// The requested operation cannot be performed in full-screen mode.
FULLSCREEN_MODE = 1007,
/// An attempt was made to reference a token that does not exist.
NO_TOKEN = 1008,
/// The configuration registry database is corrupt.
BADDB = 1009,
/// The configuration registry key is invalid.
BADKEY = 1010,
/// The configuration registry key could not be opened.
CANTOPEN = 1011,
/// The configuration registry key could not be read.
CANTREAD = 1012,
/// The configuration registry key could not be written.
CANTWRITE = 1013,
/// One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful.
REGISTRY_RECOVERED = 1014,
/// The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted.
REGISTRY_CORRUPT = 1015,
/// An I/O operation initiated by the registry failed unrecoverably.
/// The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry.
REGISTRY_IO_FAILED = 1016,
/// The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format.
NOT_REGISTRY_FILE = 1017,
/// Illegal operation attempted on a registry key that has been marked for deletion.
KEY_DELETED = 1018,
/// System could not allocate the required space in a registry log.
NO_LOG_SPACE = 1019,
/// Cannot create a symbolic link in a registry key that already has subkeys or values.
KEY_HAS_CHILDREN = 1020,
/// Cannot create a stable subkey under a volatile parent key.
CHILD_MUST_BE_VOLATILE = 1021,
/// A notify change request is being completed and the information is not being returned in the caller's buffer.
/// The caller now needs to enumerate the files to find the changes.
NOTIFY_ENUM_DIR = 1022,
/// A stop control has been sent to a service that other running services are dependent on.
DEPENDENT_SERVICES_RUNNING = 1051,
/// The requested control is not valid for this service.
INVALID_SERVICE_CONTROL = 1052,
/// The service did not respond to the start or control request in a timely fashion.
SERVICE_REQUEST_TIMEOUT = 1053,
/// A thread could not be created for the service.
SERVICE_NO_THREAD = 1054,
/// The service database is locked.
SERVICE_DATABASE_LOCKED = 1055,
/// An instance of the service is already running.
SERVICE_ALREADY_RUNNING = 1056,
/// The account name is invalid or does not exist, or the password is invalid for the account name specified.
INVALID_SERVICE_ACCOUNT = 1057,
/// The service cannot be started, either because it is disabled or because it has no enabled devices associated with it.
SERVICE_DISABLED = 1058,
/// Circular service dependency was specified.
CIRCULAR_DEPENDENCY = 1059,
/// The specified service does not exist as an installed service.
SERVICE_DOES_NOT_EXIST = 1060,
/// The service cannot accept control messages at this time.
SERVICE_CANNOT_ACCEPT_CTRL = 1061,
/// The service has not been started.
SERVICE_NOT_ACTIVE = 1062,
/// The service process could not connect to the service controller.
FAILED_SERVICE_CONTROLLER_CONNECT = 1063,
/// An exception occurred in the service when handling the control request.
EXCEPTION_IN_SERVICE = 1064,
/// The database specified does not exist.
DATABASE_DOES_NOT_EXIST = 1065,
/// The service has returned a service-specific error code.
SERVICE_SPECIFIC_ERROR = 1066,
/// The process terminated unexpectedly.
PROCESS_ABORTED = 1067,
/// The dependency service or group failed to start.
SERVICE_DEPENDENCY_FAIL = 1068,
/// The service did not start due to a logon failure.
SERVICE_LOGON_FAILED = 1069,
/// After starting, the service hung in a start-pending state.
SERVICE_START_HANG = 1070,
/// The specified service database lock is invalid.
INVALID_SERVICE_LOCK = 1071,
/// The specified service has been marked for deletion.
SERVICE_MARKED_FOR_DELETE = 1072,
/// The specified service already exists.
SERVICE_EXISTS = 1073,
/// The system is currently running with the last-known-good configuration.
ALREADY_RUNNING_LKG = 1074,
/// The dependency service does not exist or has been marked for deletion.
SERVICE_DEPENDENCY_DELETED = 1075,
/// The current boot has already been accepted for use as the last-known-good control set.
BOOT_ALREADY_ACCEPTED = 1076,
/// No attempts to start the service have been made since the last boot.
SERVICE_NEVER_STARTED = 1077,
/// The name is already in use as either a service name or a service display name.
DUPLICATE_SERVICE_NAME = 1078,
/// The account specified for this service is different from the account specified for other services running in the same process.
DIFFERENT_SERVICE_ACCOUNT = 1079,
/// Failure actions can only be set for Win32 services, not for drivers.
CANNOT_DETECT_DRIVER_FAILURE = 1080,
/// This service runs in the same process as the service control manager.
/// Therefore, the service control manager cannot take action if this service's process terminates unexpectedly.
CANNOT_DETECT_PROCESS_ABORT = 1081,
/// No recovery program has been configured for this service.
NO_RECOVERY_PROGRAM = 1082,
/// The executable program that this service is configured to run in does not implement the service.
SERVICE_NOT_IN_EXE = 1083,
/// This service cannot be started in Safe Mode.
NOT_SAFEBOOT_SERVICE = 1084,
/// The physical end of the tape has been reached.
END_OF_MEDIA = 1100,
/// A tape access reached a filemark.
FILEMARK_DETECTED = 1101,
/// The beginning of the tape or a partition was encountered.
BEGINNING_OF_MEDIA = 1102,
/// A tape access reached the end of a set of files.
SETMARK_DETECTED = 1103,
/// No more data is on the tape.
NO_DATA_DETECTED = 1104,
/// Tape could not be partitioned.
PARTITION_FAILURE = 1105,
/// When accessing a new tape of a multivolume partition, the current block size is incorrect.
INVALID_BLOCK_LENGTH = 1106,
/// Tape partition information could not be found when loading a tape.
DEVICE_NOT_PARTITIONED = 1107,
/// Unable to lock the media eject mechanism.
UNABLE_TO_LOCK_MEDIA = 1108,
/// Unable to unload the media.
UNABLE_TO_UNLOAD_MEDIA = 1109,
/// The media in the drive may have changed.
MEDIA_CHANGED = 1110,
/// The I/O bus was reset.
BUS_RESET = 1111,
/// No media in drive.
NO_MEDIA_IN_DRIVE = 1112,
/// No mapping for the Unicode character exists in the target multi-byte code page.
NO_UNICODE_TRANSLATION = 1113,
/// A dynamic link library (DLL) initialization routine failed.
DLL_INIT_FAILED = 1114,
/// A system shutdown is in progress.
SHUTDOWN_IN_PROGRESS = 1115,
/// Unable to abort the system shutdown because no shutdown was in progress.
NO_SHUTDOWN_IN_PROGRESS = 1116,
/// The request could not be performed because of an I/O device error.
IO_DEVICE = 1117,
/// No serial device was successfully initialized. The serial driver will unload.
SERIAL_NO_DEVICE = 1118,
/// Unable to open a device that was sharing an interrupt request (IRQ) with other devices.
/// At least one other device that uses that IRQ was already opened.
IRQ_BUSY = 1119,
/// A serial I/O operation was completed by another write to the serial port. The IOCTL_SERIAL_XOFF_COUNTER reached zero.)
MORE_WRITES = 1120,
/// A serial I/O operation completed because the timeout period expired.
/// The IOCTL_SERIAL_XOFF_COUNTER did not reach zero.)
COUNTER_TIMEOUT = 1121,
/// No ID address mark was found on the floppy disk.
FLOPPY_ID_MARK_NOT_FOUND = 1122,
/// Mismatch between the floppy disk sector ID field and the floppy disk controller track address.
FLOPPY_WRONG_CYLINDER = 1123,
/// The floppy disk controller reported an error that is not recognized by the floppy disk driver.
FLOPPY_UNKNOWN_ERROR = 1124,
/// The floppy disk controller returned inconsistent results in its registers.
FLOPPY_BAD_REGISTERS = 1125,
/// While accessing the hard disk, a recalibrate operation failed, even after retries.
DISK_RECALIBRATE_FAILED = 1126,
/// While accessing the hard disk, a disk operation failed even after retries.
DISK_OPERATION_FAILED = 1127,
/// While accessing the hard disk, a disk controller reset was needed, but even that failed.
DISK_RESET_FAILED = 1128,
/// Physical end of tape encountered.
EOM_OVERFLOW = 1129,
/// Not enough server storage is available to process this command.
NOT_ENOUGH_SERVER_MEMORY = 1130,
/// A potential deadlock condition has been detected.
POSSIBLE_DEADLOCK = 1131,
/// The base address or the file offset specified does not have the proper alignment.
MAPPED_ALIGNMENT = 1132,
/// An attempt to change the system power state was vetoed by another application or driver.
SET_POWER_STATE_VETOED = 1140,
/// The system BIOS failed an attempt to change the system power state.
SET_POWER_STATE_FAILED = 1141,
/// An attempt was made to create more links on a file than the file system supports.
TOO_MANY_LINKS = 1142,
/// The specified program requires a newer version of Windows.
OLD_WIN_VERSION = 1150,
/// The specified program is not a Windows or MS-DOS program.
APP_WRONG_OS = 1151,
/// Cannot start more than one instance of the specified program.
SINGLE_INSTANCE_APP = 1152,
/// The specified program was written for an earlier version of Windows.
RMODE_APP = 1153,
/// One of the library files needed to run this application is damaged.
INVALID_DLL = 1154,
/// No application is associated with the specified file for this operation.
NO_ASSOCIATION = 1155,
/// An error occurred in sending the command to the application.
DDE_FAIL = 1156,
/// One of the library files needed to run this application cannot be found.
DLL_NOT_FOUND = 1157,
/// The current process has used all of its system allowance of handles for Window Manager objects.
NO_MORE_USER_HANDLES = 1158,
/// The message can be used only with synchronous operations.
MESSAGE_SYNC_ONLY = 1159,
/// The indicated source element has no media.
SOURCE_ELEMENT_EMPTY = 1160,
/// The indicated destination element already contains media.
DESTINATION_ELEMENT_FULL = 1161,
/// The indicated element does not exist.
ILLEGAL_ELEMENT_ADDRESS = 1162,
/// The indicated element is part of a magazine that is not present.
MAGAZINE_NOT_PRESENT = 1163,
/// The indicated device requires reinitialization due to hardware errors.
DEVICE_REINITIALIZATION_NEEDED = 1164,
/// The device has indicated that cleaning is required before further operations are attempted.
DEVICE_REQUIRES_CLEANING = 1165,
/// The device has indicated that its door is open.
DEVICE_DOOR_OPEN = 1166,
/// The device is not connected.
DEVICE_NOT_CONNECTED = 1167,
/// Element not found.
NOT_FOUND = 1168,
/// There was no match for the specified key in the index.
NO_MATCH = 1169,
/// The property set specified does not exist on the object.
SET_NOT_FOUND = 1170,
/// The point passed to GetMouseMovePoints is not in the buffer.
POINT_NOT_FOUND = 1171,
/// The tracking (workstation) service is not running.
NO_TRACKING_SERVICE = 1172,
/// The Volume ID could not be found.
NO_VOLUME_ID = 1173,
/// Unable to remove the file to be replaced.
UNABLE_TO_REMOVE_REPLACED = 1175,
/// Unable to move the replacement file to the file to be replaced.
/// The file to be replaced has retained its original name.
UNABLE_TO_MOVE_REPLACEMENT = 1176,
/// Unable to move the replacement file to the file to be replaced.
/// The file to be replaced has been renamed using the backup name.
UNABLE_TO_MOVE_REPLACEMENT_2 = 1177,
/// The volume change journal is being deleted.
JOURNAL_DELETE_IN_PROGRESS = 1178,
/// The volume change journal is not active.
JOURNAL_NOT_ACTIVE = 1179,
/// A file was found, but it may not be the correct file.
POTENTIAL_FILE_FOUND = 1180,
/// The journal entry has been deleted from the journal.
JOURNAL_ENTRY_DELETED = 1181,
/// A system shutdown has already been scheduled.
SHUTDOWN_IS_SCHEDULED = 1190,
/// The system shutdown cannot be initiated because there are other users logged on to the computer.
SHUTDOWN_USERS_LOGGED_ON = 1191,
/// The specified device name is invalid.
BAD_DEVICE = 1200,
/// The device is not currently connected but it is a remembered connection.
CONNECTION_UNAVAIL = 1201,
/// The local device name has a remembered connection to another network resource.
DEVICE_ALREADY_REMEMBERED = 1202,
/// The network path was either typed incorrectly, does not exist, or the network provider is not currently available.
/// Please try retyping the path or contact your network administrator.
NO_NET_OR_BAD_PATH = 1203,
/// The specified network provider name is invalid.
BAD_PROVIDER = 1204,
/// Unable to open the network connection profile.
CANNOT_OPEN_PROFILE = 1205,
/// The network connection profile is corrupted.
BAD_PROFILE = 1206,
/// Cannot enumerate a noncontainer.
NOT_CONTAINER = 1207,
/// An extended error has occurred.
EXTENDED_ERROR = 1208,
/// The format of the specified group name is invalid.
INVALID_GROUPNAME = 1209,
/// The format of the specified computer name is invalid.
INVALID_COMPUTERNAME = 1210,
/// The format of the specified event name is invalid.
INVALID_EVENTNAME = 1211,
/// The format of the specified domain name is invalid.
INVALID_DOMAINNAME = 1212,
/// The format of the specified service name is invalid.
INVALID_SERVICENAME = 1213,
/// The format of the specified network name is invalid.
INVALID_NETNAME = 1214,
/// The format of the specified share name is invalid.
INVALID_SHARENAME = 1215,
/// The format of the specified password is invalid.
INVALID_PASSWORDNAME = 1216,
/// The format of the specified message name is invalid.
INVALID_MESSAGENAME = 1217,
/// The format of the specified message destination is invalid.
INVALID_MESSAGEDEST = 1218,
/// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed.
/// Disconnect all previous connections to the server or shared resource and try again.
SESSION_CREDENTIAL_CONFLICT = 1219,
/// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server.
REMOTE_SESSION_LIMIT_EXCEEDED = 1220,
/// The workgroup or domain name is already in use by another computer on the network.
DUP_DOMAINNAME = 1221,
/// The network is not present or not started.
NO_NETWORK = 1222,
/// The operation was canceled by the user.
CANCELLED = 1223,
/// The requested operation cannot be performed on a file with a user-mapped section open.
USER_MAPPED_FILE = 1224,
/// The remote computer refused the network connection.
CONNECTION_REFUSED = 1225,
/// The network connection was gracefully closed.
GRACEFUL_DISCONNECT = 1226,
/// The network transport endpoint already has an address associated with it.
ADDRESS_ALREADY_ASSOCIATED = 1227,
/// An address has not yet been associated with the network endpoint.
ADDRESS_NOT_ASSOCIATED = 1228,
/// An operation was attempted on a nonexistent network connection.
CONNECTION_INVALID = 1229,
/// An invalid operation was attempted on an active network connection.
CONNECTION_ACTIVE = 1230,
/// The network location cannot be reached.
/// For information about network troubleshooting, see Windows Help.
NETWORK_UNREACHABLE = 1231,
/// The network location cannot be reached.
/// For information about network troubleshooting, see Windows Help.
HOST_UNREACHABLE = 1232,
/// The network location cannot be reached.
/// For information about network troubleshooting, see Windows Help.
PROTOCOL_UNREACHABLE = 1233,
/// No service is operating at the destination network endpoint on the remote system.
PORT_UNREACHABLE = 1234,
/// The request was aborted.
REQUEST_ABORTED = 1235,
/// The network connection was aborted by the local system.
CONNECTION_ABORTED = 1236,
/// The operation could not be completed. A retry should be performed.
RETRY = 1237,
/// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.
CONNECTION_COUNT_LIMIT = 1238,
/// Attempting to log in during an unauthorized time of day for this account.
LOGIN_TIME_RESTRICTION = 1239,
/// The account is not authorized to log in from this station.
LOGIN_WKSTA_RESTRICTION = 1240,
/// The network address could not be used for the operation requested.
INCORRECT_ADDRESS = 1241,
/// The service is already registered.
ALREADY_REGISTERED = 1242,
/// The specified service does not exist.
SERVICE_NOT_FOUND = 1243,
/// The operation being requested was not performed because the user has not been authenticated.
NOT_AUTHENTICATED = 1244,
/// The operation being requested was not performed because the user has not logged on to the network. The specified service does not exist.
NOT_LOGGED_ON = 1245,
/// Continue with work in progress.
CONTINUE = 1246,
/// An attempt was made to perform an initialization operation when initialization has already been completed.
ALREADY_INITIALIZED = 1247,
/// No more local devices.
NO_MORE_DEVICES = 1248,
/// The specified site does not exist.
NO_SUCH_SITE = 1249,
/// A domain controller with the specified name already exists.
DOMAIN_CONTROLLER_EXISTS = 1250,
/// This operation is supported only when you are connected to the server.
ONLY_IF_CONNECTED = 1251,
/// The group policy framework should call the extension even if there are no changes.
OVERRIDE_NOCHANGES = 1252,
/// The specified user does not have a valid profile.
BAD_USER_PROFILE = 1253,
/// This operation is not supported on a computer running Windows Server 2003 for Small Business Server.
NOT_SUPPORTED_ON_SBS = 1254,
/// The server machine is shutting down.
SERVER_SHUTDOWN_IN_PROGRESS = 1255,
/// The remote system is not available.
/// For information about network troubleshooting, see Windows Help.
HOST_DOWN = 1256,
/// The security identifier provided is not from an account domain.
NON_ACCOUNT_SID = 1257,
/// The security identifier provided does not have a domain component.
NON_DOMAIN_SID = 1258,
/// AppHelp dialog canceled thus preventing the application from starting.
APPHELP_BLOCK = 1259,
/// This program is blocked by group policy.
/// For more information, contact your system administrator.
ACCESS_DISABLED_BY_POLICY = 1260,
/// A program attempt to use an invalid register value.
/// Normally caused by an uninitialized register. This error is Itanium specific.
REG_NAT_CONSUMPTION = 1261,
/// The share is currently offline or does not exist.
CSCSHARE_OFFLINE = 1262,
/// The Kerberos protocol encountered an error while validating the KDC certificate during smartcard logon.
/// There is more information in the system event log.
PKINIT_FAILURE = 1263,
/// The Kerberos protocol encountered an error while attempting to utilize the smartcard subsystem.
SMARTCARD_SUBSYSTEM_FAILURE = 1264,
/// The system cannot contact a domain controller to service the authentication request. Please try again later.
DOWNGRADE_DETECTED = 1265,
/// The machine is locked and cannot be shut down without the force option.
MACHINE_LOCKED = 1271,
/// An application-defined callback gave invalid data when called.
CALLBACK_SUPPLIED_INVALID_DATA = 1273,
/// The group policy framework should call the extension in the synchronous foreground policy refresh.
SYNC_FOREGROUND_REFRESH_REQUIRED = 1274,
/// This driver has been blocked from loading.
DRIVER_BLOCKED = 1275,
/// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image.
INVALID_IMPORT_OF_NON_DLL = 1276,
/// Windows cannot open this program since it has been disabled.
ACCESS_DISABLED_WEBBLADE = 1277,
/// Windows cannot open this program because the license enforcement system has been tampered with or become corrupted.
ACCESS_DISABLED_WEBBLADE_TAMPER = 1278,
/// A transaction recover failed.
RECOVERY_FAILURE = 1279,
/// The current thread has already been converted to a fiber.
ALREADY_FIBER = 1280,
/// The current thread has already been converted from a fiber.
ALREADY_THREAD = 1281,
/// The system detected an overrun of a stack-based buffer in this application.
/// This overrun could potentially allow a malicious user to gain control of this application.
STACK_BUFFER_OVERRUN = 1282,
/// Data present in one of the parameters is more than the function can operate on.
PARAMETER_QUOTA_EXCEEDED = 1283,
/// An attempt to do an operation on a debug object failed because the object is in the process of being deleted.
DEBUGGER_INACTIVE = 1284,
/// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed.
DELAY_LOAD_FAILED = 1285,
/// %1 is a 16-bit application. You do not have permissions to execute 16-bit applications.
/// Check your permissions with your system administrator.
VDM_DISALLOWED = 1286,
/// Insufficient information exists to identify the cause of failure.
UNIDENTIFIED_ERROR = 1287,
/// The parameter passed to a C runtime function is incorrect.
INVALID_CRUNTIME_PARAMETER = 1288,
/// The operation occurred beyond the valid data length of the file.
BEYOND_VDL = 1289,
/// The service start failed since one or more services in the same process have an incompatible service SID type setting.
/// A service with restricted service SID type can only coexist in the same process with other services with a restricted SID type.
/// If the service SID type for this service was just configured, the hosting process must be restarted in order to start this service.
/// On Windows Server 2003 and Windows XP, an unrestricted service cannot coexist in the same process with other services.
/// The service with the unrestricted service SID type must be moved to an owned process in order to start this service.
INCOMPATIBLE_SERVICE_SID_TYPE = 1290,
/// The process hosting the driver for this device has been terminated.
DRIVER_PROCESS_TERMINATED = 1291,
/// An operation attempted to exceed an implementation-defined limit.
IMPLEMENTATION_LIMIT = 1292,
/// Either the target process, or the target thread's containing process, is a protected process.
PROCESS_IS_PROTECTED = 1293,
/// The service notification client is lagging too far behind the current state of services in the machine.
SERVICE_NOTIFY_CLIENT_LAGGING = 1294,
/// The requested file operation failed because the storage quota was exceeded.
/// To free up disk space, move files to a different location or delete unnecessary files.
/// For more information, contact your system administrator.
DISK_QUOTA_EXCEEDED = 1295,
/// The requested file operation failed because the storage policy blocks that type of file.
/// For more information, contact your system administrator.
CONTENT_BLOCKED = 1296,
/// A privilege that the service requires to function properly does not exist in the service account configuration.
/// You may use the Services Microsoft Management Console (MMC) snap-in (services.msc) and the Local Security Settings MMC snap-in (secpol.msc) to view the service configuration and the account configuration.
INCOMPATIBLE_SERVICE_PRIVILEGE = 1297,
/// A thread involved in this operation appears to be unresponsive.
APP_HANG = 1298,
/// Indicates a particular Security ID may not be assigned as the label of an object.
INVALID_LABEL = 1299,
/// Not all privileges or groups referenced are assigned to the caller.
NOT_ALL_ASSIGNED = 1300,
/// Some mapping between account names and security IDs was not done.
SOME_NOT_MAPPED = 1301,
/// No system quota limits are specifically set for this account.
NO_QUOTAS_FOR_ACCOUNT = 1302,
/// No encryption key is available. A well-known encryption key was returned.
LOCAL_USER_SESSION_KEY = 1303,
/// The password is too complex to be converted to a LAN Manager password.
/// The LAN Manager password returned is a NULL string.
NULL_LM_PASSWORD = 1304,
/// The revision level is unknown.
UNKNOWN_REVISION = 1305,
/// Indicates two revision levels are incompatible.
REVISION_MISMATCH = 1306,
/// This security ID may not be assigned as the owner of this object.
INVALID_OWNER = 1307,
/// This security ID may not be assigned as the primary group of an object.
INVALID_PRIMARY_GROUP = 1308,
/// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client.
NO_IMPERSONATION_TOKEN = 1309,
/// The group may not be disabled.
CANT_DISABLE_MANDATORY = 1310,
/// There are currently no logon servers available to service the logon request.
NO_LOGON_SERVERS = 1311,
/// A specified logon session does not exist. It may already have been terminated.
NO_SUCH_LOGON_SESSION = 1312,
/// A specified privilege does not exist.
NO_SUCH_PRIVILEGE = 1313,
/// A required privilege is not held by the client.
PRIVILEGE_NOT_HELD = 1314,
/// The name provided is not a properly formed account name.
INVALID_ACCOUNT_NAME = 1315,
/// The specified account already exists.
USER_EXISTS = 1316,
/// The specified account does not exist.
NO_SUCH_USER = 1317,
/// The specified group already exists.
GROUP_EXISTS = 1318,
/// The specified group does not exist.
NO_SUCH_GROUP = 1319,
/// Either the specified user account is already a member of the specified group, or the specified group cannot be deleted because it contains a member.
MEMBER_IN_GROUP = 1320,
/// The specified user account is not a member of the specified group account.
MEMBER_NOT_IN_GROUP = 1321,
/// This operation is disallowed as it could result in an administration account being disabled, deleted or unable to log on.
LAST_ADMIN = 1322,
/// Unable to update the password. The value provided as the current password is incorrect.
WRONG_PASSWORD = 1323,
/// Unable to update the password. The value provided for the new password contains values that are not allowed in passwords.
ILL_FORMED_PASSWORD = 1324,
/// Unable to update the password. The value provided for the new password does not meet the length, complexity, or history requirements of the domain.
PASSWORD_RESTRICTION = 1325,
/// The user name or password is incorrect.
LOGON_FAILURE = 1326,
/// Account restrictions are preventing this user from signing in.
/// For example: blank passwords aren't allowed, sign-in times are limited, or a policy restriction has been enforced.
ACCOUNT_RESTRICTION = 1327,
/// Your account has time restrictions that keep you from signing in right now.
INVALID_LOGON_HOURS = 1328,
/// This user isn't allowed to sign in to this computer.
INVALID_WORKSTATION = 1329,
/// The password for this account has expired.
PASSWORD_EXPIRED = 1330,
/// This user can't sign in because this account is currently disabled.
ACCOUNT_DISABLED = 1331,
/// No mapping between account names and security IDs was done.
NONE_MAPPED = 1332,
/// Too many local user identifiers (LUIDs) were requested at one time.
TOO_MANY_LUIDS_REQUESTED = 1333,
/// No more local user identifiers (LUIDs) are available.
LUIDS_EXHAUSTED = 1334,
/// The subauthority part of a security ID is invalid for this particular use.
INVALID_SUB_AUTHORITY = 1335,
/// The access control list (ACL) structure is invalid.
INVALID_ACL = 1336,
/// The security ID structure is invalid.
INVALID_SID = 1337,
/// The security descriptor structure is invalid.
INVALID_SECURITY_DESCR = 1338,
/// The inherited access control list (ACL) or access control entry (ACE) could not be built.
BAD_INHERITANCE_ACL = 1340,
/// The server is currently disabled.
SERVER_DISABLED = 1341,
/// The server is currently enabled.
SERVER_NOT_DISABLED = 1342,
/// The value provided was an invalid value for an identifier authority.
INVALID_ID_AUTHORITY = 1343,
/// No more memory is available for security information updates.
ALLOTTED_SPACE_EXCEEDED = 1344,
/// The specified attributes are invalid, or incompatible with the attributes for the group as a whole.
INVALID_GROUP_ATTRIBUTES = 1345,
/// Either a required impersonation level was not provided, or the provided impersonation level is invalid.
BAD_IMPERSONATION_LEVEL = 1346,
/// Cannot open an anonymous level security token.
CANT_OPEN_ANONYMOUS = 1347,
/// The validation information class requested was invalid.
BAD_VALIDATION_CLASS = 1348,
/// The type of the token is inappropriate for its attempted use.
BAD_TOKEN_TYPE = 1349,
/// Unable to perform a security operation on an object that has no associated security.
NO_SECURITY_ON_OBJECT = 1350,
/// Configuration information could not be read from the domain controller, either because the machine is unavailable, or access has been denied.
CANT_ACCESS_DOMAIN_INFO = 1351,
/// The security account manager (SAM) or local security authority (LSA) server was in the wrong state to perform the security operation.
INVALID_SERVER_STATE = 1352,
/// The domain was in the wrong state to perform the security operation.
INVALID_DOMAIN_STATE = 1353,
/// This operation is only allowed for the Primary Domain Controller of the domain.
INVALID_DOMAIN_ROLE = 1354,
/// The specified domain either does not exist or could not be contacted.
NO_SUCH_DOMAIN = 1355,
/// The specified domain already exists.
DOMAIN_EXISTS = 1356,
/// An attempt was made to exceed the limit on the number of domains per server.
DOMAIN_LIMIT_EXCEEDED = 1357,
/// Unable to complete the requested operation because of either a catastrophic media failure or a data structure corruption on the disk.
INTERNAL_DB_CORRUPTION = 1358,
/// An internal error occurred.
INTERNAL_ERROR = 1359,
/// Generic access types were contained in an access mask which should already be mapped to nongeneric types.
GENERIC_NOT_MAPPED = 1360,
/// A security descriptor is not in the right format (absolute or self-relative).
BAD_DESCRIPTOR_FORMAT = 1361,
/// The requested action is restricted for use by logon processes only.
/// The calling process has not registered as a logon process.
NOT_LOGON_PROCESS = 1362,
/// Cannot start a new logon session with an ID that is already in use.
LOGON_SESSION_EXISTS = 1363,
/// A specified authentication package is unknown.
NO_SUCH_PACKAGE = 1364,
/// The logon session is not in a state that is consistent with the requested operation.
BAD_LOGON_SESSION_STATE = 1365,
/// The logon session ID is already in use.
LOGON_SESSION_COLLISION = 1366,
/// A logon request contained an invalid logon type value.
INVALID_LOGON_TYPE = 1367,
/// Unable to impersonate using a named pipe until data has been read from that pipe.
CANNOT_IMPERSONATE = 1368,
/// The transaction state of a registry subtree is incompatible with the requested operation.
RXACT_INVALID_STATE = 1369,
/// An internal security database corruption has been encountered.
RXACT_COMMIT_FAILURE = 1370,
/// Cannot perform this operation on built-in accounts.
SPECIAL_ACCOUNT = 1371,
/// Cannot perform this operation on this built-in special group.
SPECIAL_GROUP = 1372,
/// Cannot perform this operation on this built-in special user.
SPECIAL_USER = 1373,
/// The user cannot be removed from a group because the group is currently the user's primary group.
MEMBERS_PRIMARY_GROUP = 1374,
/// The token is already in use as a primary token.
TOKEN_ALREADY_IN_USE = 1375,
/// The specified local group does not exist.
NO_SUCH_ALIAS = 1376,
/// The specified account name is not a member of the group.
MEMBER_NOT_IN_ALIAS = 1377,
/// The specified account name is already a member of the group.
MEMBER_IN_ALIAS = 1378,
/// The specified local group already exists.
ALIAS_EXISTS = 1379,
/// Logon failure: the user has not been granted the requested logon type at this computer.
LOGON_NOT_GRANTED = 1380,
/// The maximum number of secrets that may be stored in a single system has been exceeded.
TOO_MANY_SECRETS = 1381,
/// The length of a secret exceeds the maximum length allowed.
SECRET_TOO_LONG = 1382,
/// The local security authority database contains an internal inconsistency.
INTERNAL_DB_ERROR = 1383,
/// During a logon attempt, the user's security context accumulated too many security IDs.
TOO_MANY_CONTEXT_IDS = 1384,
/// Logon failure: the user has not been granted the requested logon type at this computer.
LOGON_TYPE_NOT_GRANTED = 1385,
/// A cross-encrypted password is necessary to change a user password.
NT_CROSS_ENCRYPTION_REQUIRED = 1386,
/// A member could not be added to or removed from the local group because the member does not exist.
NO_SUCH_MEMBER = 1387,
/// A new member could not be added to a local group because the member has the wrong account type.
INVALID_MEMBER = 1388,
/// Too many security IDs have been specified.
TOO_MANY_SIDS = 1389,
/// A cross-encrypted password is necessary to change this user password.
LM_CROSS_ENCRYPTION_REQUIRED = 1390,
/// Indicates an ACL contains no inheritable components.
NO_INHERITANCE = 1391,
/// The file or directory is corrupted and unreadable.
FILE_CORRUPT = 1392,
/// The disk structure is corrupted and unreadable.
DISK_CORRUPT = 1393,
/// There is no user session key for the specified logon session.
NO_USER_SESSION_KEY = 1394,
/// The service being accessed is licensed for a particular number of connections.
/// No more connections can be made to the service at this time because there are already as many connections as the service can accept.
LICENSE_QUOTA_EXCEEDED = 1395,
/// The target account name is incorrect.
WRONG_TARGET_NAME = 1396,
/// Mutual Authentication failed. The server's password is out of date at the domain controller.
MUTUAL_AUTH_FAILED = 1397,
/// There is a time and/or date difference between the client and server.
TIME_SKEW = 1398,
/// This operation cannot be performed on the current domain.
CURRENT_DOMAIN_NOT_ALLOWED = 1399,
/// Invalid window handle.
INVALID_WINDOW_HANDLE = 1400,
/// Invalid menu handle.
INVALID_MENU_HANDLE = 1401,
/// Invalid cursor handle.
INVALID_CURSOR_HANDLE = 1402,
/// Invalid accelerator table handle.
INVALID_ACCEL_HANDLE = 1403,
/// Invalid hook handle.
INVALID_HOOK_HANDLE = 1404,
/// Invalid handle to a multiple-window position structure.
INVALID_DWP_HANDLE = 1405,
/// Cannot create a top-level child window.
TLW_WITH_WSCHILD = 1406,
/// Cannot find window class.
CANNOT_FIND_WND_CLASS = 1407,
/// Invalid window; it belongs to other thread.
WINDOW_OF_OTHER_THREAD = 1408,
/// Hot key is already registered.
HOTKEY_ALREADY_REGISTERED = 1409,
/// Class already exists.
CLASS_ALREADY_EXISTS = 1410,
/// Class does not exist.
CLASS_DOES_NOT_EXIST = 1411,
/// Class still has open windows.
CLASS_HAS_WINDOWS = 1412,
/// Invalid index.
INVALID_INDEX = 1413,
/// Invalid icon handle.
INVALID_ICON_HANDLE = 1414,
/// Using private DIALOG window words.
PRIVATE_DIALOG_INDEX = 1415,
/// The list box identifier was not found.
LISTBOX_ID_NOT_FOUND = 1416,
/// No wildcards were found.
NO_WILDCARD_CHARACTERS = 1417,
/// Thread does not have a clipboard open.
CLIPBOARD_NOT_OPEN = 1418,
/// Hot key is not registered.
HOTKEY_NOT_REGISTERED = 1419,
/// The window is not a valid dialog window.
WINDOW_NOT_DIALOG = 1420,
/// Control ID not found.
CONTROL_ID_NOT_FOUND = 1421,
/// Invalid message for a combo box because it does not have an edit control.
INVALID_COMBOBOX_MESSAGE = 1422,
/// The window is not a combo box.
WINDOW_NOT_COMBOBOX = 1423,
/// Height must be less than 256.
INVALID_EDIT_HEIGHT = 1424,
/// Invalid device context (DC) handle.
DC_NOT_FOUND = 1425,
/// Invalid hook procedure type.
INVALID_HOOK_FILTER = 1426,
/// Invalid hook procedure.
INVALID_FILTER_PROC = 1427,
/// Cannot set nonlocal hook without a module handle.
HOOK_NEEDS_HMOD = 1428,
/// This hook procedure can only be set globally.
GLOBAL_ONLY_HOOK = 1429,
/// The journal hook procedure is already installed.
JOURNAL_HOOK_SET = 1430,
/// The hook procedure is not installed.
HOOK_NOT_INSTALLED = 1431,
/// Invalid message for single-selection list box.
INVALID_LB_MESSAGE = 1432,
/// LB_SETCOUNT sent to non-lazy list box.
SETCOUNT_ON_BAD_LB = 1433,
/// This list box does not support tab stops.
LB_WITHOUT_TABSTOPS = 1434,
/// Cannot destroy object created by another thread.
DESTROY_OBJECT_OF_OTHER_THREAD = 1435,
/// Child windows cannot have menus.
CHILD_WINDOW_MENU = 1436,
/// The window does not have a system menu.
NO_SYSTEM_MENU = 1437,
/// Invalid message box style.
INVALID_MSGBOX_STYLE = 1438,
/// Invalid system-wide (SPI_*) parameter.
INVALID_SPI_VALUE = 1439,
/// Screen already locked.
SCREEN_ALREADY_LOCKED = 1440,
/// All handles to windows in a multiple-window position structure must have the same parent.
HWNDS_HAVE_DIFF_PARENT = 1441,
/// The window is not a child window.
NOT_CHILD_WINDOW = 1442,
/// Invalid GW_* command.
INVALID_GW_COMMAND = 1443,
/// Invalid thread identifier.
INVALID_THREAD_ID = 1444,
/// Cannot process a message from a window that is not a multiple document interface (MDI) window.
NON_MDICHILD_WINDOW = 1445,
/// Popup menu already active.
POPUP_ALREADY_ACTIVE = 1446,
/// The window does not have scroll bars.
NO_SCROLLBARS = 1447,
/// Scroll bar range cannot be greater than MAXLONG.
INVALID_SCROLLBAR_RANGE = 1448,
/// Cannot show or remove the window in the way specified.
INVALID_SHOWWIN_COMMAND = 1449,
/// Insufficient system resources exist to complete the requested service.
NO_SYSTEM_RESOURCES = 1450,
/// Insufficient system resources exist to complete the requested service.
NONPAGED_SYSTEM_RESOURCES = 1451,
/// Insufficient system resources exist to complete the requested service.
PAGED_SYSTEM_RESOURCES = 1452,
/// Insufficient quota to complete the requested service.
WORKING_SET_QUOTA = 1453,
/// Insufficient quota to complete the requested service.
PAGEFILE_QUOTA = 1454,
/// The paging file is too small for this operation to complete.
COMMITMENT_LIMIT = 1455,
/// A menu item was not found.
MENU_ITEM_NOT_FOUND = 1456,
/// Invalid keyboard layout handle.
INVALID_KEYBOARD_HANDLE = 1457,
/// Hook type not allowed.
HOOK_TYPE_NOT_ALLOWED = 1458,
/// This operation requires an interactive window station.
REQUIRES_INTERACTIVE_WINDOWSTATION = 1459,
/// This operation returned because the timeout period expired.
TIMEOUT = 1460,
/// Invalid monitor handle.
INVALID_MONITOR_HANDLE = 1461,
/// Incorrect size argument.
INCORRECT_SIZE = 1462,
/// The symbolic link cannot be followed because its type is disabled.
SYMLINK_CLASS_DISABLED = 1463,
/// This application does not support the current operation on symbolic links.
SYMLINK_NOT_SUPPORTED = 1464,
/// Windows was unable to parse the requested XML data.
XML_PARSE_ERROR = 1465,
/// An error was encountered while processing an XML digital signature.
XMLDSIG_ERROR = 1466,
/// This application must be restarted.
RESTART_APPLICATION = 1467,
/// The caller made the connection request in the wrong routing compartment.
WRONG_COMPARTMENT = 1468,
/// There was an AuthIP failure when attempting to connect to the remote host.
AUTHIP_FAILURE = 1469,
/// Insufficient NVRAM resources exist to complete the requested service. A reboot might be required.
NO_NVRAM_RESOURCES = 1470,
/// Unable to finish the requested operation because the specified process is not a GUI process.
NOT_GUI_PROCESS = 1471,
/// The event log file is corrupted.
EVENTLOG_FILE_CORRUPT = 1500,
/// No event log file could be opened, so the event logging service did not start.
EVENTLOG_CANT_START = 1501,
/// The event log file is full.
LOG_FILE_FULL = 1502,
/// The event log file has changed between read operations.
EVENTLOG_FILE_CHANGED = 1503,
/// The specified task name is invalid.
INVALID_TASK_NAME = 1550,
/// The specified task index is invalid.
INVALID_TASK_INDEX = 1551,
/// The specified thread is already joining a task.
THREAD_ALREADY_IN_TASK = 1552,
/// The Windows Installer Service could not be accessed.
/// This can occur if the Windows Installer is not correctly installed. Contact your support personnel for assistance.
INSTALL_SERVICE_FAILURE = 1601,
/// User cancelled installation.
INSTALL_USEREXIT = 1602,
/// Fatal error during installation.
INSTALL_FAILURE = 1603,
/// Installation suspended, incomplete.
INSTALL_SUSPEND = 1604,
/// This action is only valid for products that are currently installed.
UNKNOWN_PRODUCT = 1605,
/// Feature ID not registered.
UNKNOWN_FEATURE = 1606,
/// Component ID not registered.
UNKNOWN_COMPONENT = 1607,
/// Unknown property.
UNKNOWN_PROPERTY = 1608,
/// Handle is in an invalid state.
INVALID_HANDLE_STATE = 1609,
/// The configuration data for this product is corrupt. Contact your support personnel.
BAD_CONFIGURATION = 1610,
/// Component qualifier not present.
INDEX_ABSENT = 1611,
/// The installation source for this product is not available.
/// Verify that the source exists and that you can access it.
INSTALL_SOURCE_ABSENT = 1612,
/// This installation package cannot be installed by the Windows Installer service.
/// You must install a Windows service pack that contains a newer version of the Windows Installer service.
INSTALL_PACKAGE_VERSION = 1613,
/// Product is uninstalled.
PRODUCT_UNINSTALLED = 1614,
/// SQL query syntax invalid or unsupported.
BAD_QUERY_SYNTAX = 1615,
/// Record field does not exist.
INVALID_FIELD = 1616,
/// The device has been removed.
DEVICE_REMOVED = 1617,
/// Another installation is already in progress.
/// Complete that installation before proceeding with this install.
INSTALL_ALREADY_RUNNING = 1618,
/// This installation package could not be opened.
/// Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer package.
INSTALL_PACKAGE_OPEN_FAILED = 1619,
/// This installation package could not be opened.
/// Contact the application vendor to verify that this is a valid Windows Installer package.
INSTALL_PACKAGE_INVALID = 1620,
/// There was an error starting the Windows Installer service user interface. Contact your support personnel.
INSTALL_UI_FAILURE = 1621,
/// Error opening installation log file.
/// Verify that the specified log file location exists and that you can write to it.
INSTALL_LOG_FAILURE = 1622,
/// The language of this installation package is not supported by your system.
INSTALL_LANGUAGE_UNSUPPORTED = 1623,
/// Error applying transforms. Verify that the specified transform paths are valid.
INSTALL_TRANSFORM_FAILURE = 1624,
/// This installation is forbidden by system policy. Contact your system administrator.
INSTALL_PACKAGE_REJECTED = 1625,
/// Function could not be executed.
FUNCTION_NOT_CALLED = 1626,
/// Function failed during execution.
FUNCTION_FAILED = 1627,
/// Invalid or unknown table specified.
INVALID_TABLE = 1628,
/// Data supplied is of wrong type.
DATATYPE_MISMATCH = 1629,
/// Data of this type is not supported.
UNSUPPORTED_TYPE = 1630,
/// The Windows Installer service failed to start. Contact your support personnel.
CREATE_FAILED = 1631,
/// The Temp folder is on a drive that is full or is inaccessible.
/// Free up space on the drive or verify that you have write permission on the Temp folder.
INSTALL_TEMP_UNWRITABLE = 1632,
/// This installation package is not supported by this processor type. Contact your product vendor.
INSTALL_PLATFORM_UNSUPPORTED = 1633,
/// Component not used on this computer.
INSTALL_NOTUSED = 1634,
/// This update package could not be opened.
/// Verify that the update package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer update package.
PATCH_PACKAGE_OPEN_FAILED = 1635,
/// This update package could not be opened.
/// Contact the application vendor to verify that this is a valid Windows Installer update package.
PATCH_PACKAGE_INVALID = 1636,
/// This update package cannot be processed by the Windows Installer service.
/// You must install a Windows service pack that contains a newer version of the Windows Installer service.
PATCH_PACKAGE_UNSUPPORTED = 1637,
/// Another version of this product is already installed. Installation of this version cannot continue.
/// To configure or remove the existing version of this product, use Add/Remove Programs on the Control Panel.
PRODUCT_VERSION = 1638,
/// Invalid command line argument. Consult the Windows Installer SDK for detailed command line help.
INVALID_COMMAND_LINE = 1639,
/// Only administrators have permission to add, remove, or configure server software during a Terminal services remote session.
/// If you want to install or configure software on the server, contact your network administrator.
INSTALL_REMOTE_DISALLOWED = 1640,
/// The requested operation completed successfully.
/// The system will be restarted so the changes can take effect.
SUCCESS_REBOOT_INITIATED = 1641,
/// The upgrade cannot be installed by the Windows Installer service because the program to be upgraded may be missing, or the upgrade may update a different version of the program.
/// Verify that the program to be upgraded exists on your computer and that you have the correct upgrade.
PATCH_TARGET_NOT_FOUND = 1642,
/// The update package is not permitted by software restriction policy.
PATCH_PACKAGE_REJECTED = 1643,
/// One or more customizations are not permitted by software restriction policy.
INSTALL_TRANSFORM_REJECTED = 1644,
/// The Windows Installer does not permit installation from a Remote Desktop Connection.
INSTALL_REMOTE_PROHIBITED = 1645,
/// Uninstallation of the update package is not supported.
PATCH_REMOVAL_UNSUPPORTED = 1646,
/// The update is not applied to this product.
UNKNOWN_PATCH = 1647,
/// No valid sequence could be found for the set of updates.
PATCH_NO_SEQUENCE = 1648,
/// Update removal was disallowed by policy.
PATCH_REMOVAL_DISALLOWED = 1649,
/// The XML update data is invalid.
INVALID_PATCH_XML = 1650,
/// Windows Installer does not permit updating of managed advertised products.
/// At least one feature of the product must be installed before applying the update.
PATCH_MANAGED_ADVERTISED_PRODUCT = 1651,
/// The Windows Installer service is not accessible in Safe Mode.
/// Please try again when your computer is not in Safe Mode or you can use System Restore to return your machine to a previous good state.
INSTALL_SERVICE_SAFEBOOT = 1652,
/// A fail fast exception occurred.
/// Exception handlers will not be invoked and the process will be terminated immediately.
FAIL_FAST_EXCEPTION = 1653,
/// The app that you are trying to run is not supported on this version of Windows.
INSTALL_REJECTED = 1654,
/// The string binding is invalid.
RPC_S_INVALID_STRING_BINDING = 1700,
/// The binding handle is not the correct type.
RPC_S_WRONG_KIND_OF_BINDING = 1701,
/// The binding handle is invalid.
RPC_S_INVALID_BINDING = 1702,
/// The RPC protocol sequence is not supported.
RPC_S_PROTSEQ_NOT_SUPPORTED = 1703,
/// The RPC protocol sequence is invalid.
RPC_S_INVALID_RPC_PROTSEQ = 1704,
/// The string universal unique identifier (UUID) is invalid.
RPC_S_INVALID_STRING_UUID = 1705,
/// The endpoint format is invalid.
RPC_S_INVALID_ENDPOINT_FORMAT = 1706,
/// The network address is invalid.
RPC_S_INVALID_NET_ADDR = 1707,
/// No endpoint was found.
RPC_S_NO_ENDPOINT_FOUND = 1708,
/// The timeout value is invalid.
RPC_S_INVALID_TIMEOUT = 1709,
/// The object universal unique identifier (UUID) was not found.
RPC_S_OBJECT_NOT_FOUND = 1710,
/// The object universal unique identifier (UUID) has already been registered.
RPC_S_ALREADY_REGISTERED = 1711,
/// The type universal unique identifier (UUID) has already been registered.
RPC_S_TYPE_ALREADY_REGISTERED = 1712,
/// The RPC server is already listening.
RPC_S_ALREADY_LISTENING = 1713,
/// No protocol sequences have been registered.
RPC_S_NO_PROTSEQS_REGISTERED = 1714,
/// The RPC server is not listening.
RPC_S_NOT_LISTENING = 1715,
/// The manager type is unknown.
RPC_S_UNKNOWN_MGR_TYPE = 1716,
/// The interface is unknown.
RPC_S_UNKNOWN_IF = 1717,
/// There are no bindings.
RPC_S_NO_BINDINGS = 1718,
/// There are no protocol sequences.
RPC_S_NO_PROTSEQS = 1719,
/// The endpoint cannot be created.
RPC_S_CANT_CREATE_ENDPOINT = 1720,
/// Not enough resources are available to complete this operation.
RPC_S_OUT_OF_RESOURCES = 1721,
/// The RPC server is unavailable.
RPC_S_SERVER_UNAVAILABLE = 1722,
/// The RPC server is too busy to complete this operation.
RPC_S_SERVER_TOO_BUSY = 1723,
/// The network options are invalid.
RPC_S_INVALID_NETWORK_OPTIONS = 1724,
/// There are no remote procedure calls active on this thread.
RPC_S_NO_CALL_ACTIVE = 1725,
/// The remote procedure call failed.
RPC_S_CALL_FAILED = 1726,
/// The remote procedure call failed and did not execute.
RPC_S_CALL_FAILED_DNE = 1727,
/// A remote procedure call (RPC) protocol error occurred.
RPC_S_PROTOCOL_ERROR = 1728,
/// Access to the HTTP proxy is denied.
RPC_S_PROXY_ACCESS_DENIED = 1729,
/// The transfer syntax is not supported by the RPC server.
RPC_S_UNSUPPORTED_TRANS_SYN = 1730,
/// The universal unique identifier (UUID) type is not supported.
RPC_S_UNSUPPORTED_TYPE = 1732,
/// The tag is invalid.
RPC_S_INVALID_TAG = 1733,
/// The array bounds are invalid.
RPC_S_INVALID_BOUND = 1734,
/// The binding does not contain an entry name.
RPC_S_NO_ENTRY_NAME = 1735,
/// The name syntax is invalid.
RPC_S_INVALID_NAME_SYNTAX = 1736,
/// The name syntax is not supported.
RPC_S_UNSUPPORTED_NAME_SYNTAX = 1737,
/// No network address is available to use to construct a universal unique identifier (UUID).
RPC_S_UUID_NO_ADDRESS = 1739,
/// The endpoint is a duplicate.
RPC_S_DUPLICATE_ENDPOINT = 1740,
/// The authentication type is unknown.
RPC_S_UNKNOWN_AUTHN_TYPE = 1741,
/// The maximum number of calls is too small.
RPC_S_MAX_CALLS_TOO_SMALL = 1742,
/// The string is too long.
RPC_S_STRING_TOO_LONG = 1743,
/// The RPC protocol sequence was not found.
RPC_S_PROTSEQ_NOT_FOUND = 1744,
/// The procedure number is out of range.
RPC_S_PROCNUM_OUT_OF_RANGE = 1745,
/// The binding does not contain any authentication information.
RPC_S_BINDING_HAS_NO_AUTH = 1746,
/// The authentication service is unknown.
RPC_S_UNKNOWN_AUTHN_SERVICE = 1747,
/// The authentication level is unknown.
RPC_S_UNKNOWN_AUTHN_LEVEL = 1748,
/// The security context is invalid.
RPC_S_INVALID_AUTH_IDENTITY = 1749,
/// The authorization service is unknown.
RPC_S_UNKNOWN_AUTHZ_SERVICE = 1750,
/// The entry is invalid.
EPT_S_INVALID_ENTRY = 1751,
/// The server endpoint cannot perform the operation.
EPT_S_CANT_PERFORM_OP = 1752,
/// There are no more endpoints available from the endpoint mapper.
EPT_S_NOT_REGISTERED = 1753,
/// No interfaces have been exported.
RPC_S_NOTHING_TO_EXPORT = 1754,
/// The entry name is incomplete.
RPC_S_INCOMPLETE_NAME = 1755,
/// The version option is invalid.
RPC_S_INVALID_VERS_OPTION = 1756,
/// There are no more members.
RPC_S_NO_MORE_MEMBERS = 1757,
/// There is nothing to unexport.
RPC_S_NOT_ALL_OBJS_UNEXPORTED = 1758,
/// The interface was not found.
RPC_S_INTERFACE_NOT_FOUND = 1759,
/// The entry already exists.
RPC_S_ENTRY_ALREADY_EXISTS = 1760,
/// The entry is not found.
RPC_S_ENTRY_NOT_FOUND = 1761,
/// The name service is unavailable.
RPC_S_NAME_SERVICE_UNAVAILABLE = 1762,
/// The network address family is invalid.
RPC_S_INVALID_NAF_ID = 1763,
/// The requested operation is not supported.
RPC_S_CANNOT_SUPPORT = 1764,
/// No security context is available to allow impersonation.
RPC_S_NO_CONTEXT_AVAILABLE = 1765,
/// An internal error occurred in a remote procedure call (RPC).
RPC_S_INTERNAL_ERROR = 1766,
/// The RPC server attempted an integer division by zero.
RPC_S_ZERO_DIVIDE = 1767,
/// An addressing error occurred in the RPC server.
RPC_S_ADDRESS_ERROR = 1768,
/// A floating-point operation at the RPC server caused a division by zero.
RPC_S_FP_DIV_ZERO = 1769,
/// A floating-point underflow occurred at the RPC server.
RPC_S_FP_UNDERFLOW = 1770,
/// A floating-point overflow occurred at the RPC server.
RPC_S_FP_OVERFLOW = 1771,
/// The list of RPC servers available for the binding of auto handles has been exhausted.
RPC_X_NO_MORE_ENTRIES = 1772,
/// Unable to open the character translation table file.
RPC_X_SS_CHAR_TRANS_OPEN_FAIL = 1773,
/// The file containing the character translation table has fewer than 512 bytes.
RPC_X_SS_CHAR_TRANS_SHORT_FILE = 1774,
/// A null context handle was passed from the client to the host during a remote procedure call.
RPC_X_SS_IN_NULL_CONTEXT = 1775,
/// The context handle changed during a remote procedure call.
RPC_X_SS_CONTEXT_DAMAGED = 1777,
/// The binding handles passed to a remote procedure call do not match.
RPC_X_SS_HANDLES_MISMATCH = 1778,
/// The stub is unable to get the remote procedure call handle.
RPC_X_SS_CANNOT_GET_CALL_HANDLE = 1779,
/// A null reference pointer was passed to the stub.
RPC_X_NULL_REF_POINTER = 1780,
/// The enumeration value is out of range.
RPC_X_ENUM_VALUE_OUT_OF_RANGE = 1781,
/// The byte count is too small.
RPC_X_BYTE_COUNT_TOO_SMALL = 1782,
/// The stub received bad data.
RPC_X_BAD_STUB_DATA = 1783,
/// The supplied user buffer is not valid for the requested operation.
INVALID_USER_BUFFER = 1784,
/// The disk media is not recognized. It may not be formatted.
UNRECOGNIZED_MEDIA = 1785,
/// The workstation does not have a trust secret.
NO_TRUST_LSA_SECRET = 1786,
/// The security database on the server does not have a computer account for this workstation trust relationship.
NO_TRUST_SAM_ACCOUNT = 1787,
/// The trust relationship between the primary domain and the trusted domain failed.
TRUSTED_DOMAIN_FAILURE = 1788,
/// The trust relationship between this workstation and the primary domain failed.
TRUSTED_RELATIONSHIP_FAILURE = 1789,
/// The network logon failed.
TRUST_FAILURE = 1790,
/// A remote procedure call is already in progress for this thread.
RPC_S_CALL_IN_PROGRESS = 1791,
/// An attempt was made to logon, but the network logon service was not started.
NETLOGON_NOT_STARTED = 1792,
/// The user's account has expired.
ACCOUNT_EXPIRED = 1793,
/// The redirector is in use and cannot be unloaded.
REDIRECTOR_HAS_OPEN_HANDLES = 1794,
/// The specified printer driver is already installed.
PRINTER_DRIVER_ALREADY_INSTALLED = 1795,
/// The specified port is unknown.
UNKNOWN_PORT = 1796,
/// The printer driver is unknown.
UNKNOWN_PRINTER_DRIVER = 1797,
/// The print processor is unknown.
UNKNOWN_PRINTPROCESSOR = 1798,
/// The specified separator file is invalid.
INVALID_SEPARATOR_FILE = 1799,
/// The specified priority is invalid.
INVALID_PRIORITY = 1800,
/// The printer name is invalid.
INVALID_PRINTER_NAME = 1801,
/// The printer already exists.
PRINTER_ALREADY_EXISTS = 1802,
/// The printer command is invalid.
INVALID_PRINTER_COMMAND = 1803,
/// The specified datatype is invalid.
INVALID_DATATYPE = 1804,
/// The environment specified is invalid.
INVALID_ENVIRONMENT = 1805,
/// There are no more bindings.
RPC_S_NO_MORE_BINDINGS = 1806,
/// The account used is an interdomain trust account.
/// Use your global user account or local user account to access this server.
NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 1807,
/// The account used is a computer account.
/// Use your global user account or local user account to access this server.
NOLOGON_WORKSTATION_TRUST_ACCOUNT = 1808,
/// The account used is a server trust account.
/// Use your global user account or local user account to access this server.
NOLOGON_SERVER_TRUST_ACCOUNT = 1809,
/// The name or security ID (SID) of the domain specified is inconsistent with the trust information for that domain.
DOMAIN_TRUST_INCONSISTENT = 1810,
/// The server is in use and cannot be unloaded.
SERVER_HAS_OPEN_HANDLES = 1811,
/// The specified image file did not contain a resource section.
RESOURCE_DATA_NOT_FOUND = 1812,
/// The specified resource type cannot be found in the image file.
RESOURCE_TYPE_NOT_FOUND = 1813,
/// The specified resource name cannot be found in the image file.
RESOURCE_NAME_NOT_FOUND = 1814,
/// The specified resource language ID cannot be found in the image file.
RESOURCE_LANG_NOT_FOUND = 1815,
/// Not enough quota is available to process this command.
NOT_ENOUGH_QUOTA = 1816,
/// No interfaces have been registered.
RPC_S_NO_INTERFACES = 1817,
/// The remote procedure call was cancelled.
RPC_S_CALL_CANCELLED = 1818,
/// The binding handle does not contain all required information.
RPC_S_BINDING_INCOMPLETE = 1819,
/// A communications failure occurred during a remote procedure call.
RPC_S_COMM_FAILURE = 1820,
/// The requested authentication level is not supported.
RPC_S_UNSUPPORTED_AUTHN_LEVEL = 1821,
/// No principal name registered.
RPC_S_NO_PRINC_NAME = 1822,
/// The error specified is not a valid Windows RPC error code.
RPC_S_NOT_RPC_ERROR = 1823,
/// A UUID that is valid only on this computer has been allocated.
RPC_S_UUID_LOCAL_ONLY = 1824,
/// A security package specific error occurred.
RPC_S_SEC_PKG_ERROR = 1825,
/// Thread is not canceled.
RPC_S_NOT_CANCELLED = 1826,
/// Invalid operation on the encoding/decoding handle.
RPC_X_INVALID_ES_ACTION = 1827,
/// Incompatible version of the serializing package.
RPC_X_WRONG_ES_VERSION = 1828,
/// Incompatible version of the RPC stub.
RPC_X_WRONG_STUB_VERSION = 1829,
/// The RPC pipe object is invalid or corrupted.
RPC_X_INVALID_PIPE_OBJECT = 1830,
/// An invalid operation was attempted on an RPC pipe object.
RPC_X_WRONG_PIPE_ORDER = 1831,
/// Unsupported RPC pipe version.
RPC_X_WRONG_PIPE_VERSION = 1832,
/// HTTP proxy server rejected the connection because the cookie authentication failed.
RPC_S_COOKIE_AUTH_FAILED = 1833,
/// The group member was not found.
RPC_S_GROUP_MEMBER_NOT_FOUND = 1898,
/// The endpoint mapper database entry could not be created.
EPT_S_CANT_CREATE = 1899,
/// The object universal unique identifier (UUID) is the nil UUID.
RPC_S_INVALID_OBJECT = 1900,
/// The specified time is invalid.
INVALID_TIME = 1901,
/// The specified form name is invalid.
INVALID_FORM_NAME = 1902,
/// The specified form size is invalid.
INVALID_FORM_SIZE = 1903,
/// The specified printer handle is already being waited on.
ALREADY_WAITING = 1904,
/// The specified printer has been deleted.
PRINTER_DELETED = 1905,
/// The state of the printer is invalid.
INVALID_PRINTER_STATE = 1906,
/// The user's password must be changed before signing in.
PASSWORD_MUST_CHANGE = 1907,
/// Could not find the domain controller for this domain.
DOMAIN_CONTROLLER_NOT_FOUND = 1908,
/// The referenced account is currently locked out and may not be logged on to.
ACCOUNT_LOCKED_OUT = 1909,
/// The object exporter specified was not found.
OR_INVALID_OXID = 1910,
/// The object specified was not found.
OR_INVALID_OID = 1911,
/// The object resolver set specified was not found.
OR_INVALID_SET = 1912,
/// Some data remains to be sent in the request buffer.
RPC_S_SEND_INCOMPLETE = 1913,
/// Invalid asynchronous remote procedure call handle.
RPC_S_INVALID_ASYNC_HANDLE = 1914,
/// Invalid asynchronous RPC call handle for this operation.
RPC_S_INVALID_ASYNC_CALL = 1915,
/// The RPC pipe object has already been closed.
RPC_X_PIPE_CLOSED = 1916,
/// The RPC call completed before all pipes were processed.
RPC_X_PIPE_DISCIPLINE_ERROR = 1917,
/// No more data is available from the RPC pipe.
RPC_X_PIPE_EMPTY = 1918,
/// No site name is available for this machine.
NO_SITENAME = 1919,
/// The file cannot be accessed by the system.
CANT_ACCESS_FILE = 1920,
/// The name of the file cannot be resolved by the system.
CANT_RESOLVE_FILENAME = 1921,
/// The entry is not of the expected type.
RPC_S_ENTRY_TYPE_MISMATCH = 1922,
/// Not all object UUIDs could be exported to the specified entry.
RPC_S_NOT_ALL_OBJS_EXPORTED = 1923,
/// Interface could not be exported to the specified entry.
RPC_S_INTERFACE_NOT_EXPORTED = 1924,
/// The specified profile entry could not be added.
RPC_S_PROFILE_NOT_ADDED = 1925,
/// The specified profile element could not be added.
RPC_S_PRF_ELT_NOT_ADDED = 1926,
/// The specified profile element could not be removed.
RPC_S_PRF_ELT_NOT_REMOVED = 1927,
/// The group element could not be added.
RPC_S_GRP_ELT_NOT_ADDED = 1928,
/// The group element could not be removed.
RPC_S_GRP_ELT_NOT_REMOVED = 1929,
/// The printer driver is not compatible with a policy enabled on your computer that blocks NT 4.0 drivers.
KM_DRIVER_BLOCKED = 1930,
/// The context has expired and can no longer be used.
CONTEXT_EXPIRED = 1931,
/// The current user's delegated trust creation quota has been exceeded.
PER_USER_TRUST_QUOTA_EXCEEDED = 1932,
/// The total delegated trust creation quota has been exceeded.
ALL_USER_TRUST_QUOTA_EXCEEDED = 1933,
/// The current user's delegated trust deletion quota has been exceeded.
USER_DELETE_TRUST_QUOTA_EXCEEDED = 1934,
/// The computer you are signing into is protected by an authentication firewall.
/// The specified account is not allowed to authenticate to the computer.
AUTHENTICATION_FIREWALL_FAILED = 1935,
/// Remote connections to the Print Spooler are blocked by a policy set on your machine.
REMOTE_PRINT_CONNECTIONS_BLOCKED = 1936,
/// Authentication failed because NTLM authentication has been disabled.
NTLM_BLOCKED = 1937,
/// Logon Failure: EAS policy requires that the user change their password before this operation can be performed.
PASSWORD_CHANGE_REQUIRED = 1938,
/// The pixel format is invalid.
INVALID_PIXEL_FORMAT = 2000,
/// The specified driver is invalid.
BAD_DRIVER = 2001,
/// The window style or class attribute is invalid for this operation.
INVALID_WINDOW_STYLE = 2002,
/// The requested metafile operation is not supported.
METAFILE_NOT_SUPPORTED = 2003,
/// The requested transformation operation is not supported.
TRANSFORM_NOT_SUPPORTED = 2004,
/// The requested clipping operation is not supported.
CLIPPING_NOT_SUPPORTED = 2005,
/// The specified color management module is invalid.
INVALID_CMM = 2010,
/// The specified color profile is invalid.
INVALID_PROFILE = 2011,
/// The specified tag was not found.
TAG_NOT_FOUND = 2012,
/// A required tag is not present.
TAG_NOT_PRESENT = 2013,
/// The specified tag is already present.
DUPLICATE_TAG = 2014,
/// The specified color profile is not associated with the specified device.
PROFILE_NOT_ASSOCIATED_WITH_DEVICE = 2015,
/// The specified color profile was not found.
PROFILE_NOT_FOUND = 2016,
/// The specified color space is invalid.
INVALID_COLORSPACE = 2017,
/// Image Color Management is not enabled.
ICM_NOT_ENABLED = 2018,
/// There was an error while deleting the color transform.
DELETING_ICM_XFORM = 2019,
/// The specified color transform is invalid.
INVALID_TRANSFORM = 2020,
/// The specified transform does not match the bitmap's color space.
COLORSPACE_MISMATCH = 2021,
/// The specified named color index is not present in the profile.
INVALID_COLORINDEX = 2022,
/// The specified profile is intended for a device of a different type than the specified device.
PROFILE_DOES_NOT_MATCH_DEVICE = 2023,
/// The network connection was made successfully, but the user had to be prompted for a password other than the one originally specified.
CONNECTED_OTHER_PASSWORD = 2108,
/// The network connection was made successfully using default credentials.
CONNECTED_OTHER_PASSWORD_DEFAULT = 2109,
/// The specified username is invalid.
BAD_USERNAME = 2202,
/// This network connection does not exist.
NOT_CONNECTED = 2250,
/// This network connection has files open or requests pending.
OPEN_FILES = 2401,
/// Active connections still exist.
ACTIVE_CONNECTIONS = 2402,
/// The device is in use by an active process and cannot be disconnected.
DEVICE_IN_USE = 2404,
/// The specified print monitor is unknown.
UNKNOWN_PRINT_MONITOR = 3000,
/// The specified printer driver is currently in use.
PRINTER_DRIVER_IN_USE = 3001,
/// The spool file was not found.
SPOOL_FILE_NOT_FOUND = 3002,
/// A StartDocPrinter call was not issued.
SPL_NO_STARTDOC = 3003,
/// An AddJob call was not issued.
SPL_NO_ADDJOB = 3004,
/// The specified print processor has already been installed.
PRINT_PROCESSOR_ALREADY_INSTALLED = 3005,
/// The specified print monitor has already been installed.
PRINT_MONITOR_ALREADY_INSTALLED = 3006,
/// The specified print monitor does not have the required functions.
INVALID_PRINT_MONITOR = 3007,
/// The specified print monitor is currently in use.
PRINT_MONITOR_IN_USE = 3008,
/// The requested operation is not allowed when there are jobs queued to the printer.
PRINTER_HAS_JOBS_QUEUED = 3009,
/// The requested operation is successful.
/// Changes will not be effective until the system is rebooted.
SUCCESS_REBOOT_REQUIRED = 3010,
/// The requested operation is successful.
/// Changes will not be effective until the service is restarted.
SUCCESS_RESTART_REQUIRED = 3011,
/// No printers were found.
PRINTER_NOT_FOUND = 3012,
/// The printer driver is known to be unreliable.
PRINTER_DRIVER_WARNED = 3013,
/// The printer driver is known to harm the system.
PRINTER_DRIVER_BLOCKED = 3014,
/// The specified printer driver package is currently in use.
PRINTER_DRIVER_PACKAGE_IN_USE = 3015,
/// Unable to find a core driver package that is required by the printer driver package.
CORE_DRIVER_PACKAGE_NOT_FOUND = 3016,
/// The requested operation failed.
/// A system reboot is required to roll back changes made.
FAIL_REBOOT_REQUIRED = 3017,
/// The requested operation failed.
/// A system reboot has been initiated to roll back changes made.
FAIL_REBOOT_INITIATED = 3018,
/// The specified printer driver was not found on the system and needs to be downloaded.
PRINTER_DRIVER_DOWNLOAD_NEEDED = 3019,
/// The requested print job has failed to print.
/// A print system update requires the job to be resubmitted.
PRINT_JOB_RESTART_REQUIRED = 3020,
/// The printer driver does not contain a valid manifest, or contains too many manifests.
INVALID_PRINTER_DRIVER_MANIFEST = 3021,
/// The specified printer cannot be shared.
PRINTER_NOT_SHAREABLE = 3022,
/// The operation was paused.
REQUEST_PAUSED = 3050,
/// Reissue the given operation as a cached IO operation.
IO_REISSUE_AS_CACHED = 3950,
_,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/shell32.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const WINAPI = windows.WINAPI;
const KNOWNFOLDERID = windows.KNOWNFOLDERID;
const DWORD = windows.DWORD;
const HANDLE = windows.HANDLE;
const WCHAR = windows.WCHAR;
const HRESULT = windows.HRESULT;
pub extern "shell32" fn SHGetKnownFolderPath(
rfid: *const KNOWNFOLDERID,
dwFlags: DWORD,
hToken: ?HANDLE,
ppszPath: *[*:0]WCHAR,
) callconv(WINAPI) HRESULT;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/test.zig | const std = @import("../../std.zig");
const builtin = @import("builtin");
const windows = std.os.windows;
const mem = std.mem;
const testing = std.testing;
const expect = testing.expect;
fn testRemoveDotDirs(str: []const u8, expected: []const u8) !void {
const mutable = try testing.allocator.dupe(u8, str);
defer testing.allocator.free(mutable);
const actual = mutable[0..try windows.removeDotDirsSanitized(u8, mutable)];
try testing.expect(mem.eql(u8, actual, expected));
}
fn testRemoveDotDirsError(err: anyerror, str: []const u8) !void {
const mutable = try testing.allocator.dupe(u8, str);
defer testing.allocator.free(mutable);
try testing.expectError(err, windows.removeDotDirsSanitized(u8, mutable));
}
test "removeDotDirs" {
try testRemoveDotDirs("", "");
try testRemoveDotDirs(".", "");
try testRemoveDotDirs(".\\", "");
try testRemoveDotDirs(".\\.", "");
try testRemoveDotDirs(".\\.\\", "");
try testRemoveDotDirs(".\\.\\.", "");
try testRemoveDotDirs("a", "a");
try testRemoveDotDirs("a\\", "a\\");
try testRemoveDotDirs("a\\b", "a\\b");
try testRemoveDotDirs("a\\.", "a\\");
try testRemoveDotDirs("a\\b\\.", "a\\b\\");
try testRemoveDotDirs("a\\.\\b", "a\\b");
try testRemoveDotDirs(".a", ".a");
try testRemoveDotDirs(".a\\", ".a\\");
try testRemoveDotDirs(".a\\.b", ".a\\.b");
try testRemoveDotDirs(".a\\.", ".a\\");
try testRemoveDotDirs(".a\\.\\.", ".a\\");
try testRemoveDotDirs(".a\\.\\.\\.b", ".a\\.b");
try testRemoveDotDirs(".a\\.\\.\\.b\\", ".a\\.b\\");
try testRemoveDotDirsError(error.TooManyParentDirs, "..");
try testRemoveDotDirsError(error.TooManyParentDirs, "..\\");
try testRemoveDotDirsError(error.TooManyParentDirs, ".\\..\\");
try testRemoveDotDirsError(error.TooManyParentDirs, ".\\.\\..\\");
try testRemoveDotDirs("a\\..", "");
try testRemoveDotDirs("a\\..\\", "");
try testRemoveDotDirs("a\\..\\.", "");
try testRemoveDotDirs("a\\..\\.\\", "");
try testRemoveDotDirs("a\\..\\.\\.", "");
try testRemoveDotDirsError(error.TooManyParentDirs, "a\\..\\.\\.\\..");
try testRemoveDotDirs("a\\..\\.\\.\\b", "b");
try testRemoveDotDirs("a\\..\\.\\.\\b\\", "b\\");
try testRemoveDotDirs("a\\..\\.\\.\\b\\.", "b\\");
try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\", "b\\");
try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..", "");
try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..\\", "");
try testRemoveDotDirs("a\\..\\.\\.\\b\\.\\..\\.", "");
try testRemoveDotDirsError(error.TooManyParentDirs, "a\\..\\.\\.\\b\\.\\..\\.\\..");
try testRemoveDotDirs("a\\b\\..\\", "a\\");
try testRemoveDotDirs("a\\b\\..\\c", "a\\c");
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/lang.zig | pub const NEUTRAL = 0x00;
pub const INVARIANT = 0x7f;
pub const AFRIKAANS = 0x36;
pub const ALBANIAN = 0x1c;
pub const ALSATIAN = 0x84;
pub const AMHARIC = 0x5e;
pub const ARABIC = 0x01;
pub const ARMENIAN = 0x2b;
pub const ASSAMESE = 0x4d;
pub const AZERI = 0x2c;
pub const AZERBAIJANI = 0x2c;
pub const BANGLA = 0x45;
pub const BASHKIR = 0x6d;
pub const BASQUE = 0x2d;
pub const BELARUSIAN = 0x23;
pub const BENGALI = 0x45;
pub const BRETON = 0x7e;
pub const BOSNIAN = 0x1a;
pub const BOSNIAN_NEUTRAL = 0x781a;
pub const BULGARIAN = 0x02;
pub const CATALAN = 0x03;
pub const CENTRAL_KURDISH = 0x92;
pub const CHEROKEE = 0x5c;
pub const CHINESE = 0x04;
pub const CHINESE_SIMPLIFIED = 0x04;
pub const CHINESE_TRADITIONAL = 0x7c04;
pub const CORSICAN = 0x83;
pub const CROATIAN = 0x1a;
pub const CZECH = 0x05;
pub const DANISH = 0x06;
pub const DARI = 0x8c;
pub const DIVEHI = 0x65;
pub const DUTCH = 0x13;
pub const ENGLISH = 0x09;
pub const ESTONIAN = 0x25;
pub const FAEROESE = 0x38;
pub const FARSI = 0x29;
pub const FILIPINO = 0x64;
pub const FINNISH = 0x0b;
pub const FRENCH = 0x0c;
pub const FRISIAN = 0x62;
pub const FULAH = 0x67;
pub const GALICIAN = 0x56;
pub const GEORGIAN = 0x37;
pub const GERMAN = 0x07;
pub const GREEK = 0x08;
pub const GREENLANDIC = 0x6f;
pub const GUJARATI = 0x47;
pub const HAUSA = 0x68;
pub const HAWAIIAN = 0x75;
pub const HEBREW = 0x0d;
pub const HINDI = 0x39;
pub const HUNGARIAN = 0x0e;
pub const ICELANDIC = 0x0f;
pub const IGBO = 0x70;
pub const INDONESIAN = 0x21;
pub const INUKTITUT = 0x5d;
pub const IRISH = 0x3c;
pub const ITALIAN = 0x10;
pub const JAPANESE = 0x11;
pub const KANNADA = 0x4b;
pub const KASHMIRI = 0x60;
pub const KAZAK = 0x3f;
pub const KHMER = 0x53;
pub const KICHE = 0x86;
pub const KINYARWANDA = 0x87;
pub const KONKANI = 0x57;
pub const KOREAN = 0x12;
pub const KYRGYZ = 0x40;
pub const LAO = 0x54;
pub const LATVIAN = 0x26;
pub const LITHUANIAN = 0x27;
pub const LOWER_SORBIAN = 0x2e;
pub const LUXEMBOURGISH = 0x6e;
pub const MACEDONIAN = 0x2f;
pub const MALAY = 0x3e;
pub const MALAYALAM = 0x4c;
pub const MALTESE = 0x3a;
pub const MANIPURI = 0x58;
pub const MAORI = 0x81;
pub const MAPUDUNGUN = 0x7a;
pub const MARATHI = 0x4e;
pub const MOHAWK = 0x7c;
pub const MONGOLIAN = 0x50;
pub const NEPALI = 0x61;
pub const NORWEGIAN = 0x14;
pub const OCCITAN = 0x82;
pub const ODIA = 0x48;
pub const ORIYA = 0x48;
pub const PASHTO = 0x63;
pub const PERSIAN = 0x29;
pub const POLISH = 0x15;
pub const PORTUGUESE = 0x16;
pub const PULAR = 0x67;
pub const PUNJABI = 0x46;
pub const QUECHUA = 0x6b;
pub const ROMANIAN = 0x18;
pub const ROMANSH = 0x17;
pub const RUSSIAN = 0x19;
pub const SAKHA = 0x85;
pub const SAMI = 0x3b;
pub const SANSKRIT = 0x4f;
pub const SCOTTISH_GAELIC = 0x91;
pub const SERBIAN = 0x1a;
pub const SERBIAN_NEUTRAL = 0x7c1a;
pub const SINDHI = 0x59;
pub const SINHALESE = 0x5b;
pub const SLOVAK = 0x1b;
pub const SLOVENIAN = 0x24;
pub const SOTHO = 0x6c;
pub const SPANISH = 0x0a;
pub const SWAHILI = 0x41;
pub const SWEDISH = 0x1d;
pub const SYRIAC = 0x5a;
pub const TAJIK = 0x28;
pub const TAMAZIGHT = 0x5f;
pub const TAMIL = 0x49;
pub const TATAR = 0x44;
pub const TELUGU = 0x4a;
pub const THAI = 0x1e;
pub const TIBETAN = 0x51;
pub const TIGRIGNA = 0x73;
pub const TIGRINYA = 0x73;
pub const TSWANA = 0x32;
pub const TURKISH = 0x1f;
pub const TURKMEN = 0x42;
pub const UIGHUR = 0x80;
pub const UKRAINIAN = 0x22;
pub const UPPER_SORBIAN = 0x2e;
pub const URDU = 0x20;
pub const UZBEK = 0x43;
pub const VALENCIAN = 0x03;
pub const VIETNAMESE = 0x2a;
pub const WELSH = 0x52;
pub const WOLOF = 0x88;
pub const XHOSA = 0x34;
pub const YAKUT = 0x85;
pub const YI = 0x78;
pub const YORUBA = 0x6a;
pub const ZULU = 0x35;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/gdi32.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const BOOL = windows.BOOL;
const DWORD = windows.DWORD;
const WINAPI = windows.WINAPI;
const HDC = windows.HDC;
const HGLRC = windows.HGLRC;
const WORD = windows.WORD;
const BYTE = windows.BYTE;
pub const PIXELFORMATDESCRIPTOR = extern struct {
nSize: WORD = @sizeOf(PIXELFORMATDESCRIPTOR),
nVersion: WORD,
dwFlags: DWORD,
iPixelType: BYTE,
cColorBits: BYTE,
cRedBits: BYTE,
cRedShift: BYTE,
cGreenBits: BYTE,
cGreenShift: BYTE,
cBlueBits: BYTE,
cBlueShift: BYTE,
cAlphaBits: BYTE,
cAlphaShift: BYTE,
cAccumBits: BYTE,
cAccumRedBits: BYTE,
cAccumGreenBits: BYTE,
cAccumBlueBits: BYTE,
cAccumAlphaBits: BYTE,
cDepthBits: BYTE,
cStencilBits: BYTE,
cAuxBuffers: BYTE,
iLayerType: BYTE,
bReserved: BYTE,
dwLayerMask: DWORD,
dwVisibleMask: DWORD,
dwDamageMask: DWORD,
};
pub extern "gdi32" fn SetPixelFormat(
hdc: ?HDC,
format: i32,
ppfd: ?*const PIXELFORMATDESCRIPTOR,
) callconv(WINAPI) bool;
pub extern "gdi32" fn ChoosePixelFormat(
hdc: ?HDC,
ppfd: ?*const PIXELFORMATDESCRIPTOR,
) callconv(WINAPI) i32;
pub extern "gdi32" fn SwapBuffers(hdc: ?HDC) callconv(WINAPI) bool;
pub extern "gdi32" fn wglCreateContext(hdc: ?HDC) callconv(WINAPI) ?HGLRC;
pub extern "gdi32" fn wglMakeCurrent(hdc: ?HDC, hglrc: ?HGLRC) callconv(WINAPI) bool;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/kernel32.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const BOOL = windows.BOOL;
const BOOLEAN = windows.BOOLEAN;
const CONDITION_VARIABLE = windows.CONDITION_VARIABLE;
const CONSOLE_SCREEN_BUFFER_INFO = windows.CONSOLE_SCREEN_BUFFER_INFO;
const COORD = windows.COORD;
const DWORD = windows.DWORD;
const FILE_INFO_BY_HANDLE_CLASS = windows.FILE_INFO_BY_HANDLE_CLASS;
const HANDLE = windows.HANDLE;
const HMODULE = windows.HMODULE;
const HRESULT = windows.HRESULT;
const LARGE_INTEGER = windows.LARGE_INTEGER;
const LPCWSTR = windows.LPCWSTR;
const LPTHREAD_START_ROUTINE = windows.LPTHREAD_START_ROUTINE;
const LPVOID = windows.LPVOID;
const LPWSTR = windows.LPWSTR;
const MODULEINFO = windows.MODULEINFO;
const OVERLAPPED = windows.OVERLAPPED;
const PERFORMANCE_INFORMATION = windows.PERFORMANCE_INFORMATION;
const PROCESS_MEMORY_COUNTERS = windows.PROCESS_MEMORY_COUNTERS;
const PSAPI_WS_WATCH_INFORMATION = windows.PSAPI_WS_WATCH_INFORMATION;
const PSAPI_WS_WATCH_INFORMATION_EX = windows.PSAPI_WS_WATCH_INFORMATION_EX;
const SECURITY_ATTRIBUTES = windows.SECURITY_ATTRIBUTES;
const SIZE_T = windows.SIZE_T;
const SRWLOCK = windows.SRWLOCK;
const UINT = windows.UINT;
const VECTORED_EXCEPTION_HANDLER = windows.VECTORED_EXCEPTION_HANDLER;
const WCHAR = windows.WCHAR;
const WINAPI = windows.WINAPI;
const WORD = windows.WORD;
const Win32Error = windows.Win32Error;
const va_list = windows.va_list;
const HLOCAL = windows.HLOCAL;
const FILETIME = windows.FILETIME;
const STARTUPINFOW = windows.STARTUPINFOW;
const PROCESS_INFORMATION = windows.PROCESS_INFORMATION;
const OVERLAPPED_ENTRY = windows.OVERLAPPED_ENTRY;
const LPHEAP_SUMMARY = windows.LPHEAP_SUMMARY;
const ULONG_PTR = windows.ULONG_PTR;
const FILE_NOTIFY_INFORMATION = windows.FILE_NOTIFY_INFORMATION;
const HANDLER_ROUTINE = windows.HANDLER_ROUTINE;
const ULONG = windows.ULONG;
const PVOID = windows.PVOID;
const LPSTR = windows.LPSTR;
const PENUM_PAGE_FILE_CALLBACKA = windows.PENUM_PAGE_FILE_CALLBACKA;
const PENUM_PAGE_FILE_CALLBACKW = windows.PENUM_PAGE_FILE_CALLBACKW;
const INIT_ONCE = windows.INIT_ONCE;
const CRITICAL_SECTION = windows.CRITICAL_SECTION;
const WIN32_FIND_DATAW = windows.WIN32_FIND_DATAW;
const CHAR = windows.CHAR;
const BY_HANDLE_FILE_INFORMATION = windows.BY_HANDLE_FILE_INFORMATION;
const SYSTEM_INFO = windows.SYSTEM_INFO;
const LPOVERLAPPED_COMPLETION_ROUTINE = windows.LPOVERLAPPED_COMPLETION_ROUTINE;
const UCHAR = windows.UCHAR;
const FARPROC = windows.FARPROC;
const INIT_ONCE_FN = windows.INIT_ONCE_FN;
pub extern "kernel32" fn AddVectoredExceptionHandler(First: c_ulong, Handler: ?VECTORED_EXCEPTION_HANDLER) callconv(WINAPI) ?*anyopaque;
pub extern "kernel32" fn RemoveVectoredExceptionHandler(Handle: HANDLE) callconv(WINAPI) c_ulong;
pub extern "kernel32" fn CancelIo(hFile: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn CancelIoEx(hFile: HANDLE, lpOverlapped: ?*OVERLAPPED) callconv(WINAPI) BOOL;
pub extern "kernel32" fn CloseHandle(hObject: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn CreateDirectoryW(lpPathName: [*:0]const u16, lpSecurityAttributes: ?*SECURITY_ATTRIBUTES) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetEndOfFile(hFile: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn CreateEventExW(
lpEventAttributes: ?*SECURITY_ATTRIBUTES,
lpName: [*:0]const u16,
dwFlags: DWORD,
dwDesiredAccess: DWORD,
) callconv(WINAPI) ?HANDLE;
pub extern "kernel32" fn CreateFileW(
lpFileName: [*:0]const u16,
dwDesiredAccess: DWORD,
dwShareMode: DWORD,
lpSecurityAttributes: ?*SECURITY_ATTRIBUTES,
dwCreationDisposition: DWORD,
dwFlagsAndAttributes: DWORD,
hTemplateFile: ?HANDLE,
) callconv(WINAPI) HANDLE;
pub extern "kernel32" fn CreatePipe(
hReadPipe: *HANDLE,
hWritePipe: *HANDLE,
lpPipeAttributes: *const SECURITY_ATTRIBUTES,
nSize: DWORD,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn CreateNamedPipeW(
lpName: LPCWSTR,
dwOpenMode: DWORD,
dwPipeMode: DWORD,
nMaxInstances: DWORD,
nOutBufferSize: DWORD,
nInBufferSize: DWORD,
nDefaultTimeOut: DWORD,
lpSecurityAttributes: ?*const SECURITY_ATTRIBUTES,
) callconv(WINAPI) HANDLE;
pub extern "kernel32" fn CreateProcessW(
lpApplicationName: ?LPWSTR,
lpCommandLine: LPWSTR,
lpProcessAttributes: ?*SECURITY_ATTRIBUTES,
lpThreadAttributes: ?*SECURITY_ATTRIBUTES,
bInheritHandles: BOOL,
dwCreationFlags: DWORD,
lpEnvironment: ?*anyopaque,
lpCurrentDirectory: ?LPWSTR,
lpStartupInfo: *STARTUPINFOW,
lpProcessInformation: *PROCESS_INFORMATION,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn CreateSymbolicLinkW(lpSymlinkFileName: [*:0]const u16, lpTargetFileName: [*:0]const u16, dwFlags: DWORD) callconv(WINAPI) BOOLEAN;
pub extern "kernel32" fn CreateIoCompletionPort(FileHandle: HANDLE, ExistingCompletionPort: ?HANDLE, CompletionKey: ULONG_PTR, NumberOfConcurrentThreads: DWORD) callconv(WINAPI) ?HANDLE;
pub extern "kernel32" fn CreateThread(lpThreadAttributes: ?*SECURITY_ATTRIBUTES, dwStackSize: SIZE_T, lpStartAddress: LPTHREAD_START_ROUTINE, lpParameter: ?LPVOID, dwCreationFlags: DWORD, lpThreadId: ?*DWORD) callconv(WINAPI) ?HANDLE;
pub extern "kernel32" fn DeviceIoControl(
h: HANDLE,
dwIoControlCode: DWORD,
lpInBuffer: ?*const anyopaque,
nInBufferSize: DWORD,
lpOutBuffer: ?LPVOID,
nOutBufferSize: DWORD,
lpBytesReturned: ?*DWORD,
lpOverlapped: ?*OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn DeleteFileW(lpFileName: [*:0]const u16) callconv(WINAPI) BOOL;
pub extern "kernel32" fn DuplicateHandle(hSourceProcessHandle: HANDLE, hSourceHandle: HANDLE, hTargetProcessHandle: HANDLE, lpTargetHandle: *HANDLE, dwDesiredAccess: DWORD, bInheritHandle: BOOL, dwOptions: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn ExitProcess(exit_code: UINT) callconv(WINAPI) noreturn;
pub extern "kernel32" fn FindFirstFileW(lpFileName: [*:0]const u16, lpFindFileData: *WIN32_FIND_DATAW) callconv(WINAPI) HANDLE;
pub extern "kernel32" fn FindClose(hFindFile: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn FindNextFileW(hFindFile: HANDLE, lpFindFileData: *WIN32_FIND_DATAW) callconv(WINAPI) BOOL;
pub extern "kernel32" fn FormatMessageW(dwFlags: DWORD, lpSource: ?LPVOID, dwMessageId: Win32Error, dwLanguageId: DWORD, lpBuffer: [*]u16, nSize: DWORD, Arguments: ?*va_list) callconv(WINAPI) DWORD;
pub extern "kernel32" fn FreeEnvironmentStringsW(penv: [*:0]u16) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetCommandLineA() callconv(WINAPI) LPSTR;
pub extern "kernel32" fn GetCommandLineW() callconv(WINAPI) LPWSTR;
pub extern "kernel32" fn GetConsoleMode(in_hConsoleHandle: HANDLE, out_lpMode: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetConsoleOutputCP() callconv(WINAPI) UINT;
pub extern "kernel32" fn GetConsoleScreenBufferInfo(hConsoleOutput: HANDLE, lpConsoleScreenBufferInfo: *CONSOLE_SCREEN_BUFFER_INFO) callconv(WINAPI) BOOL;
pub extern "kernel32" fn FillConsoleOutputCharacterA(hConsoleOutput: HANDLE, cCharacter: CHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn FillConsoleOutputCharacterW(hConsoleOutput: HANDLE, cCharacter: WCHAR, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfCharsWritten: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn FillConsoleOutputAttribute(hConsoleOutput: HANDLE, wAttribute: WORD, nLength: DWORD, dwWriteCoord: COORD, lpNumberOfAttrsWritten: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetConsoleCursorPosition(hConsoleOutput: HANDLE, dwCursorPosition: COORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: ?[*]WCHAR) callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetCurrentThread() callconv(WINAPI) HANDLE;
pub extern "kernel32" fn GetCurrentThreadId() callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetCurrentProcessId() callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetCurrentProcess() callconv(WINAPI) HANDLE;
pub extern "kernel32" fn GetEnvironmentStringsW() callconv(WINAPI) ?[*:0]u16;
pub extern "kernel32" fn GetEnvironmentVariableW(lpName: LPWSTR, lpBuffer: [*]u16, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetFileSizeEx(hFile: HANDLE, lpFileSize: *LARGE_INTEGER) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetFileAttributesW(lpFileName: [*]const WCHAR) callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetModuleFileNameW(hModule: ?HMODULE, lpFilename: [*]u16, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetModuleHandleW(lpModuleName: ?[*:0]const WCHAR) callconv(WINAPI) ?HMODULE;
pub extern "kernel32" fn GetLastError() callconv(WINAPI) Win32Error;
pub extern "kernel32" fn SetLastError(dwErrCode: Win32Error) callconv(WINAPI) void;
pub extern "kernel32" fn GetFileInformationByHandle(
hFile: HANDLE,
lpFileInformation: *BY_HANDLE_FILE_INFORMATION,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetFileInformationByHandleEx(
in_hFile: HANDLE,
in_FileInformationClass: FILE_INFO_BY_HANDLE_CLASS,
out_lpFileInformation: *anyopaque,
in_dwBufferSize: DWORD,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetFinalPathNameByHandleW(
hFile: HANDLE,
lpszFilePath: [*]u16,
cchFilePath: DWORD,
dwFlags: DWORD,
) callconv(WINAPI) DWORD;
pub extern "kernel32" fn GetFullPathNameW(
lpFileName: [*:0]const u16,
nBufferLength: u32,
lpBuffer: ?[*:0]u16,
lpFilePart: ?*?[*:0]u16,
) callconv(@import("std").os.windows.WINAPI) u32;
pub extern "kernel32" fn GetOverlappedResult(hFile: HANDLE, lpOverlapped: *OVERLAPPED, lpNumberOfBytesTransferred: *DWORD, bWait: BOOL) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetProcessHeap() callconv(WINAPI) ?HANDLE;
pub extern "kernel32" fn GetQueuedCompletionStatus(CompletionPort: HANDLE, lpNumberOfBytesTransferred: *DWORD, lpCompletionKey: *ULONG_PTR, lpOverlapped: *?*OVERLAPPED, dwMilliseconds: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetQueuedCompletionStatusEx(
CompletionPort: HANDLE,
lpCompletionPortEntries: [*]OVERLAPPED_ENTRY,
ulCount: ULONG,
ulNumEntriesRemoved: *ULONG,
dwMilliseconds: DWORD,
fAlertable: BOOL,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetSystemInfo(lpSystemInfo: *SYSTEM_INFO) callconv(WINAPI) void;
pub extern "kernel32" fn GetSystemTimeAsFileTime(*FILETIME) callconv(WINAPI) void;
pub extern "kernel32" fn HeapCreate(flOptions: DWORD, dwInitialSize: SIZE_T, dwMaximumSize: SIZE_T) callconv(WINAPI) ?HANDLE;
pub extern "kernel32" fn HeapDestroy(hHeap: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn HeapReAlloc(hHeap: HANDLE, dwFlags: DWORD, lpMem: *anyopaque, dwBytes: SIZE_T) callconv(WINAPI) ?*anyopaque;
pub extern "kernel32" fn HeapSize(hHeap: HANDLE, dwFlags: DWORD, lpMem: *const anyopaque) callconv(WINAPI) SIZE_T;
pub extern "kernel32" fn HeapCompact(hHeap: HANDLE, dwFlags: DWORD) callconv(WINAPI) SIZE_T;
pub extern "kernel32" fn HeapSummary(hHeap: HANDLE, dwFlags: DWORD, lpSummary: LPHEAP_SUMMARY) callconv(WINAPI) BOOL;
pub extern "kernel32" fn GetStdHandle(in_nStdHandle: DWORD) callconv(WINAPI) ?HANDLE;
pub extern "kernel32" fn HeapAlloc(hHeap: HANDLE, dwFlags: DWORD, dwBytes: SIZE_T) callconv(WINAPI) ?*anyopaque;
pub extern "kernel32" fn HeapFree(hHeap: HANDLE, dwFlags: DWORD, lpMem: *anyopaque) callconv(WINAPI) BOOL;
pub extern "kernel32" fn HeapValidate(hHeap: HANDLE, dwFlags: DWORD, lpMem: ?*const anyopaque) callconv(WINAPI) BOOL;
pub extern "kernel32" fn VirtualAlloc(lpAddress: ?LPVOID, dwSize: SIZE_T, flAllocationType: DWORD, flProtect: DWORD) callconv(WINAPI) ?LPVOID;
pub extern "kernel32" fn VirtualFree(lpAddress: ?LPVOID, dwSize: SIZE_T, dwFreeType: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn LocalFree(hMem: HLOCAL) callconv(WINAPI) ?HLOCAL;
pub extern "kernel32" fn MoveFileExW(
lpExistingFileName: [*:0]const u16,
lpNewFileName: [*:0]const u16,
dwFlags: DWORD,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn PostQueuedCompletionStatus(CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, lpOverlapped: ?*OVERLAPPED) callconv(WINAPI) BOOL;
pub extern "kernel32" fn QueryPerformanceCounter(lpPerformanceCount: *LARGE_INTEGER) callconv(WINAPI) BOOL;
pub extern "kernel32" fn QueryPerformanceFrequency(lpFrequency: *LARGE_INTEGER) callconv(WINAPI) BOOL;
pub extern "kernel32" fn ReadDirectoryChangesW(
hDirectory: HANDLE,
lpBuffer: [*]align(@alignOf(FILE_NOTIFY_INFORMATION)) u8,
nBufferLength: DWORD,
bWatchSubtree: BOOL,
dwNotifyFilter: DWORD,
lpBytesReturned: ?*DWORD,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn ReadFile(
in_hFile: HANDLE,
out_lpBuffer: [*]u8,
in_nNumberOfBytesToRead: DWORD,
out_lpNumberOfBytesRead: ?*DWORD,
in_out_lpOverlapped: ?*OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn RemoveDirectoryW(lpPathName: [*:0]const u16) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetConsoleTextAttribute(hConsoleOutput: HANDLE, wAttributes: WORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetConsoleCtrlHandler(
HandlerRoutine: ?HANDLER_ROUTINE,
Add: BOOL,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetConsoleOutputCP(wCodePageID: UINT) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetFileCompletionNotificationModes(
FileHandle: HANDLE,
Flags: UCHAR,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetFilePointerEx(
in_fFile: HANDLE,
in_liDistanceToMove: LARGE_INTEGER,
out_opt_ldNewFilePointer: ?*LARGE_INTEGER,
in_dwMoveMethod: DWORD,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetFileTime(
hFile: HANDLE,
lpCreationTime: ?*const FILETIME,
lpLastAccessTime: ?*const FILETIME,
lpLastWriteTime: ?*const FILETIME,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn Sleep(dwMilliseconds: DWORD) callconv(WINAPI) void;
pub extern "kernel32" fn SwitchToThread() callconv(WINAPI) BOOL;
pub extern "kernel32" fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) callconv(WINAPI) BOOL;
pub extern "kernel32" fn TlsAlloc() callconv(WINAPI) DWORD;
pub extern "kernel32" fn TlsFree(dwTlsIndex: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn WaitForSingleObjectEx(hHandle: HANDLE, dwMilliseconds: DWORD, bAlertable: BOOL) callconv(WINAPI) DWORD;
pub extern "kernel32" fn WaitForMultipleObjects(nCount: DWORD, lpHandle: [*]const HANDLE, bWaitAll: BOOL, dwMilliseconds: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn WaitForMultipleObjectsEx(
nCount: DWORD,
lpHandle: [*]const HANDLE,
bWaitAll: BOOL,
dwMilliseconds: DWORD,
bAlertable: BOOL,
) callconv(WINAPI) DWORD;
pub extern "kernel32" fn WriteFile(
in_hFile: HANDLE,
in_lpBuffer: [*]const u8,
in_nNumberOfBytesToWrite: DWORD,
out_lpNumberOfBytesWritten: ?*DWORD,
in_out_lpOverlapped: ?*OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn WriteFileEx(hFile: HANDLE, lpBuffer: [*]const u8, nNumberOfBytesToWrite: DWORD, lpOverlapped: *OVERLAPPED, lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn LoadLibraryW(lpLibFileName: [*:0]const u16) callconv(WINAPI) ?HMODULE;
pub extern "kernel32" fn GetProcAddress(hModule: HMODULE, lpProcName: [*]const u8) callconv(WINAPI) ?FARPROC;
pub extern "kernel32" fn FreeLibrary(hModule: HMODULE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn InitializeCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void;
pub extern "kernel32" fn EnterCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void;
pub extern "kernel32" fn LeaveCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void;
pub extern "kernel32" fn DeleteCriticalSection(lpCriticalSection: *CRITICAL_SECTION) callconv(WINAPI) void;
pub extern "kernel32" fn InitOnceExecuteOnce(InitOnce: *INIT_ONCE, InitFn: INIT_ONCE_FN, Parameter: ?*anyopaque, Context: ?*anyopaque) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: *DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetMappedFileNameA(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetMappedFileNameW(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: *MODULEINFO, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32GetPerformanceInfo(pPerformanceInformation: *PERFORMANCE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "kernel32" fn K32GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: *PROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32GetWsChanges(hProcess: HANDLE, lpWatchInfo: *PSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: *PSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32InitializeProcessForWsWatch(hProcess: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn K32QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "kernel32" fn FlushFileBuffers(hFile: HANDLE) callconv(WINAPI) BOOL;
pub extern "kernel32" fn WakeAllConditionVariable(c: *CONDITION_VARIABLE) callconv(WINAPI) void;
pub extern "kernel32" fn WakeConditionVariable(c: *CONDITION_VARIABLE) callconv(WINAPI) void;
pub extern "kernel32" fn SleepConditionVariableSRW(
c: *CONDITION_VARIABLE,
s: *SRWLOCK,
t: DWORD,
f: ULONG,
) callconv(WINAPI) BOOL;
pub extern "kernel32" fn TryAcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) BOOLEAN;
pub extern "kernel32" fn AcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;
pub extern "kernel32" fn ReleaseSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;
pub extern "kernel32" fn SetThreadDescription(hThread: HANDLE, lpThreadDescription: LPCWSTR) callconv(WINAPI) HRESULT;
pub extern "kernel32" fn GetThreadDescription(hThread: HANDLE, ppszThreadDescription: *LPWSTR) callconv(WINAPI) HRESULT;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/psapi.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const WINAPI = windows.WINAPI;
const DWORD = windows.DWORD;
const HANDLE = windows.HANDLE;
const PENUM_PAGE_FILE_CALLBACKW = windows.PENUM_PAGE_FILE_CALLBACKW;
const HMODULE = windows.HMODULE;
const BOOL = windows.BOOL;
const BOOLEAN = windows.BOOLEAN;
const CONDITION_VARIABLE = windows.CONDITION_VARIABLE;
const CONSOLE_SCREEN_BUFFER_INFO = windows.CONSOLE_SCREEN_BUFFER_INFO;
const COORD = windows.COORD;
const FILE_INFO_BY_HANDLE_CLASS = windows.FILE_INFO_BY_HANDLE_CLASS;
const HRESULT = windows.HRESULT;
const LARGE_INTEGER = windows.LARGE_INTEGER;
const LPCWSTR = windows.LPCWSTR;
const LPTHREAD_START_ROUTINE = windows.LPTHREAD_START_ROUTINE;
const LPVOID = windows.LPVOID;
const LPWSTR = windows.LPWSTR;
const MODULEINFO = windows.MODULEINFO;
const OVERLAPPED = windows.OVERLAPPED;
const PERFORMANCE_INFORMATION = windows.PERFORMANCE_INFORMATION;
const PROCESS_MEMORY_COUNTERS = windows.PROCESS_MEMORY_COUNTERS;
const PSAPI_WS_WATCH_INFORMATION = windows.PSAPI_WS_WATCH_INFORMATION;
const PSAPI_WS_WATCH_INFORMATION_EX = windows.PSAPI_WS_WATCH_INFORMATION_EX;
const SECURITY_ATTRIBUTES = windows.SECURITY_ATTRIBUTES;
const SIZE_T = windows.SIZE_T;
const SRWLOCK = windows.SRWLOCK;
const UINT = windows.UINT;
const VECTORED_EXCEPTION_HANDLER = windows.VECTORED_EXCEPTION_HANDLER;
const WCHAR = windows.WCHAR;
const WORD = windows.WORD;
const Win32Error = windows.Win32Error;
const va_list = windows.va_list;
const HLOCAL = windows.HLOCAL;
const FILETIME = windows.FILETIME;
const STARTUPINFOW = windows.STARTUPINFOW;
const PROCESS_INFORMATION = windows.PROCESS_INFORMATION;
const OVERLAPPED_ENTRY = windows.OVERLAPPED_ENTRY;
const LPHEAP_SUMMARY = windows.LPHEAP_SUMMARY;
const ULONG_PTR = windows.ULONG_PTR;
const FILE_NOTIFY_INFORMATION = windows.FILE_NOTIFY_INFORMATION;
const HANDLER_ROUTINE = windows.HANDLER_ROUTINE;
const ULONG = windows.ULONG;
const PVOID = windows.PVOID;
const LPSTR = windows.LPSTR;
const PENUM_PAGE_FILE_CALLBACKA = windows.PENUM_PAGE_FILE_CALLBACKA;
pub extern "psapi" fn EmptyWorkingSet(hProcess: HANDLE) callconv(WINAPI) BOOL;
pub extern "psapi" fn EnumDeviceDrivers(lpImageBase: [*]LPVOID, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn EnumPageFilesA(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKA, pContext: LPVOID) callconv(WINAPI) BOOL;
pub extern "psapi" fn EnumPageFilesW(pCallBackRoutine: PENUM_PAGE_FILE_CALLBACKW, pContext: LPVOID) callconv(WINAPI) BOOL;
pub extern "psapi" fn EnumProcessModules(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn EnumProcessModulesEx(hProcess: HANDLE, lphModule: [*]HMODULE, cb: DWORD, lpcbNeeded: *DWORD, dwFilterFlag: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn EnumProcesses(lpidProcess: [*]DWORD, cb: DWORD, cbNeeded: *DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn GetDeviceDriverBaseNameA(ImageBase: LPVOID, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetDeviceDriverBaseNameW(ImageBase: LPVOID, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetDeviceDriverFileNameA(ImageBase: LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetDeviceDriverFileNameW(ImageBase: LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetMappedFileNameA(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetMappedFileNameW(hProcess: HANDLE, lpv: ?LPVOID, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetModuleBaseNameA(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetModuleBaseNameW(hProcess: HANDLE, hModule: ?HMODULE, lpBaseName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetModuleFileNameExA(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetModuleFileNameExW(hProcess: HANDLE, hModule: ?HMODULE, lpFilename: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetModuleInformation(hProcess: HANDLE, hModule: HMODULE, lpmodinfo: *MODULEINFO, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn GetPerformanceInfo(pPerformanceInformation: *PERFORMANCE_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn GetProcessImageFileNameA(hProcess: HANDLE, lpImageFileName: LPSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetProcessImageFileNameW(hProcess: HANDLE, lpImageFileName: LPWSTR, nSize: DWORD) callconv(WINAPI) DWORD;
pub extern "psapi" fn GetProcessMemoryInfo(Process: HANDLE, ppsmemCounters: *PROCESS_MEMORY_COUNTERS, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn GetWsChanges(hProcess: HANDLE, lpWatchInfo: *PSAPI_WS_WATCH_INFORMATION, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn GetWsChangesEx(hProcess: HANDLE, lpWatchInfoEx: *PSAPI_WS_WATCH_INFORMATION_EX, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn InitializeProcessForWsWatch(hProcess: HANDLE) callconv(WINAPI) BOOL;
pub extern "psapi" fn QueryWorkingSet(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
pub extern "psapi" fn QueryWorkingSetEx(hProcess: HANDLE, pv: PVOID, cb: DWORD) callconv(WINAPI) BOOL;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/ntstatus.zig | /// NTSTATUS codes from https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-erref/596a1078-e883-4972-9bbc-49e60bebca55?
pub const NTSTATUS = enum(u32) {
/// The caller specified WaitAny for WaitType and one of the dispatcher
/// objects in the Object array has been set to the signaled state.
pub const WAIT_0: NTSTATUS = .SUCCESS;
/// The caller attempted to wait for a mutex that has been abandoned.
pub const ABANDONED_WAIT_0: NTSTATUS = .ABANDONED;
/// The maximum number of boot-time filters has been reached.
pub const FWP_TOO_MANY_BOOTTIME_FILTERS: NTSTATUS = .FWP_TOO_MANY_CALLOUTS;
/// The operation completed successfully.
SUCCESS = 0x00000000,
/// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state.
WAIT_1 = 0x00000001,
/// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state.
WAIT_2 = 0x00000002,
/// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state.
WAIT_3 = 0x00000003,
/// The caller specified WaitAny for WaitType and one of the dispatcher objects in the Object array has been set to the signaled state.
WAIT_63 = 0x0000003F,
/// The caller attempted to wait for a mutex that has been abandoned.
ABANDONED = 0x00000080,
/// The caller attempted to wait for a mutex that has been abandoned.
ABANDONED_WAIT_63 = 0x000000BF,
/// A user-mode APC was delivered before the given Interval expired.
USER_APC = 0x000000C0,
/// The delay completed because the thread was alerted.
ALERTED = 0x00000101,
/// The given Timeout interval expired.
TIMEOUT = 0x00000102,
/// The operation that was requested is pending completion.
PENDING = 0x00000103,
/// A reparse should be performed by the Object Manager because the name of the file resulted in a symbolic link.
REPARSE = 0x00000104,
/// Returned by enumeration APIs to indicate more information is available to successive calls.
MORE_ENTRIES = 0x00000105,
/// Indicates not all privileges or groups that are referenced are assigned to the caller.
/// This allows, for example, all privileges to be disabled without having to know exactly which privileges are assigned.
NOT_ALL_ASSIGNED = 0x00000106,
/// Some of the information to be translated has not been translated.
SOME_NOT_MAPPED = 0x00000107,
/// An open/create operation completed while an opportunistic lock (oplock) break is underway.
OPLOCK_BREAK_IN_PROGRESS = 0x00000108,
/// A new volume has been mounted by a file system.
VOLUME_MOUNTED = 0x00000109,
/// This success level status indicates that the transaction state already exists for the registry subtree but that a transaction commit was previously aborted. The commit has now been completed.
RXACT_COMMITTED = 0x0000010A,
/// Indicates that a notify change request has been completed due to closing the handle that made the notify change request.
NOTIFY_CLEANUP = 0x0000010B,
/// Indicates that a notify change request is being completed and that the information is not being returned in the caller's buffer.
/// The caller now needs to enumerate the files to find the changes.
NOTIFY_ENUM_DIR = 0x0000010C,
/// {No Quotas} No system quota limits are specifically set for this account.
NO_QUOTAS_FOR_ACCOUNT = 0x0000010D,
/// {Connect Failure on Primary Transport} An attempt was made to connect to the remote server %hs on the primary transport, but the connection failed.
/// The computer WAS able to connect on a secondary transport.
PRIMARY_TRANSPORT_CONNECT_FAILED = 0x0000010E,
/// The page fault was a transition fault.
PAGE_FAULT_TRANSITION = 0x00000110,
/// The page fault was a demand zero fault.
PAGE_FAULT_DEMAND_ZERO = 0x00000111,
/// The page fault was a demand zero fault.
PAGE_FAULT_COPY_ON_WRITE = 0x00000112,
/// The page fault was a demand zero fault.
PAGE_FAULT_GUARD_PAGE = 0x00000113,
/// The page fault was satisfied by reading from a secondary storage device.
PAGE_FAULT_PAGING_FILE = 0x00000114,
/// The cached page was locked during operation.
CACHE_PAGE_LOCKED = 0x00000115,
/// The crash dump exists in a paging file.
CRASH_DUMP = 0x00000116,
/// The specified buffer contains all zeros.
BUFFER_ALL_ZEROS = 0x00000117,
/// A reparse should be performed by the Object Manager because the name of the file resulted in a symbolic link.
REPARSE_OBJECT = 0x00000118,
/// The device has succeeded a query-stop and its resource requirements have changed.
RESOURCE_REQUIREMENTS_CHANGED = 0x00000119,
/// The translator has translated these resources into the global space and no additional translations should be performed.
TRANSLATION_COMPLETE = 0x00000120,
/// The directory service evaluated group memberships locally, because it was unable to contact a global catalog server.
DS_MEMBERSHIP_EVALUATED_LOCALLY = 0x00000121,
/// A process being terminated has no threads to terminate.
NOTHING_TO_TERMINATE = 0x00000122,
/// The specified process is not part of a job.
PROCESS_NOT_IN_JOB = 0x00000123,
/// The specified process is part of a job.
PROCESS_IN_JOB = 0x00000124,
/// {Volume Shadow Copy Service} The system is now ready for hibernation.
VOLSNAP_HIBERNATE_READY = 0x00000125,
/// A file system or file system filter driver has successfully completed an FsFilter operation.
FSFILTER_OP_COMPLETED_SUCCESSFULLY = 0x00000126,
/// The specified interrupt vector was already connected.
INTERRUPT_VECTOR_ALREADY_CONNECTED = 0x00000127,
/// The specified interrupt vector is still connected.
INTERRUPT_STILL_CONNECTED = 0x00000128,
/// The current process is a cloned process.
PROCESS_CLONED = 0x00000129,
/// The file was locked and all users of the file can only read.
FILE_LOCKED_WITH_ONLY_READERS = 0x0000012A,
/// The file was locked and at least one user of the file can write.
FILE_LOCKED_WITH_WRITERS = 0x0000012B,
/// The specified ResourceManager made no changes or updates to the resource under this transaction.
RESOURCEMANAGER_READ_ONLY = 0x00000202,
/// An operation is blocked and waiting for an oplock.
WAIT_FOR_OPLOCK = 0x00000367,
/// Debugger handled the exception.
DBG_EXCEPTION_HANDLED = 0x00010001,
/// The debugger continued.
DBG_CONTINUE = 0x00010002,
/// The IO was completed by a filter.
FLT_IO_COMPLETE = 0x001C0001,
/// The file is temporarily unavailable.
FILE_NOT_AVAILABLE = 0xC0000467,
/// The share is temporarily unavailable.
SHARE_UNAVAILABLE = 0xC0000480,
/// A threadpool worker thread entered a callback at thread affinity %p and exited at affinity %p.
/// This is unexpected, indicating that the callback missed restoring the priority.
CALLBACK_RETURNED_THREAD_AFFINITY = 0xC0000721,
/// {Object Exists} An attempt was made to create an object but the object name already exists.
OBJECT_NAME_EXISTS = 0x40000000,
/// {Thread Suspended} A thread termination occurred while the thread was suspended. The thread resumed, and termination proceeded.
THREAD_WAS_SUSPENDED = 0x40000001,
/// {Working Set Range Error} An attempt was made to set the working set minimum or maximum to values that are outside the allowable range.
WORKING_SET_LIMIT_RANGE = 0x40000002,
/// {Image Relocated} An image file could not be mapped at the address that is specified in the image file. Local fixes must be performed on this image.
IMAGE_NOT_AT_BASE = 0x40000003,
/// This informational level status indicates that a specified registry subtree transaction state did not yet exist and had to be created.
RXACT_STATE_CREATED = 0x40000004,
/// {Segment Load} A virtual DOS machine (VDM) is loading, unloading, or moving an MS-DOS or Win16 program segment image.
/// An exception is raised so that a debugger can load, unload, or track symbols and breakpoints within these 16-bit segments.
SEGMENT_NOTIFICATION = 0x40000005,
/// {Local Session Key} A user session key was requested for a local remote procedure call (RPC) connection.
/// The session key that is returned is a constant value and not unique to this connection.
LOCAL_USER_SESSION_KEY = 0x40000006,
/// {Invalid Current Directory} The process cannot switch to the startup current directory %hs.
/// Select OK to set the current directory to %hs, or select CANCEL to exit.
BAD_CURRENT_DIRECTORY = 0x40000007,
/// {Serial IOCTL Complete} A serial I/O operation was completed by another write to a serial port. (The IOCTL_SERIAL_XOFF_COUNTER reached zero.)
SERIAL_MORE_WRITES = 0x40000008,
/// {Registry Recovery} One of the files that contains the system registry data had to be recovered by using a log or alternate copy. The recovery was successful.
REGISTRY_RECOVERED = 0x40000009,
/// {Redundant Read} To satisfy a read request, the Windows NT operating system fault-tolerant file system successfully read the requested data from a redundant copy.
/// This was done because the file system encountered a failure on a member of the fault-tolerant volume but was unable to reassign the failing area of the device.
FT_READ_RECOVERY_FROM_BACKUP = 0x4000000A,
/// {Redundant Write} To satisfy a write request, the Windows NT fault-tolerant file system successfully wrote a redundant copy of the information.
/// This was done because the file system encountered a failure on a member of the fault-tolerant volume but was unable to reassign the failing area of the device.
FT_WRITE_RECOVERY = 0x4000000B,
/// {Serial IOCTL Timeout} A serial I/O operation completed because the time-out period expired.
/// (The IOCTL_SERIAL_XOFF_COUNTER had not reached zero.)
SERIAL_COUNTER_TIMEOUT = 0x4000000C,
/// {Password Too Complex} The Windows password is too complex to be converted to a LAN Manager password.
/// The LAN Manager password that returned is a NULL string.
NULL_LM_PASSWORD = 0x4000000D,
/// {Machine Type Mismatch} The image file %hs is valid but is for a machine type other than the current machine.
/// Select OK to continue, or CANCEL to fail the DLL load.
IMAGE_MACHINE_TYPE_MISMATCH = 0x4000000E,
/// {Partial Data Received} The network transport returned partial data to its client. The remaining data will be sent later.
RECEIVE_PARTIAL = 0x4000000F,
/// {Expedited Data Received} The network transport returned data to its client that was marked as expedited by the remote system.
RECEIVE_EXPEDITED = 0x40000010,
/// {Partial Expedited Data Received} The network transport returned partial data to its client and this data was marked as expedited by the remote system. The remaining data will be sent later.
RECEIVE_PARTIAL_EXPEDITED = 0x40000011,
/// {TDI Event Done} The TDI indication has completed successfully.
EVENT_DONE = 0x40000012,
/// {TDI Event Pending} The TDI indication has entered the pending state.
EVENT_PENDING = 0x40000013,
/// Checking file system on %wZ.
CHECKING_FILE_SYSTEM = 0x40000014,
/// {Fatal Application Exit} %hs
FATAL_APP_EXIT = 0x40000015,
/// The specified registry key is referenced by a predefined handle.
PREDEFINED_HANDLE = 0x40000016,
/// {Page Unlocked} The page protection of a locked page was changed to 'No Access' and the page was unlocked from memory and from the process.
WAS_UNLOCKED = 0x40000017,
/// %hs
SERVICE_NOTIFICATION = 0x40000018,
/// {Page Locked} One of the pages to lock was already locked.
WAS_LOCKED = 0x40000019,
/// Application popup: %1 : %2
LOG_HARD_ERROR = 0x4000001A,
/// A Win32 process already exists.
ALREADY_WIN32 = 0x4000001B,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_UNSIMULATE = 0x4000001C,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_CONTINUE = 0x4000001D,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_SINGLE_STEP = 0x4000001E,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_BREAKPOINT = 0x4000001F,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_EXCEPTION_CONTINUE = 0x40000020,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_EXCEPTION_LASTCHANCE = 0x40000021,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_EXCEPTION_CHAIN = 0x40000022,
/// {Machine Type Mismatch} The image file %hs is valid but is for a machine type other than the current machine.
IMAGE_MACHINE_TYPE_MISMATCH_EXE = 0x40000023,
/// A yield execution was performed and no thread was available to run.
NO_YIELD_PERFORMED = 0x40000024,
/// The resume flag to a timer API was ignored.
TIMER_RESUME_IGNORED = 0x40000025,
/// The arbiter has deferred arbitration of these resources to its parent.
ARBITRATION_UNHANDLED = 0x40000026,
/// The device has detected a CardBus card in its slot.
CARDBUS_NOT_SUPPORTED = 0x40000027,
/// An exception status code that is used by the Win32 x86 emulation subsystem.
WX86_CREATEWX86TIB = 0x40000028,
/// The CPUs in this multiprocessor system are not all the same revision level.
/// To use all processors, the operating system restricts itself to the features of the least capable processor in the system.
/// If problems occur with this system, contact the CPU manufacturer to see if this mix of processors is supported.
MP_PROCESSOR_MISMATCH = 0x40000029,
/// The system was put into hibernation.
HIBERNATED = 0x4000002A,
/// The system was resumed from hibernation.
RESUME_HIBERNATION = 0x4000002B,
/// Windows has detected that the system firmware (BIOS) was updated [previous firmware date = %2, current firmware date %3].
FIRMWARE_UPDATED = 0x4000002C,
/// A device driver is leaking locked I/O pages and is causing system degradation.
/// The system has automatically enabled the tracking code to try and catch the culprit.
DRIVERS_LEAKING_LOCKED_PAGES = 0x4000002D,
/// The ALPC message being canceled has already been retrieved from the queue on the other side.
MESSAGE_RETRIEVED = 0x4000002E,
/// The system power state is transitioning from %2 to %3.
SYSTEM_POWERSTATE_TRANSITION = 0x4000002F,
/// The receive operation was successful.
/// Check the ALPC completion list for the received message.
ALPC_CHECK_COMPLETION_LIST = 0x40000030,
/// The system power state is transitioning from %2 to %3 but could enter %4.
SYSTEM_POWERSTATE_COMPLEX_TRANSITION = 0x40000031,
/// Access to %1 is monitored by policy rule %2.
ACCESS_AUDIT_BY_POLICY = 0x40000032,
/// A valid hibernation file has been invalidated and should be abandoned.
ABANDON_HIBERFILE = 0x40000033,
/// Business rule scripts are disabled for the calling application.
BIZRULES_NOT_ENABLED = 0x40000034,
/// The system has awoken.
WAKE_SYSTEM = 0x40000294,
/// The directory service is shutting down.
DS_SHUTTING_DOWN = 0x40000370,
/// Debugger will reply later.
DBG_REPLY_LATER = 0x40010001,
/// Debugger cannot provide a handle.
DBG_UNABLE_TO_PROVIDE_HANDLE = 0x40010002,
/// Debugger terminated the thread.
DBG_TERMINATE_THREAD = 0x40010003,
/// Debugger terminated the process.
DBG_TERMINATE_PROCESS = 0x40010004,
/// Debugger obtained control of C.
DBG_CONTROL_C = 0x40010005,
/// Debugger printed an exception on control C.
DBG_PRINTEXCEPTION_C = 0x40010006,
/// Debugger received a RIP exception.
DBG_RIPEXCEPTION = 0x40010007,
/// Debugger received a control break.
DBG_CONTROL_BREAK = 0x40010008,
/// Debugger command communication exception.
DBG_COMMAND_EXCEPTION = 0x40010009,
/// A UUID that is valid only on this computer has been allocated.
RPC_NT_UUID_LOCAL_ONLY = 0x40020056,
/// Some data remains to be sent in the request buffer.
RPC_NT_SEND_INCOMPLETE = 0x400200AF,
/// The Client Drive Mapping Service has connected on Terminal Connection.
CTX_CDM_CONNECT = 0x400A0004,
/// The Client Drive Mapping Service has disconnected on Terminal Connection.
CTX_CDM_DISCONNECT = 0x400A0005,
/// A kernel mode component is releasing a reference on an activation context.
SXS_RELEASE_ACTIVATION_CONTEXT = 0x4015000D,
/// The transactional resource manager is already consistent. Recovery is not needed.
RECOVERY_NOT_NEEDED = 0x40190034,
/// The transactional resource manager has already been started.
RM_ALREADY_STARTED = 0x40190035,
/// The log service encountered a log stream with no restart area.
LOG_NO_RESTART = 0x401A000C,
/// {Display Driver Recovered From Failure} The %hs display driver has detected a failure and recovered from it. Some graphical operations might have failed.
/// The next time you restart the machine, a dialog box appears, giving you an opportunity to upload data about this failure to Microsoft.
VIDEO_DRIVER_DEBUG_REPORT_REQUEST = 0x401B00EC,
/// The specified buffer is not big enough to contain the entire requested dataset.
/// Partial data is populated up to the size of the buffer.
/// The caller needs to provide a buffer of the size as specified in the partially populated buffer's content (interface specific).
GRAPHICS_PARTIAL_DATA_POPULATED = 0x401E000A,
/// The kernel driver detected a version mismatch between it and the user mode driver.
GRAPHICS_DRIVER_MISMATCH = 0x401E0117,
/// No mode is pinned on the specified VidPN source/target.
GRAPHICS_MODE_NOT_PINNED = 0x401E0307,
/// The specified mode set does not specify a preference for one of its modes.
GRAPHICS_NO_PREFERRED_MODE = 0x401E031E,
/// The specified dataset (for example, mode set, frequency range set, descriptor set, or topology) is empty.
GRAPHICS_DATASET_IS_EMPTY = 0x401E034B,
/// The specified dataset (for example, mode set, frequency range set, descriptor set, or topology) does not contain any more elements.
GRAPHICS_NO_MORE_ELEMENTS_IN_DATASET = 0x401E034C,
/// The specified content transformation is not pinned on the specified VidPN present path.
GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_PINNED = 0x401E0351,
/// The child device presence was not reliably detected.
GRAPHICS_UNKNOWN_CHILD_STATUS = 0x401E042F,
/// Starting the lead adapter in a linked configuration has been temporarily deferred.
GRAPHICS_LEADLINK_START_DEFERRED = 0x401E0437,
/// The display adapter is being polled for children too frequently at the same polling level.
GRAPHICS_POLLING_TOO_FREQUENTLY = 0x401E0439,
/// Starting the adapter has been temporarily deferred.
GRAPHICS_START_DEFERRED = 0x401E043A,
/// The request will be completed later by an NDIS status indication.
NDIS_INDICATION_REQUIRED = 0x40230001,
/// {EXCEPTION} Guard Page Exception A page of memory that marks the end of a data structure, such as a stack or an array, has been accessed.
GUARD_PAGE_VIOLATION = 0x80000001,
/// {EXCEPTION} Alignment Fault A data type misalignment was detected in a load or store instruction.
DATATYPE_MISALIGNMENT = 0x80000002,
/// {EXCEPTION} Breakpoint A breakpoint has been reached.
BREAKPOINT = 0x80000003,
/// {EXCEPTION} Single Step A single step or trace operation has just been completed.
SINGLE_STEP = 0x80000004,
/// {Buffer Overflow} The data was too large to fit into the specified buffer.
BUFFER_OVERFLOW = 0x80000005,
/// {No More Files} No more files were found which match the file specification.
NO_MORE_FILES = 0x80000006,
/// {Kernel Debugger Awakened} The system debugger was awakened by an interrupt.
WAKE_SYSTEM_DEBUGGER = 0x80000007,
/// {Handles Closed} Handles to objects have been automatically closed because of the requested operation.
HANDLES_CLOSED = 0x8000000A,
/// {Non-Inheritable ACL} An access control list (ACL) contains no components that can be inherited.
NO_INHERITANCE = 0x8000000B,
/// {GUID Substitution} During the translation of a globally unique identifier (GUID) to a Windows security ID (SID), no administratively defined GUID prefix was found.
/// A substitute prefix was used, which will not compromise system security.
/// However, this might provide a more restrictive access than intended.
GUID_SUBSTITUTION_MADE = 0x8000000C,
/// Because of protection conflicts, not all the requested bytes could be copied.
PARTIAL_COPY = 0x8000000D,
/// {Out of Paper} The printer is out of paper.
DEVICE_PAPER_EMPTY = 0x8000000E,
/// {Device Power Is Off} The printer power has been turned off.
DEVICE_POWERED_OFF = 0x8000000F,
/// {Device Offline} The printer has been taken offline.
DEVICE_OFF_LINE = 0x80000010,
/// {Device Busy} The device is currently busy.
DEVICE_BUSY = 0x80000011,
/// {No More EAs} No more extended attributes (EAs) were found for the file.
NO_MORE_EAS = 0x80000012,
/// {Illegal EA} The specified extended attribute (EA) name contains at least one illegal character.
INVALID_EA_NAME = 0x80000013,
/// {Inconsistent EA List} The extended attribute (EA) list is inconsistent.
EA_LIST_INCONSISTENT = 0x80000014,
/// {Invalid EA Flag} An invalid extended attribute (EA) flag was set.
INVALID_EA_FLAG = 0x80000015,
/// {Verifying Disk} The media has changed and a verify operation is in progress; therefore, no reads or writes can be performed to the device, except those that are used in the verify operation.
VERIFY_REQUIRED = 0x80000016,
/// {Too Much Information} The specified access control list (ACL) contained more information than was expected.
EXTRANEOUS_INFORMATION = 0x80000017,
/// This warning level status indicates that the transaction state already exists for the registry subtree, but that a transaction commit was previously aborted.
/// The commit has NOT been completed but has not been rolled back either; therefore, it can still be committed, if needed.
RXACT_COMMIT_NECESSARY = 0x80000018,
/// {No More Entries} No more entries are available from an enumeration operation.
NO_MORE_ENTRIES = 0x8000001A,
/// {Filemark Found} A filemark was detected.
FILEMARK_DETECTED = 0x8000001B,
/// {Media Changed} The media has changed.
MEDIA_CHANGED = 0x8000001C,
/// {I/O Bus Reset} An I/O bus reset was detected.
BUS_RESET = 0x8000001D,
/// {End of Media} The end of the media was encountered.
END_OF_MEDIA = 0x8000001E,
/// The beginning of a tape or partition has been detected.
BEGINNING_OF_MEDIA = 0x8000001F,
/// {Media Changed} The media might have changed.
MEDIA_CHECK = 0x80000020,
/// A tape access reached a set mark.
SETMARK_DETECTED = 0x80000021,
/// During a tape access, the end of the data written is reached.
NO_DATA_DETECTED = 0x80000022,
/// The redirector is in use and cannot be unloaded.
REDIRECTOR_HAS_OPEN_HANDLES = 0x80000023,
/// The server is in use and cannot be unloaded.
SERVER_HAS_OPEN_HANDLES = 0x80000024,
/// The specified connection has already been disconnected.
ALREADY_DISCONNECTED = 0x80000025,
/// A long jump has been executed.
LONGJUMP = 0x80000026,
/// A cleaner cartridge is present in the tape library.
CLEANER_CARTRIDGE_INSTALLED = 0x80000027,
/// The Plug and Play query operation was not successful.
PLUGPLAY_QUERY_VETOED = 0x80000028,
/// A frame consolidation has been executed.
UNWIND_CONSOLIDATE = 0x80000029,
/// {Registry Hive Recovered} The registry hive (file): %hs was corrupted and it has been recovered. Some data might have been lost.
REGISTRY_HIVE_RECOVERED = 0x8000002A,
/// The application is attempting to run executable code from the module %hs. This might be insecure.
/// An alternative, %hs, is available. Should the application use the secure module %hs?
DLL_MIGHT_BE_INSECURE = 0x8000002B,
/// The application is loading executable code from the module %hs.
/// This is secure but might be incompatible with previous releases of the operating system.
/// An alternative, %hs, is available. Should the application use the secure module %hs?
DLL_MIGHT_BE_INCOMPATIBLE = 0x8000002C,
/// The create operation stopped after reaching a symbolic link.
STOPPED_ON_SYMLINK = 0x8000002D,
/// The device has indicated that cleaning is necessary.
DEVICE_REQUIRES_CLEANING = 0x80000288,
/// The device has indicated that its door is open. Further operations require it closed and secured.
DEVICE_DOOR_OPEN = 0x80000289,
/// Windows discovered a corruption in the file %hs. This file has now been repaired.
/// Check if any data in the file was lost because of the corruption.
DATA_LOST_REPAIR = 0x80000803,
/// Debugger did not handle the exception.
DBG_EXCEPTION_NOT_HANDLED = 0x80010001,
/// The cluster node is already up.
CLUSTER_NODE_ALREADY_UP = 0x80130001,
/// The cluster node is already down.
CLUSTER_NODE_ALREADY_DOWN = 0x80130002,
/// The cluster network is already online.
CLUSTER_NETWORK_ALREADY_ONLINE = 0x80130003,
/// The cluster network is already offline.
CLUSTER_NETWORK_ALREADY_OFFLINE = 0x80130004,
/// The cluster node is already a member of the cluster.
CLUSTER_NODE_ALREADY_MEMBER = 0x80130005,
/// The log could not be set to the requested size.
COULD_NOT_RESIZE_LOG = 0x80190009,
/// There is no transaction metadata on the file.
NO_TXF_METADATA = 0x80190029,
/// The file cannot be recovered because there is a handle still open on it.
CANT_RECOVER_WITH_HANDLE_OPEN = 0x80190031,
/// Transaction metadata is already present on this file and cannot be superseded.
TXF_METADATA_ALREADY_PRESENT = 0x80190041,
/// A transaction scope could not be entered because the scope handler has not been initialized.
TRANSACTION_SCOPE_CALLBACKS_NOT_SET = 0x80190042,
/// {Display Driver Stopped Responding and recovered} The %hs display driver has stopped working normally. The recovery had been performed.
VIDEO_HUNG_DISPLAY_DRIVER_THREAD_RECOVERED = 0x801B00EB,
/// {Buffer too small} The buffer is too small to contain the entry. No information has been written to the buffer.
FLT_BUFFER_TOO_SMALL = 0x801C0001,
/// Volume metadata read or write is incomplete.
FVE_PARTIAL_METADATA = 0x80210001,
/// BitLocker encryption keys were ignored because the volume was in a transient state.
FVE_TRANSIENT_STATE = 0x80210002,
/// {Operation Failed} The requested operation was unsuccessful.
UNSUCCESSFUL = 0xC0000001,
/// {Not Implemented} The requested operation is not implemented.
NOT_IMPLEMENTED = 0xC0000002,
/// {Invalid Parameter} The specified information class is not a valid information class for the specified object.
INVALID_INFO_CLASS = 0xC0000003,
/// The specified information record length does not match the length that is required for the specified information class.
INFO_LENGTH_MISMATCH = 0xC0000004,
/// The instruction at 0x%08lx referenced memory at 0x%08lx. The memory could not be %s.
ACCESS_VIOLATION = 0xC0000005,
/// The instruction at 0x%08lx referenced memory at 0x%08lx.
/// The required data was not placed into memory because of an I/O error status of 0x%08lx.
IN_PAGE_ERROR = 0xC0000006,
/// The page file quota for the process has been exhausted.
PAGEFILE_QUOTA = 0xC0000007,
/// An invalid HANDLE was specified.
INVALID_HANDLE = 0xC0000008,
/// An invalid initial stack was specified in a call to NtCreateThread.
BAD_INITIAL_STACK = 0xC0000009,
/// An invalid initial start address was specified in a call to NtCreateThread.
BAD_INITIAL_PC = 0xC000000A,
/// An invalid client ID was specified.
INVALID_CID = 0xC000000B,
/// An attempt was made to cancel or set a timer that has an associated APC and the specified thread is not the thread that originally set the timer with an associated APC routine.
TIMER_NOT_CANCELED = 0xC000000C,
/// An invalid parameter was passed to a service or function.
INVALID_PARAMETER = 0xC000000D,
/// A device that does not exist was specified.
NO_SUCH_DEVICE = 0xC000000E,
/// {File Not Found} The file %hs does not exist.
NO_SUCH_FILE = 0xC000000F,
/// The specified request is not a valid operation for the target device.
INVALID_DEVICE_REQUEST = 0xC0000010,
/// The end-of-file marker has been reached.
/// There is no valid data in the file beyond this marker.
END_OF_FILE = 0xC0000011,
/// {Wrong Volume} The wrong volume is in the drive. Insert volume %hs into drive %hs.
WRONG_VOLUME = 0xC0000012,
/// {No Disk} There is no disk in the drive. Insert a disk into drive %hs.
NO_MEDIA_IN_DEVICE = 0xC0000013,
/// {Unknown Disk Format} The disk in drive %hs is not formatted properly.
/// Check the disk, and reformat it, if needed.
UNRECOGNIZED_MEDIA = 0xC0000014,
/// {Sector Not Found} The specified sector does not exist.
NONEXISTENT_SECTOR = 0xC0000015,
/// {Still Busy} The specified I/O request packet (IRP) cannot be disposed of because the I/O operation is not complete.
MORE_PROCESSING_REQUIRED = 0xC0000016,
/// {Not Enough Quota} Not enough virtual memory or paging file quota is available to complete the specified operation.
NO_MEMORY = 0xC0000017,
/// {Conflicting Address Range} The specified address range conflicts with the address space.
CONFLICTING_ADDRESSES = 0xC0000018,
/// The address range to unmap is not a mapped view.
NOT_MAPPED_VIEW = 0xC0000019,
/// The virtual memory cannot be freed.
UNABLE_TO_FREE_VM = 0xC000001A,
/// The specified section cannot be deleted.
UNABLE_TO_DELETE_SECTION = 0xC000001B,
/// An invalid system service was specified in a system service call.
INVALID_SYSTEM_SERVICE = 0xC000001C,
/// {EXCEPTION} Illegal Instruction An attempt was made to execute an illegal instruction.
ILLEGAL_INSTRUCTION = 0xC000001D,
/// {Invalid Lock Sequence} An attempt was made to execute an invalid lock sequence.
INVALID_LOCK_SEQUENCE = 0xC000001E,
/// {Invalid Mapping} An attempt was made to create a view for a section that is bigger than the section.
INVALID_VIEW_SIZE = 0xC000001F,
/// {Bad File} The attributes of the specified mapping file for a section of memory cannot be read.
INVALID_FILE_FOR_SECTION = 0xC0000020,
/// {Already Committed} The specified address range is already committed.
ALREADY_COMMITTED = 0xC0000021,
/// {Access Denied} A process has requested access to an object but has not been granted those access rights.
ACCESS_DENIED = 0xC0000022,
/// {Buffer Too Small} The buffer is too small to contain the entry. No information has been written to the buffer.
BUFFER_TOO_SMALL = 0xC0000023,
/// {Wrong Type} There is a mismatch between the type of object that is required by the requested operation and the type of object that is specified in the request.
OBJECT_TYPE_MISMATCH = 0xC0000024,
/// {EXCEPTION} Cannot Continue Windows cannot continue from this exception.
NONCONTINUABLE_EXCEPTION = 0xC0000025,
/// An invalid exception disposition was returned by an exception handler.
INVALID_DISPOSITION = 0xC0000026,
/// Unwind exception code.
UNWIND = 0xC0000027,
/// An invalid or unaligned stack was encountered during an unwind operation.
BAD_STACK = 0xC0000028,
/// An invalid unwind target was encountered during an unwind operation.
INVALID_UNWIND_TARGET = 0xC0000029,
/// An attempt was made to unlock a page of memory that was not locked.
NOT_LOCKED = 0xC000002A,
/// A device parity error on an I/O operation.
PARITY_ERROR = 0xC000002B,
/// An attempt was made to decommit uncommitted virtual memory.
UNABLE_TO_DECOMMIT_VM = 0xC000002C,
/// An attempt was made to change the attributes on memory that has not been committed.
NOT_COMMITTED = 0xC000002D,
/// Invalid object attributes specified to NtCreatePort or invalid port attributes specified to NtConnectPort.
INVALID_PORT_ATTRIBUTES = 0xC000002E,
/// The length of the message that was passed to NtRequestPort or NtRequestWaitReplyPort is longer than the maximum message that is allowed by the port.
PORT_MESSAGE_TOO_LONG = 0xC000002F,
/// An invalid combination of parameters was specified.
INVALID_PARAMETER_MIX = 0xC0000030,
/// An attempt was made to lower a quota limit below the current usage.
INVALID_QUOTA_LOWER = 0xC0000031,
/// {Corrupt Disk} The file system structure on the disk is corrupt and unusable. Run the Chkdsk utility on the volume %hs.
DISK_CORRUPT_ERROR = 0xC0000032,
/// The object name is invalid.
OBJECT_NAME_INVALID = 0xC0000033,
/// The object name is not found.
OBJECT_NAME_NOT_FOUND = 0xC0000034,
/// The object name already exists.
OBJECT_NAME_COLLISION = 0xC0000035,
/// An attempt was made to send a message to a disconnected communication port.
PORT_DISCONNECTED = 0xC0000037,
/// An attempt was made to attach to a device that was already attached to another device.
DEVICE_ALREADY_ATTACHED = 0xC0000038,
/// The object path component was not a directory object.
OBJECT_PATH_INVALID = 0xC0000039,
/// {Path Not Found} The path %hs does not exist.
OBJECT_PATH_NOT_FOUND = 0xC000003A,
/// The object path component was not a directory object.
OBJECT_PATH_SYNTAX_BAD = 0xC000003B,
/// {Data Overrun} A data overrun error occurred.
DATA_OVERRUN = 0xC000003C,
/// {Data Late} A data late error occurred.
DATA_LATE_ERROR = 0xC000003D,
/// {Data Error} An error occurred in reading or writing data.
DATA_ERROR = 0xC000003E,
/// {Bad CRC} A cyclic redundancy check (CRC) checksum error occurred.
CRC_ERROR = 0xC000003F,
/// {Section Too Large} The specified section is too big to map the file.
SECTION_TOO_BIG = 0xC0000040,
/// The NtConnectPort request is refused.
PORT_CONNECTION_REFUSED = 0xC0000041,
/// The type of port handle is invalid for the operation that is requested.
INVALID_PORT_HANDLE = 0xC0000042,
/// A file cannot be opened because the share access flags are incompatible.
SHARING_VIOLATION = 0xC0000043,
/// Insufficient quota exists to complete the operation.
QUOTA_EXCEEDED = 0xC0000044,
/// The specified page protection was not valid.
INVALID_PAGE_PROTECTION = 0xC0000045,
/// An attempt to release a mutant object was made by a thread that was not the owner of the mutant object.
MUTANT_NOT_OWNED = 0xC0000046,
/// An attempt was made to release a semaphore such that its maximum count would have been exceeded.
SEMAPHORE_LIMIT_EXCEEDED = 0xC0000047,
/// An attempt was made to set the DebugPort or ExceptionPort of a process, but a port already exists in the process, or an attempt was made to set the CompletionPort of a file but a port was already set in the file, or an attempt was made to set the associated completion port of an ALPC port but it is already set.
PORT_ALREADY_SET = 0xC0000048,
/// An attempt was made to query image information on a section that does not map an image.
SECTION_NOT_IMAGE = 0xC0000049,
/// An attempt was made to suspend a thread whose suspend count was at its maximum.
SUSPEND_COUNT_EXCEEDED = 0xC000004A,
/// An attempt was made to suspend a thread that has begun termination.
THREAD_IS_TERMINATING = 0xC000004B,
/// An attempt was made to set the working set limit to an invalid value (for example, the minimum greater than maximum).
BAD_WORKING_SET_LIMIT = 0xC000004C,
/// A section was created to map a file that is not compatible with an already existing section that maps the same file.
INCOMPATIBLE_FILE_MAP = 0xC000004D,
/// A view to a section specifies a protection that is incompatible with the protection of the initial view.
SECTION_PROTECTION = 0xC000004E,
/// An operation involving EAs failed because the file system does not support EAs.
EAS_NOT_SUPPORTED = 0xC000004F,
/// An EA operation failed because the EA set is too large.
EA_TOO_LARGE = 0xC0000050,
/// An EA operation failed because the name or EA index is invalid.
NONEXISTENT_EA_ENTRY = 0xC0000051,
/// The file for which EAs were requested has no EAs.
NO_EAS_ON_FILE = 0xC0000052,
/// The EA is corrupt and cannot be read.
EA_CORRUPT_ERROR = 0xC0000053,
/// A requested read/write cannot be granted due to a conflicting file lock.
FILE_LOCK_CONFLICT = 0xC0000054,
/// A requested file lock cannot be granted due to other existing locks.
LOCK_NOT_GRANTED = 0xC0000055,
/// A non-close operation has been requested of a file object that has a delete pending.
DELETE_PENDING = 0xC0000056,
/// An attempt was made to set the control attribute on a file.
/// This attribute is not supported in the destination file system.
CTL_FILE_NOT_SUPPORTED = 0xC0000057,
/// Indicates a revision number that was encountered or specified is not one that is known by the service.
/// It might be a more recent revision than the service is aware of.
UNKNOWN_REVISION = 0xC0000058,
/// Indicates that two revision levels are incompatible.
REVISION_MISMATCH = 0xC0000059,
/// Indicates a particular security ID cannot be assigned as the owner of an object.
INVALID_OWNER = 0xC000005A,
/// Indicates a particular security ID cannot be assigned as the primary group of an object.
INVALID_PRIMARY_GROUP = 0xC000005B,
/// An attempt has been made to operate on an impersonation token by a thread that is not currently impersonating a client.
NO_IMPERSONATION_TOKEN = 0xC000005C,
/// A mandatory group cannot be disabled.
CANT_DISABLE_MANDATORY = 0xC000005D,
/// No logon servers are currently available to service the logon request.
NO_LOGON_SERVERS = 0xC000005E,
/// A specified logon session does not exist. It might already have been terminated.
NO_SUCH_LOGON_SESSION = 0xC000005F,
/// A specified privilege does not exist.
NO_SUCH_PRIVILEGE = 0xC0000060,
/// A required privilege is not held by the client.
PRIVILEGE_NOT_HELD = 0xC0000061,
/// The name provided is not a properly formed account name.
INVALID_ACCOUNT_NAME = 0xC0000062,
/// The specified account already exists.
USER_EXISTS = 0xC0000063,
/// The specified account does not exist.
NO_SUCH_USER = 0xC0000064,
/// The specified group already exists.
GROUP_EXISTS = 0xC0000065,
/// The specified group does not exist.
NO_SUCH_GROUP = 0xC0000066,
/// The specified user account is already in the specified group account.
/// Also used to indicate a group cannot be deleted because it contains a member.
MEMBER_IN_GROUP = 0xC0000067,
/// The specified user account is not a member of the specified group account.
MEMBER_NOT_IN_GROUP = 0xC0000068,
/// Indicates the requested operation would disable or delete the last remaining administration account.
/// This is not allowed to prevent creating a situation in which the system cannot be administrated.
LAST_ADMIN = 0xC0000069,
/// When trying to update a password, this return status indicates that the value provided as the current password is not correct.
WRONG_PASSWORD = 0xC000006A,
/// When trying to update a password, this return status indicates that the value provided for the new password contains values that are not allowed in passwords.
ILL_FORMED_PASSWORD = 0xC000006B,
/// When trying to update a password, this status indicates that some password update rule has been violated.
/// For example, the password might not meet length criteria.
PASSWORD_RESTRICTION = 0xC000006C,
/// The attempted logon is invalid.
/// This is either due to a bad username or authentication information.
LOGON_FAILURE = 0xC000006D,
/// Indicates a referenced user name and authentication information are valid, but some user account restriction has prevented successful authentication (such as time-of-day restrictions).
ACCOUNT_RESTRICTION = 0xC000006E,
/// The user account has time restrictions and cannot be logged onto at this time.
INVALID_LOGON_HOURS = 0xC000006F,
/// The user account is restricted so that it cannot be used to log on from the source workstation.
INVALID_WORKSTATION = 0xC0000070,
/// The user account password has expired.
PASSWORD_EXPIRED = 0xC0000071,
/// The referenced account is currently disabled and cannot be logged on to.
ACCOUNT_DISABLED = 0xC0000072,
/// None of the information to be translated has been translated.
NONE_MAPPED = 0xC0000073,
/// The number of LUIDs requested cannot be allocated with a single allocation.
TOO_MANY_LUIDS_REQUESTED = 0xC0000074,
/// Indicates there are no more LUIDs to allocate.
LUIDS_EXHAUSTED = 0xC0000075,
/// Indicates the sub-authority value is invalid for the particular use.
INVALID_SUB_AUTHORITY = 0xC0000076,
/// Indicates the ACL structure is not valid.
INVALID_ACL = 0xC0000077,
/// Indicates the SID structure is not valid.
INVALID_SID = 0xC0000078,
/// Indicates the SECURITY_DESCRIPTOR structure is not valid.
INVALID_SECURITY_DESCR = 0xC0000079,
/// Indicates the specified procedure address cannot be found in the DLL.
PROCEDURE_NOT_FOUND = 0xC000007A,
/// {Bad Image} %hs is either not designed to run on Windows or it contains an error.
/// Try installing the program again using the original installation media or contact your system administrator or the software vendor for support.
INVALID_IMAGE_FORMAT = 0xC000007B,
/// An attempt was made to reference a token that does not exist.
/// This is typically done by referencing the token that is associated with a thread when the thread is not impersonating a client.
NO_TOKEN = 0xC000007C,
/// Indicates that an attempt to build either an inherited ACL or ACE was not successful. This can be caused by a number of things.
/// One of the more probable causes is the replacement of a CreatorId with a SID that did not fit into the ACE or ACL.
BAD_INHERITANCE_ACL = 0xC000007D,
/// The range specified in NtUnlockFile was not locked.
RANGE_NOT_LOCKED = 0xC000007E,
/// An operation failed because the disk was full.
DISK_FULL = 0xC000007F,
/// The GUID allocation server is disabled at the moment.
SERVER_DISABLED = 0xC0000080,
/// The GUID allocation server is enabled at the moment.
SERVER_NOT_DISABLED = 0xC0000081,
/// Too many GUIDs were requested from the allocation server at once.
TOO_MANY_GUIDS_REQUESTED = 0xC0000082,
/// The GUIDs could not be allocated because the Authority Agent was exhausted.
GUIDS_EXHAUSTED = 0xC0000083,
/// The value provided was an invalid value for an identifier authority.
INVALID_ID_AUTHORITY = 0xC0000084,
/// No more authority agent values are available for the particular identifier authority value.
AGENTS_EXHAUSTED = 0xC0000085,
/// An invalid volume label has been specified.
INVALID_VOLUME_LABEL = 0xC0000086,
/// A mapped section could not be extended.
SECTION_NOT_EXTENDED = 0xC0000087,
/// Specified section to flush does not map a data file.
NOT_MAPPED_DATA = 0xC0000088,
/// Indicates the specified image file did not contain a resource section.
RESOURCE_DATA_NOT_FOUND = 0xC0000089,
/// Indicates the specified resource type cannot be found in the image file.
RESOURCE_TYPE_NOT_FOUND = 0xC000008A,
/// Indicates the specified resource name cannot be found in the image file.
RESOURCE_NAME_NOT_FOUND = 0xC000008B,
/// {EXCEPTION} Array bounds exceeded.
ARRAY_BOUNDS_EXCEEDED = 0xC000008C,
/// {EXCEPTION} Floating-point denormal operand.
FLOAT_DENORMAL_OPERAND = 0xC000008D,
/// {EXCEPTION} Floating-point division by zero.
FLOAT_DIVIDE_BY_ZERO = 0xC000008E,
/// {EXCEPTION} Floating-point inexact result.
FLOAT_INEXACT_RESULT = 0xC000008F,
/// {EXCEPTION} Floating-point invalid operation.
FLOAT_INVALID_OPERATION = 0xC0000090,
/// {EXCEPTION} Floating-point overflow.
FLOAT_OVERFLOW = 0xC0000091,
/// {EXCEPTION} Floating-point stack check.
FLOAT_STACK_CHECK = 0xC0000092,
/// {EXCEPTION} Floating-point underflow.
FLOAT_UNDERFLOW = 0xC0000093,
/// {EXCEPTION} Integer division by zero.
INTEGER_DIVIDE_BY_ZERO = 0xC0000094,
/// {EXCEPTION} Integer overflow.
INTEGER_OVERFLOW = 0xC0000095,
/// {EXCEPTION} Privileged instruction.
PRIVILEGED_INSTRUCTION = 0xC0000096,
/// An attempt was made to install more paging files than the system supports.
TOO_MANY_PAGING_FILES = 0xC0000097,
/// The volume for a file has been externally altered such that the opened file is no longer valid.
FILE_INVALID = 0xC0000098,
/// When a block of memory is allotted for future updates, such as the memory allocated to hold discretionary access control and primary group information, successive updates might exceed the amount of memory originally allotted.
/// Because a quota might already have been charged to several processes that have handles to the object, it is not reasonable to alter the size of the allocated memory.
/// Instead, a request that requires more memory than has been allotted must fail and the STATUS_ALLOTTED_SPACE_EXCEEDED error returned.
ALLOTTED_SPACE_EXCEEDED = 0xC0000099,
/// Insufficient system resources exist to complete the API.
INSUFFICIENT_RESOURCES = 0xC000009A,
/// An attempt has been made to open a DFS exit path control file.
DFS_EXIT_PATH_FOUND = 0xC000009B,
/// There are bad blocks (sectors) on the hard disk.
DEVICE_DATA_ERROR = 0xC000009C,
/// There is bad cabling, non-termination, or the controller is not able to obtain access to the hard disk.
DEVICE_NOT_CONNECTED = 0xC000009D,
/// Virtual memory cannot be freed because the base address is not the base of the region and a region size of zero was specified.
FREE_VM_NOT_AT_BASE = 0xC000009F,
/// An attempt was made to free virtual memory that is not allocated.
MEMORY_NOT_ALLOCATED = 0xC00000A0,
/// The working set is not big enough to allow the requested pages to be locked.
WORKING_SET_QUOTA = 0xC00000A1,
/// {Write Protect Error} The disk cannot be written to because it is write-protected.
/// Remove the write protection from the volume %hs in drive %hs.
MEDIA_WRITE_PROTECTED = 0xC00000A2,
/// {Drive Not Ready} The drive is not ready for use; its door might be open.
/// Check drive %hs and make sure that a disk is inserted and that the drive door is closed.
DEVICE_NOT_READY = 0xC00000A3,
/// The specified attributes are invalid or are incompatible with the attributes for the group as a whole.
INVALID_GROUP_ATTRIBUTES = 0xC00000A4,
/// A specified impersonation level is invalid.
/// Also used to indicate that a required impersonation level was not provided.
BAD_IMPERSONATION_LEVEL = 0xC00000A5,
/// An attempt was made to open an anonymous-level token. Anonymous tokens cannot be opened.
CANT_OPEN_ANONYMOUS = 0xC00000A6,
/// The validation information class requested was invalid.
BAD_VALIDATION_CLASS = 0xC00000A7,
/// The type of a token object is inappropriate for its attempted use.
BAD_TOKEN_TYPE = 0xC00000A8,
/// The type of a token object is inappropriate for its attempted use.
BAD_MASTER_BOOT_RECORD = 0xC00000A9,
/// An attempt was made to execute an instruction at an unaligned address and the host system does not support unaligned instruction references.
INSTRUCTION_MISALIGNMENT = 0xC00000AA,
/// The maximum named pipe instance count has been reached.
INSTANCE_NOT_AVAILABLE = 0xC00000AB,
/// An instance of a named pipe cannot be found in the listening state.
PIPE_NOT_AVAILABLE = 0xC00000AC,
/// The named pipe is not in the connected or closing state.
INVALID_PIPE_STATE = 0xC00000AD,
/// The specified pipe is set to complete operations and there are current I/O operations queued so that it cannot be changed to queue operations.
PIPE_BUSY = 0xC00000AE,
/// The specified handle is not open to the server end of the named pipe.
ILLEGAL_FUNCTION = 0xC00000AF,
/// The specified named pipe is in the disconnected state.
PIPE_DISCONNECTED = 0xC00000B0,
/// The specified named pipe is in the closing state.
PIPE_CLOSING = 0xC00000B1,
/// The specified named pipe is in the connected state.
PIPE_CONNECTED = 0xC00000B2,
/// The specified named pipe is in the listening state.
PIPE_LISTENING = 0xC00000B3,
/// The specified named pipe is not in message mode.
INVALID_READ_MODE = 0xC00000B4,
/// {Device Timeout} The specified I/O operation on %hs was not completed before the time-out period expired.
IO_TIMEOUT = 0xC00000B5,
/// The specified file has been closed by another process.
FILE_FORCED_CLOSED = 0xC00000B6,
/// Profiling is not started.
PROFILING_NOT_STARTED = 0xC00000B7,
/// Profiling is not stopped.
PROFILING_NOT_STOPPED = 0xC00000B8,
/// The passed ACL did not contain the minimum required information.
COULD_NOT_INTERPRET = 0xC00000B9,
/// The file that was specified as a target is a directory, and the caller specified that it could be anything but a directory.
FILE_IS_A_DIRECTORY = 0xC00000BA,
/// The request is not supported.
NOT_SUPPORTED = 0xC00000BB,
/// This remote computer is not listening.
REMOTE_NOT_LISTENING = 0xC00000BC,
/// A duplicate name exists on the network.
DUPLICATE_NAME = 0xC00000BD,
/// The network path cannot be located.
BAD_NETWORK_PATH = 0xC00000BE,
/// The network is busy.
NETWORK_BUSY = 0xC00000BF,
/// This device does not exist.
DEVICE_DOES_NOT_EXIST = 0xC00000C0,
/// The network BIOS command limit has been reached.
TOO_MANY_COMMANDS = 0xC00000C1,
/// An I/O adapter hardware error has occurred.
ADAPTER_HARDWARE_ERROR = 0xC00000C2,
/// The network responded incorrectly.
INVALID_NETWORK_RESPONSE = 0xC00000C3,
/// An unexpected network error occurred.
UNEXPECTED_NETWORK_ERROR = 0xC00000C4,
/// The remote adapter is not compatible.
BAD_REMOTE_ADAPTER = 0xC00000C5,
/// The print queue is full.
PRINT_QUEUE_FULL = 0xC00000C6,
/// Space to store the file that is waiting to be printed is not available on the server.
NO_SPOOL_SPACE = 0xC00000C7,
/// The requested print file has been canceled.
PRINT_CANCELLED = 0xC00000C8,
/// The network name was deleted.
NETWORK_NAME_DELETED = 0xC00000C9,
/// Network access is denied.
NETWORK_ACCESS_DENIED = 0xC00000CA,
/// {Incorrect Network Resource Type} The specified device type (LPT, for example) conflicts with the actual device type on the remote resource.
BAD_DEVICE_TYPE = 0xC00000CB,
/// {Network Name Not Found} The specified share name cannot be found on the remote server.
BAD_NETWORK_NAME = 0xC00000CC,
/// The name limit for the network adapter card of the local computer was exceeded.
TOO_MANY_NAMES = 0xC00000CD,
/// The network BIOS session limit was exceeded.
TOO_MANY_SESSIONS = 0xC00000CE,
/// File sharing has been temporarily paused.
SHARING_PAUSED = 0xC00000CF,
/// No more connections can be made to this remote computer at this time because the computer has already accepted the maximum number of connections.
REQUEST_NOT_ACCEPTED = 0xC00000D0,
/// Print or disk redirection is temporarily paused.
REDIRECTOR_PAUSED = 0xC00000D1,
/// A network data fault occurred.
NET_WRITE_FAULT = 0xC00000D2,
/// The number of active profiling objects is at the maximum and no more can be started.
PROFILING_AT_LIMIT = 0xC00000D3,
/// {Incorrect Volume} The destination file of a rename request is located on a different device than the source of the rename request.
NOT_SAME_DEVICE = 0xC00000D4,
/// The specified file has been renamed and thus cannot be modified.
FILE_RENAMED = 0xC00000D5,
/// {Network Request Timeout} The session with a remote server has been disconnected because the time-out interval for a request has expired.
VIRTUAL_CIRCUIT_CLOSED = 0xC00000D6,
/// Indicates an attempt was made to operate on the security of an object that does not have security associated with it.
NO_SECURITY_ON_OBJECT = 0xC00000D7,
/// Used to indicate that an operation cannot continue without blocking for I/O.
CANT_WAIT = 0xC00000D8,
/// Used to indicate that a read operation was done on an empty pipe.
PIPE_EMPTY = 0xC00000D9,
/// Configuration information could not be read from the domain controller, either because the machine is unavailable or access has been denied.
CANT_ACCESS_DOMAIN_INFO = 0xC00000DA,
/// Indicates that a thread attempted to terminate itself by default (called NtTerminateThread with NULL) and it was the last thread in the current process.
CANT_TERMINATE_SELF = 0xC00000DB,
/// Indicates the Sam Server was in the wrong state to perform the desired operation.
INVALID_SERVER_STATE = 0xC00000DC,
/// Indicates the domain was in the wrong state to perform the desired operation.
INVALID_DOMAIN_STATE = 0xC00000DD,
/// This operation is only allowed for the primary domain controller of the domain.
INVALID_DOMAIN_ROLE = 0xC00000DE,
/// The specified domain did not exist.
NO_SUCH_DOMAIN = 0xC00000DF,
/// The specified domain already exists.
DOMAIN_EXISTS = 0xC00000E0,
/// An attempt was made to exceed the limit on the number of domains per server for this release.
DOMAIN_LIMIT_EXCEEDED = 0xC00000E1,
/// An error status returned when the opportunistic lock (oplock) request is denied.
OPLOCK_NOT_GRANTED = 0xC00000E2,
/// An error status returned when an invalid opportunistic lock (oplock) acknowledgment is received by a file system.
INVALID_OPLOCK_PROTOCOL = 0xC00000E3,
/// This error indicates that the requested operation cannot be completed due to a catastrophic media failure or an on-disk data structure corruption.
INTERNAL_DB_CORRUPTION = 0xC00000E4,
/// An internal error occurred.
INTERNAL_ERROR = 0xC00000E5,
/// Indicates generic access types were contained in an access mask which should already be mapped to non-generic access types.
GENERIC_NOT_MAPPED = 0xC00000E6,
/// Indicates a security descriptor is not in the necessary format (absolute or self-relative).
BAD_DESCRIPTOR_FORMAT = 0xC00000E7,
/// An access to a user buffer failed at an expected point in time.
/// This code is defined because the caller does not want to accept STATUS_ACCESS_VIOLATION in its filter.
INVALID_USER_BUFFER = 0xC00000E8,
/// If an I/O error that is not defined in the standard FsRtl filter is returned, it is converted to the following error, which is guaranteed to be in the filter.
/// In this case, information is lost; however, the filter correctly handles the exception.
UNEXPECTED_IO_ERROR = 0xC00000E9,
/// If an MM error that is not defined in the standard FsRtl filter is returned, it is converted to one of the following errors, which are guaranteed to be in the filter.
/// In this case, information is lost; however, the filter correctly handles the exception.
UNEXPECTED_MM_CREATE_ERR = 0xC00000EA,
/// If an MM error that is not defined in the standard FsRtl filter is returned, it is converted to one of the following errors, which are guaranteed to be in the filter.
/// In this case, information is lost; however, the filter correctly handles the exception.
UNEXPECTED_MM_MAP_ERROR = 0xC00000EB,
/// If an MM error that is not defined in the standard FsRtl filter is returned, it is converted to one of the following errors, which are guaranteed to be in the filter.
/// In this case, information is lost; however, the filter correctly handles the exception.
UNEXPECTED_MM_EXTEND_ERR = 0xC00000EC,
/// The requested action is restricted for use by logon processes only.
/// The calling process has not registered as a logon process.
NOT_LOGON_PROCESS = 0xC00000ED,
/// An attempt has been made to start a new session manager or LSA logon session by using an ID that is already in use.
LOGON_SESSION_EXISTS = 0xC00000EE,
/// An invalid parameter was passed to a service or function as the first argument.
INVALID_PARAMETER_1 = 0xC00000EF,
/// An invalid parameter was passed to a service or function as the second argument.
INVALID_PARAMETER_2 = 0xC00000F0,
/// An invalid parameter was passed to a service or function as the third argument.
INVALID_PARAMETER_3 = 0xC00000F1,
/// An invalid parameter was passed to a service or function as the fourth argument.
INVALID_PARAMETER_4 = 0xC00000F2,
/// An invalid parameter was passed to a service or function as the fifth argument.
INVALID_PARAMETER_5 = 0xC00000F3,
/// An invalid parameter was passed to a service or function as the sixth argument.
INVALID_PARAMETER_6 = 0xC00000F4,
/// An invalid parameter was passed to a service or function as the seventh argument.
INVALID_PARAMETER_7 = 0xC00000F5,
/// An invalid parameter was passed to a service or function as the eighth argument.
INVALID_PARAMETER_8 = 0xC00000F6,
/// An invalid parameter was passed to a service or function as the ninth argument.
INVALID_PARAMETER_9 = 0xC00000F7,
/// An invalid parameter was passed to a service or function as the tenth argument.
INVALID_PARAMETER_10 = 0xC00000F8,
/// An invalid parameter was passed to a service or function as the eleventh argument.
INVALID_PARAMETER_11 = 0xC00000F9,
/// An invalid parameter was passed to a service or function as the twelfth argument.
INVALID_PARAMETER_12 = 0xC00000FA,
/// An attempt was made to access a network file, but the network software was not yet started.
REDIRECTOR_NOT_STARTED = 0xC00000FB,
/// An attempt was made to start the redirector, but the redirector has already been started.
REDIRECTOR_STARTED = 0xC00000FC,
/// A new guard page for the stack cannot be created.
STACK_OVERFLOW = 0xC00000FD,
/// A specified authentication package is unknown.
NO_SUCH_PACKAGE = 0xC00000FE,
/// A malformed function table was encountered during an unwind operation.
BAD_FUNCTION_TABLE = 0xC00000FF,
/// Indicates the specified environment variable name was not found in the specified environment block.
VARIABLE_NOT_FOUND = 0xC0000100,
/// Indicates that the directory trying to be deleted is not empty.
DIRECTORY_NOT_EMPTY = 0xC0000101,
/// {Corrupt File} The file or directory %hs is corrupt and unreadable. Run the Chkdsk utility.
FILE_CORRUPT_ERROR = 0xC0000102,
/// A requested opened file is not a directory.
NOT_A_DIRECTORY = 0xC0000103,
/// The logon session is not in a state that is consistent with the requested operation.
BAD_LOGON_SESSION_STATE = 0xC0000104,
/// An internal LSA error has occurred.
/// An authentication package has requested the creation of a logon session but the ID of an already existing logon session has been specified.
LOGON_SESSION_COLLISION = 0xC0000105,
/// A specified name string is too long for its intended use.
NAME_TOO_LONG = 0xC0000106,
/// The user attempted to force close the files on a redirected drive, but there were opened files on the drive, and the user did not specify a sufficient level of force.
FILES_OPEN = 0xC0000107,
/// The user attempted to force close the files on a redirected drive, but there were opened directories on the drive, and the user did not specify a sufficient level of force.
CONNECTION_IN_USE = 0xC0000108,
/// RtlFindMessage could not locate the requested message ID in the message table resource.
MESSAGE_NOT_FOUND = 0xC0000109,
/// An attempt was made to duplicate an object handle into or out of an exiting process.
PROCESS_IS_TERMINATING = 0xC000010A,
/// Indicates an invalid value has been provided for the LogonType requested.
INVALID_LOGON_TYPE = 0xC000010B,
/// Indicates that an attempt was made to assign protection to a file system file or directory and one of the SIDs in the security descriptor could not be translated into a GUID that could be stored by the file system.
/// This causes the protection attempt to fail, which might cause a file creation attempt to fail.
NO_GUID_TRANSLATION = 0xC000010C,
/// Indicates that an attempt has been made to impersonate via a named pipe that has not yet been read from.
CANNOT_IMPERSONATE = 0xC000010D,
/// Indicates that the specified image is already loaded.
IMAGE_ALREADY_LOADED = 0xC000010E,
/// Indicates that an attempt was made to change the size of the LDT for a process that has no LDT.
NO_LDT = 0xC0000117,
/// Indicates that an attempt was made to grow an LDT by setting its size, or that the size was not an even number of selectors.
INVALID_LDT_SIZE = 0xC0000118,
/// Indicates that the starting value for the LDT information was not an integral multiple of the selector size.
INVALID_LDT_OFFSET = 0xC0000119,
/// Indicates that the user supplied an invalid descriptor when trying to set up LDT descriptors.
INVALID_LDT_DESCRIPTOR = 0xC000011A,
/// The specified image file did not have the correct format. It appears to be NE format.
INVALID_IMAGE_NE_FORMAT = 0xC000011B,
/// Indicates that the transaction state of a registry subtree is incompatible with the requested operation.
/// For example, a request has been made to start a new transaction with one already in progress, or a request has been made to apply a transaction when one is not currently in progress.
RXACT_INVALID_STATE = 0xC000011C,
/// Indicates an error has occurred during a registry transaction commit.
/// The database has been left in an unknown, but probably inconsistent, state.
/// The state of the registry transaction is left as COMMITTING.
RXACT_COMMIT_FAILURE = 0xC000011D,
/// An attempt was made to map a file of size zero with the maximum size specified as zero.
MAPPED_FILE_SIZE_ZERO = 0xC000011E,
/// Too many files are opened on a remote server.
/// This error should only be returned by the Windows redirector on a remote drive.
TOO_MANY_OPENED_FILES = 0xC000011F,
/// The I/O request was canceled.
CANCELLED = 0xC0000120,
/// An attempt has been made to remove a file or directory that cannot be deleted.
CANNOT_DELETE = 0xC0000121,
/// Indicates a name that was specified as a remote computer name is syntactically invalid.
INVALID_COMPUTER_NAME = 0xC0000122,
/// An I/O request other than close was performed on a file after it was deleted, which can only happen to a request that did not complete before the last handle was closed via NtClose.
FILE_DELETED = 0xC0000123,
/// Indicates an operation that is incompatible with built-in accounts has been attempted on a built-in (special) SAM account. For example, built-in accounts cannot be deleted.
SPECIAL_ACCOUNT = 0xC0000124,
/// The operation requested cannot be performed on the specified group because it is a built-in special group.
SPECIAL_GROUP = 0xC0000125,
/// The operation requested cannot be performed on the specified user because it is a built-in special user.
SPECIAL_USER = 0xC0000126,
/// Indicates a member cannot be removed from a group because the group is currently the member's primary group.
MEMBERS_PRIMARY_GROUP = 0xC0000127,
/// An I/O request other than close and several other special case operations was attempted using a file object that had already been closed.
FILE_CLOSED = 0xC0000128,
/// Indicates a process has too many threads to perform the requested action.
/// For example, assignment of a primary token can be performed only when a process has zero or one threads.
TOO_MANY_THREADS = 0xC0000129,
/// An attempt was made to operate on a thread within a specific process, but the specified thread is not in the specified process.
THREAD_NOT_IN_PROCESS = 0xC000012A,
/// An attempt was made to establish a token for use as a primary token but the token is already in use.
/// A token can only be the primary token of one process at a time.
TOKEN_ALREADY_IN_USE = 0xC000012B,
/// The page file quota was exceeded.
PAGEFILE_QUOTA_EXCEEDED = 0xC000012C,
/// {Out of Virtual Memory} Your system is low on virtual memory.
/// To ensure that Windows runs correctly, increase the size of your virtual memory paging file. For more information, see Help.
COMMITMENT_LIMIT = 0xC000012D,
/// The specified image file did not have the correct format: it appears to be LE format.
INVALID_IMAGE_LE_FORMAT = 0xC000012E,
/// The specified image file did not have the correct format: it did not have an initial MZ.
INVALID_IMAGE_NOT_MZ = 0xC000012F,
/// The specified image file did not have the correct format: it did not have a proper e_lfarlc in the MZ header.
INVALID_IMAGE_PROTECT = 0xC0000130,
/// The specified image file did not have the correct format: it appears to be a 16-bit Windows image.
INVALID_IMAGE_WIN_16 = 0xC0000131,
/// The Netlogon service cannot start because another Netlogon service running in the domain conflicts with the specified role.
LOGON_SERVER_CONFLICT = 0xC0000132,
/// The time at the primary domain controller is different from the time at the backup domain controller or member server by too large an amount.
TIME_DIFFERENCE_AT_DC = 0xC0000133,
/// On applicable Windows Server releases, the SAM database is significantly out of synchronization with the copy on the domain controller. A complete synchronization is required.
SYNCHRONIZATION_REQUIRED = 0xC0000134,
/// {Unable To Locate Component} This application has failed to start because %hs was not found.
/// Reinstalling the application might fix this problem.
DLL_NOT_FOUND = 0xC0000135,
/// The NtCreateFile API failed. This error should never be returned to an application; it is a place holder for the Windows LAN Manager Redirector to use in its internal error-mapping routines.
OPEN_FAILED = 0xC0000136,
/// {Privilege Failed} The I/O permissions for the process could not be changed.
IO_PRIVILEGE_FAILED = 0xC0000137,
/// {Ordinal Not Found} The ordinal %ld could not be located in the dynamic link library %hs.
ORDINAL_NOT_FOUND = 0xC0000138,
/// {Entry Point Not Found} The procedure entry point %hs could not be located in the dynamic link library %hs.
ENTRYPOINT_NOT_FOUND = 0xC0000139,
/// {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C.
CONTROL_C_EXIT = 0xC000013A,
/// {Virtual Circuit Closed} The network transport on your computer has closed a network connection.
/// There might or might not be I/O requests outstanding.
LOCAL_DISCONNECT = 0xC000013B,
/// {Virtual Circuit Closed} The network transport on a remote computer has closed a network connection.
/// There might or might not be I/O requests outstanding.
REMOTE_DISCONNECT = 0xC000013C,
/// {Insufficient Resources on Remote Computer} The remote computer has insufficient resources to complete the network request.
/// For example, the remote computer might not have enough available memory to carry out the request at this time.
REMOTE_RESOURCES = 0xC000013D,
/// {Virtual Circuit Closed} An existing connection (virtual circuit) has been broken at the remote computer.
/// There is probably something wrong with the network software protocol or the network hardware on the remote computer.
LINK_FAILED = 0xC000013E,
/// {Virtual Circuit Closed} The network transport on your computer has closed a network connection because it had to wait too long for a response from the remote computer.
LINK_TIMEOUT = 0xC000013F,
/// The connection handle that was given to the transport was invalid.
INVALID_CONNECTION = 0xC0000140,
/// The address handle that was given to the transport was invalid.
INVALID_ADDRESS = 0xC0000141,
/// {DLL Initialization Failed} Initialization of the dynamic link library %hs failed. The process is terminating abnormally.
DLL_INIT_FAILED = 0xC0000142,
/// {Missing System File} The required system file %hs is bad or missing.
MISSING_SYSTEMFILE = 0xC0000143,
/// {Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx.
UNHANDLED_EXCEPTION = 0xC0000144,
/// {Application Error} The application failed to initialize properly (0x%lx). Click OK to terminate the application.
APP_INIT_FAILURE = 0xC0000145,
/// {Unable to Create Paging File} The creation of the paging file %hs failed (%lx). The requested size was %ld.
PAGEFILE_CREATE_FAILED = 0xC0000146,
/// {No Paging File Specified} No paging file was specified in the system configuration.
NO_PAGEFILE = 0xC0000147,
/// {Incorrect System Call Level} An invalid level was passed into the specified system call.
INVALID_LEVEL = 0xC0000148,
/// {Incorrect Password to LAN Manager Server} You specified an incorrect password to a LAN Manager 2.x or MS-NET server.
WRONG_PASSWORD_CORE = 0xC0000149,
/// {EXCEPTION} A real-mode application issued a floating-point instruction and floating-point hardware is not present.
ILLEGAL_FLOAT_CONTEXT = 0xC000014A,
/// The pipe operation has failed because the other end of the pipe has been closed.
PIPE_BROKEN = 0xC000014B,
/// {The Registry Is Corrupt} The structure of one of the files that contains registry data is corrupt; the image of the file in memory is corrupt; or the file could not be recovered because the alternate copy or log was absent or corrupt.
REGISTRY_CORRUPT = 0xC000014C,
/// An I/O operation initiated by the Registry failed and cannot be recovered.
/// The registry could not read in, write out, or flush one of the files that contain the system's image of the registry.
REGISTRY_IO_FAILED = 0xC000014D,
/// An event pair synchronization operation was performed using the thread-specific client/server event pair object, but no event pair object was associated with the thread.
NO_EVENT_PAIR = 0xC000014E,
/// The volume does not contain a recognized file system.
/// Be sure that all required file system drivers are loaded and that the volume is not corrupt.
UNRECOGNIZED_VOLUME = 0xC000014F,
/// No serial device was successfully initialized. The serial driver will unload.
SERIAL_NO_DEVICE_INITED = 0xC0000150,
/// The specified local group does not exist.
NO_SUCH_ALIAS = 0xC0000151,
/// The specified account name is not a member of the group.
MEMBER_NOT_IN_ALIAS = 0xC0000152,
/// The specified account name is already a member of the group.
MEMBER_IN_ALIAS = 0xC0000153,
/// The specified local group already exists.
ALIAS_EXISTS = 0xC0000154,
/// A requested type of logon (for example, interactive, network, and service) is not granted by the local security policy of the target system.
/// Ask the system administrator to grant the necessary form of logon.
LOGON_NOT_GRANTED = 0xC0000155,
/// The maximum number of secrets that can be stored in a single system was exceeded.
/// The length and number of secrets is limited to satisfy U.S. State Department export restrictions.
TOO_MANY_SECRETS = 0xC0000156,
/// The length of a secret exceeds the maximum allowable length.
/// The length and number of secrets is limited to satisfy U.S. State Department export restrictions.
SECRET_TOO_LONG = 0xC0000157,
/// The local security authority (LSA) database contains an internal inconsistency.
INTERNAL_DB_ERROR = 0xC0000158,
/// The requested operation cannot be performed in full-screen mode.
FULLSCREEN_MODE = 0xC0000159,
/// During a logon attempt, the user's security context accumulated too many security IDs. This is a very unusual situation.
/// Remove the user from some global or local groups to reduce the number of security IDs to incorporate into the security context.
TOO_MANY_CONTEXT_IDS = 0xC000015A,
/// A user has requested a type of logon (for example, interactive or network) that has not been granted.
/// An administrator has control over who can logon interactively and through the network.
LOGON_TYPE_NOT_GRANTED = 0xC000015B,
/// The system has attempted to load or restore a file into the registry, and the specified file is not in the format of a registry file.
NOT_REGISTRY_FILE = 0xC000015C,
/// An attempt was made to change a user password in the security account manager without providing the necessary Windows cross-encrypted password.
NT_CROSS_ENCRYPTION_REQUIRED = 0xC000015D,
/// A domain server has an incorrect configuration.
DOMAIN_CTRLR_CONFIG_ERROR = 0xC000015E,
/// An attempt was made to explicitly access the secondary copy of information via a device control to the fault tolerance driver and the secondary copy is not present in the system.
FT_MISSING_MEMBER = 0xC000015F,
/// A configuration registry node that represents a driver service entry was ill-formed and did not contain the required value entries.
ILL_FORMED_SERVICE_ENTRY = 0xC0000160,
/// An illegal character was encountered.
/// For a multibyte character set, this includes a lead byte without a succeeding trail byte.
/// For the Unicode character set this includes the characters 0xFFFF and 0xFFFE.
ILLEGAL_CHARACTER = 0xC0000161,
/// No mapping for the Unicode character exists in the target multibyte code page.
UNMAPPABLE_CHARACTER = 0xC0000162,
/// The Unicode character is not defined in the Unicode character set that is installed on the system.
UNDEFINED_CHARACTER = 0xC0000163,
/// The paging file cannot be created on a floppy disk.
FLOPPY_VOLUME = 0xC0000164,
/// {Floppy Disk Error} While accessing a floppy disk, an ID address mark was not found.
FLOPPY_ID_MARK_NOT_FOUND = 0xC0000165,
/// {Floppy Disk Error} While accessing a floppy disk, the track address from the sector ID field was found to be different from the track address that is maintained by the controller.
FLOPPY_WRONG_CYLINDER = 0xC0000166,
/// {Floppy Disk Error} The floppy disk controller reported an error that is not recognized by the floppy disk driver.
FLOPPY_UNKNOWN_ERROR = 0xC0000167,
/// {Floppy Disk Error} While accessing a floppy-disk, the controller returned inconsistent results via its registers.
FLOPPY_BAD_REGISTERS = 0xC0000168,
/// {Hard Disk Error} While accessing the hard disk, a recalibrate operation failed, even after retries.
DISK_RECALIBRATE_FAILED = 0xC0000169,
/// {Hard Disk Error} While accessing the hard disk, a disk operation failed even after retries.
DISK_OPERATION_FAILED = 0xC000016A,
/// {Hard Disk Error} While accessing the hard disk, a disk controller reset was needed, but even that failed.
DISK_RESET_FAILED = 0xC000016B,
/// An attempt was made to open a device that was sharing an interrupt request (IRQ) with other devices.
/// At least one other device that uses that IRQ was already opened.
/// Two concurrent opens of devices that share an IRQ and only work via interrupts is not supported for the particular bus type that the devices use.
SHARED_IRQ_BUSY = 0xC000016C,
/// {FT Orphaning} A disk that is part of a fault-tolerant volume can no longer be accessed.
FT_ORPHANING = 0xC000016D,
/// The basic input/output system (BIOS) failed to connect a system interrupt to the device or bus for which the device is connected.
BIOS_FAILED_TO_CONNECT_INTERRUPT = 0xC000016E,
/// The tape could not be partitioned.
PARTITION_FAILURE = 0xC0000172,
/// When accessing a new tape of a multi-volume partition, the current blocksize is incorrect.
INVALID_BLOCK_LENGTH = 0xC0000173,
/// The tape partition information could not be found when loading a tape.
DEVICE_NOT_PARTITIONED = 0xC0000174,
/// An attempt to lock the eject media mechanism failed.
UNABLE_TO_LOCK_MEDIA = 0xC0000175,
/// An attempt to unload media failed.
UNABLE_TO_UNLOAD_MEDIA = 0xC0000176,
/// The physical end of tape was detected.
EOM_OVERFLOW = 0xC0000177,
/// {No Media} There is no media in the drive. Insert media into drive %hs.
NO_MEDIA = 0xC0000178,
/// A member could not be added to or removed from the local group because the member does not exist.
NO_SUCH_MEMBER = 0xC000017A,
/// A new member could not be added to a local group because the member has the wrong account type.
INVALID_MEMBER = 0xC000017B,
/// An illegal operation was attempted on a registry key that has been marked for deletion.
KEY_DELETED = 0xC000017C,
/// The system could not allocate the required space in a registry log.
NO_LOG_SPACE = 0xC000017D,
/// Too many SIDs have been specified.
TOO_MANY_SIDS = 0xC000017E,
/// An attempt was made to change a user password in the security account manager without providing the necessary LM cross-encrypted password.
LM_CROSS_ENCRYPTION_REQUIRED = 0xC000017F,
/// An attempt was made to create a symbolic link in a registry key that already has subkeys or values.
KEY_HAS_CHILDREN = 0xC0000180,
/// An attempt was made to create a stable subkey under a volatile parent key.
CHILD_MUST_BE_VOLATILE = 0xC0000181,
/// The I/O device is configured incorrectly or the configuration parameters to the driver are incorrect.
DEVICE_CONFIGURATION_ERROR = 0xC0000182,
/// An error was detected between two drivers or within an I/O driver.
DRIVER_INTERNAL_ERROR = 0xC0000183,
/// The device is not in a valid state to perform this request.
INVALID_DEVICE_STATE = 0xC0000184,
/// The I/O device reported an I/O error.
IO_DEVICE_ERROR = 0xC0000185,
/// A protocol error was detected between the driver and the device.
DEVICE_PROTOCOL_ERROR = 0xC0000186,
/// This operation is only allowed for the primary domain controller of the domain.
BACKUP_CONTROLLER = 0xC0000187,
/// The log file space is insufficient to support this operation.
LOG_FILE_FULL = 0xC0000188,
/// A write operation was attempted to a volume after it was dismounted.
TOO_LATE = 0xC0000189,
/// The workstation does not have a trust secret for the primary domain in the local LSA database.
NO_TRUST_LSA_SECRET = 0xC000018A,
/// On applicable Windows Server releases, the SAM database does not have a computer account for this workstation trust relationship.
NO_TRUST_SAM_ACCOUNT = 0xC000018B,
/// The logon request failed because the trust relationship between the primary domain and the trusted domain failed.
TRUSTED_DOMAIN_FAILURE = 0xC000018C,
/// The logon request failed because the trust relationship between this workstation and the primary domain failed.
TRUSTED_RELATIONSHIP_FAILURE = 0xC000018D,
/// The Eventlog log file is corrupt.
EVENTLOG_FILE_CORRUPT = 0xC000018E,
/// No Eventlog log file could be opened. The Eventlog service did not start.
EVENTLOG_CANT_START = 0xC000018F,
/// The network logon failed. This might be because the validation authority cannot be reached.
TRUST_FAILURE = 0xC0000190,
/// An attempt was made to acquire a mutant such that its maximum count would have been exceeded.
MUTANT_LIMIT_EXCEEDED = 0xC0000191,
/// An attempt was made to logon, but the NetLogon service was not started.
NETLOGON_NOT_STARTED = 0xC0000192,
/// The user account has expired.
ACCOUNT_EXPIRED = 0xC0000193,
/// {EXCEPTION} Possible deadlock condition.
POSSIBLE_DEADLOCK = 0xC0000194,
/// Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed.
/// Disconnect all previous connections to the server or shared resource and try again.
NETWORK_CREDENTIAL_CONFLICT = 0xC0000195,
/// An attempt was made to establish a session to a network server, but there are already too many sessions established to that server.
REMOTE_SESSION_LIMIT = 0xC0000196,
/// The log file has changed between reads.
EVENTLOG_FILE_CHANGED = 0xC0000197,
/// The account used is an interdomain trust account.
/// Use your global user account or local user account to access this server.
NOLOGON_INTERDOMAIN_TRUST_ACCOUNT = 0xC0000198,
/// The account used is a computer account.
/// Use your global user account or local user account to access this server.
NOLOGON_WORKSTATION_TRUST_ACCOUNT = 0xC0000199,
/// The account used is a server trust account.
/// Use your global user account or local user account to access this server.
NOLOGON_SERVER_TRUST_ACCOUNT = 0xC000019A,
/// The name or SID of the specified domain is inconsistent with the trust information for that domain.
DOMAIN_TRUST_INCONSISTENT = 0xC000019B,
/// A volume has been accessed for which a file system driver is required that has not yet been loaded.
FS_DRIVER_REQUIRED = 0xC000019C,
/// Indicates that the specified image is already loaded as a DLL.
IMAGE_ALREADY_LOADED_AS_DLL = 0xC000019D,
/// Short name settings cannot be changed on this volume due to the global registry setting.
INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING = 0xC000019E,
/// Short names are not enabled on this volume.
SHORT_NAMES_NOT_ENABLED_ON_VOLUME = 0xC000019F,
/// The security stream for the given volume is in an inconsistent state. Please run CHKDSK on the volume.
SECURITY_STREAM_IS_INCONSISTENT = 0xC00001A0,
/// A requested file lock operation cannot be processed due to an invalid byte range.
INVALID_LOCK_RANGE = 0xC00001A1,
/// The specified access control entry (ACE) contains an invalid condition.
INVALID_ACE_CONDITION = 0xC00001A2,
/// The subsystem needed to support the image type is not present.
IMAGE_SUBSYSTEM_NOT_PRESENT = 0xC00001A3,
/// The specified file already has a notification GUID associated with it.
NOTIFICATION_GUID_ALREADY_DEFINED = 0xC00001A4,
/// A remote open failed because the network open restrictions were not satisfied.
NETWORK_OPEN_RESTRICTION = 0xC0000201,
/// There is no user session key for the specified logon session.
NO_USER_SESSION_KEY = 0xC0000202,
/// The remote user session has been deleted.
USER_SESSION_DELETED = 0xC0000203,
/// Indicates the specified resource language ID cannot be found in the image file.
RESOURCE_LANG_NOT_FOUND = 0xC0000204,
/// Insufficient server resources exist to complete the request.
INSUFF_SERVER_RESOURCES = 0xC0000205,
/// The size of the buffer is invalid for the specified operation.
INVALID_BUFFER_SIZE = 0xC0000206,
/// The transport rejected the specified network address as invalid.
INVALID_ADDRESS_COMPONENT = 0xC0000207,
/// The transport rejected the specified network address due to invalid use of a wildcard.
INVALID_ADDRESS_WILDCARD = 0xC0000208,
/// The transport address could not be opened because all the available addresses are in use.
TOO_MANY_ADDRESSES = 0xC0000209,
/// The transport address could not be opened because it already exists.
ADDRESS_ALREADY_EXISTS = 0xC000020A,
/// The transport address is now closed.
ADDRESS_CLOSED = 0xC000020B,
/// The transport connection is now disconnected.
CONNECTION_DISCONNECTED = 0xC000020C,
/// The transport connection has been reset.
CONNECTION_RESET = 0xC000020D,
/// The transport cannot dynamically acquire any more nodes.
TOO_MANY_NODES = 0xC000020E,
/// The transport aborted a pending transaction.
TRANSACTION_ABORTED = 0xC000020F,
/// The transport timed out a request that is waiting for a response.
TRANSACTION_TIMED_OUT = 0xC0000210,
/// The transport did not receive a release for a pending response.
TRANSACTION_NO_RELEASE = 0xC0000211,
/// The transport did not find a transaction that matches the specific token.
TRANSACTION_NO_MATCH = 0xC0000212,
/// The transport had previously responded to a transaction request.
TRANSACTION_RESPONDED = 0xC0000213,
/// The transport does not recognize the specified transaction request ID.
TRANSACTION_INVALID_ID = 0xC0000214,
/// The transport does not recognize the specified transaction request type.
TRANSACTION_INVALID_TYPE = 0xC0000215,
/// The transport can only process the specified request on the server side of a session.
NOT_SERVER_SESSION = 0xC0000216,
/// The transport can only process the specified request on the client side of a session.
NOT_CLIENT_SESSION = 0xC0000217,
/// {Registry File Failure} The registry cannot load the hive (file): %hs or its log or alternate. It is corrupt, absent, or not writable.
CANNOT_LOAD_REGISTRY_FILE = 0xC0000218,
/// {Unexpected Failure in DebugActiveProcess} An unexpected failure occurred while processing a DebugActiveProcess API request.
/// Choosing OK will terminate the process, and choosing Cancel will ignore the error.
DEBUG_ATTACH_FAILED = 0xC0000219,
/// {Fatal System Error} The %hs system process terminated unexpectedly with a status of 0x%08x (0x%08x 0x%08x). The system has been shut down.
SYSTEM_PROCESS_TERMINATED = 0xC000021A,
/// {Data Not Accepted} The TDI client could not handle the data received during an indication.
DATA_NOT_ACCEPTED = 0xC000021B,
/// {Unable to Retrieve Browser Server List} The list of servers for this workgroup is not currently available.
NO_BROWSER_SERVERS_FOUND = 0xC000021C,
/// NTVDM encountered a hard error.
VDM_HARD_ERROR = 0xC000021D,
/// {Cancel Timeout} The driver %hs failed to complete a canceled I/O request in the allotted time.
DRIVER_CANCEL_TIMEOUT = 0xC000021E,
/// {Reply Message Mismatch} An attempt was made to reply to an LPC message, but the thread specified by the client ID in the message was not waiting on that message.
REPLY_MESSAGE_MISMATCH = 0xC000021F,
/// {Mapped View Alignment Incorrect} An attempt was made to map a view of a file, but either the specified base address or the offset into the file were not aligned on the proper allocation granularity.
MAPPED_ALIGNMENT = 0xC0000220,
/// {Bad Image Checksum} The image %hs is possibly corrupt.
/// The header checksum does not match the computed checksum.
IMAGE_CHECKSUM_MISMATCH = 0xC0000221,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs. The data has been lost.
/// This error might be caused by a failure of your computer hardware or network connection. Try to save this file elsewhere.
LOST_WRITEBEHIND_DATA = 0xC0000222,
/// The parameters passed to the server in the client/server shared memory window were invalid.
/// Too much data might have been put in the shared memory window.
CLIENT_SERVER_PARAMETERS_INVALID = 0xC0000223,
/// The user password must be changed before logging on the first time.
PASSWORD_MUST_CHANGE = 0xC0000224,
/// The object was not found.
NOT_FOUND = 0xC0000225,
/// The stream is not a tiny stream.
NOT_TINY_STREAM = 0xC0000226,
/// A transaction recovery failed.
RECOVERY_FAILURE = 0xC0000227,
/// The request must be handled by the stack overflow code.
STACK_OVERFLOW_READ = 0xC0000228,
/// A consistency check failed.
FAIL_CHECK = 0xC0000229,
/// The attempt to insert the ID in the index failed because the ID is already in the index.
DUPLICATE_OBJECTID = 0xC000022A,
/// The attempt to set the object ID failed because the object already has an ID.
OBJECTID_EXISTS = 0xC000022B,
/// Internal OFS status codes indicating how an allocation operation is handled.
/// Either it is retried after the containing oNode is moved or the extent stream is converted to a large stream.
CONVERT_TO_LARGE = 0xC000022C,
/// The request needs to be retried.
RETRY = 0xC000022D,
/// The attempt to find the object found an object on the volume that matches by ID; however, it is out of the scope of the handle that is used for the operation.
FOUND_OUT_OF_SCOPE = 0xC000022E,
/// The bucket array must be grown. Retry the transaction after doing so.
ALLOCATE_BUCKET = 0xC000022F,
/// The specified property set does not exist on the object.
PROPSET_NOT_FOUND = 0xC0000230,
/// The user/kernel marshaling buffer has overflowed.
MARSHALL_OVERFLOW = 0xC0000231,
/// The supplied variant structure contains invalid data.
INVALID_VARIANT = 0xC0000232,
/// A domain controller for this domain was not found.
DOMAIN_CONTROLLER_NOT_FOUND = 0xC0000233,
/// The user account has been automatically locked because too many invalid logon attempts or password change attempts have been requested.
ACCOUNT_LOCKED_OUT = 0xC0000234,
/// NtClose was called on a handle that was protected from close via NtSetInformationObject.
HANDLE_NOT_CLOSABLE = 0xC0000235,
/// The transport-connection attempt was refused by the remote system.
CONNECTION_REFUSED = 0xC0000236,
/// The transport connection was gracefully closed.
GRACEFUL_DISCONNECT = 0xC0000237,
/// The transport endpoint already has an address associated with it.
ADDRESS_ALREADY_ASSOCIATED = 0xC0000238,
/// An address has not yet been associated with the transport endpoint.
ADDRESS_NOT_ASSOCIATED = 0xC0000239,
/// An operation was attempted on a nonexistent transport connection.
CONNECTION_INVALID = 0xC000023A,
/// An invalid operation was attempted on an active transport connection.
CONNECTION_ACTIVE = 0xC000023B,
/// The remote network is not reachable by the transport.
NETWORK_UNREACHABLE = 0xC000023C,
/// The remote system is not reachable by the transport.
HOST_UNREACHABLE = 0xC000023D,
/// The remote system does not support the transport protocol.
PROTOCOL_UNREACHABLE = 0xC000023E,
/// No service is operating at the destination port of the transport on the remote system.
PORT_UNREACHABLE = 0xC000023F,
/// The request was aborted.
REQUEST_ABORTED = 0xC0000240,
/// The transport connection was aborted by the local system.
CONNECTION_ABORTED = 0xC0000241,
/// The specified buffer contains ill-formed data.
BAD_COMPRESSION_BUFFER = 0xC0000242,
/// The requested operation cannot be performed on a file with a user mapped section open.
USER_MAPPED_FILE = 0xC0000243,
/// {Audit Failed} An attempt to generate a security audit failed.
AUDIT_FAILED = 0xC0000244,
/// The timer resolution was not previously set by the current process.
TIMER_RESOLUTION_NOT_SET = 0xC0000245,
/// A connection to the server could not be made because the limit on the number of concurrent connections for this account has been reached.
CONNECTION_COUNT_LIMIT = 0xC0000246,
/// Attempting to log on during an unauthorized time of day for this account.
LOGIN_TIME_RESTRICTION = 0xC0000247,
/// The account is not authorized to log on from this station.
LOGIN_WKSTA_RESTRICTION = 0xC0000248,
/// {UP/MP Image Mismatch} The image %hs has been modified for use on a uniprocessor system, but you are running it on a multiprocessor machine. Reinstall the image file.
IMAGE_MP_UP_MISMATCH = 0xC0000249,
/// There is insufficient account information to log you on.
INSUFFICIENT_LOGON_INFO = 0xC0000250,
/// {Invalid DLL Entrypoint} The dynamic link library %hs is not written correctly.
/// The stack pointer has been left in an inconsistent state.
/// The entry point should be declared as WINAPI or STDCALL.
/// Select YES to fail the DLL load. Select NO to continue execution.
/// Selecting NO might cause the application to operate incorrectly.
BAD_DLL_ENTRYPOINT = 0xC0000251,
/// {Invalid Service Callback Entrypoint} The %hs service is not written correctly.
/// The stack pointer has been left in an inconsistent state.
/// The callback entry point should be declared as WINAPI or STDCALL.
/// Selecting OK will cause the service to continue operation.
/// However, the service process might operate incorrectly.
BAD_SERVICE_ENTRYPOINT = 0xC0000252,
/// The server received the messages but did not send a reply.
LPC_REPLY_LOST = 0xC0000253,
/// There is an IP address conflict with another system on the network.
IP_ADDRESS_CONFLICT1 = 0xC0000254,
/// There is an IP address conflict with another system on the network.
IP_ADDRESS_CONFLICT2 = 0xC0000255,
/// {Low On Registry Space} The system has reached the maximum size that is allowed for the system part of the registry. Additional storage requests will be ignored.
REGISTRY_QUOTA_LIMIT = 0xC0000256,
/// The contacted server does not support the indicated part of the DFS namespace.
PATH_NOT_COVERED = 0xC0000257,
/// A callback return system service cannot be executed when no callback is active.
NO_CALLBACK_ACTIVE = 0xC0000258,
/// The service being accessed is licensed for a particular number of connections.
/// No more connections can be made to the service at this time because the service has already accepted the maximum number of connections.
LICENSE_QUOTA_EXCEEDED = 0xC0000259,
/// The password provided is too short to meet the policy of your user account. Choose a longer password.
PWD_TOO_SHORT = 0xC000025A,
/// The policy of your user account does not allow you to change passwords too frequently.
/// This is done to prevent users from changing back to a familiar, but potentially discovered, password.
/// If you feel your password has been compromised, contact your administrator immediately to have a new one assigned.
PWD_TOO_RECENT = 0xC000025B,
/// You have attempted to change your password to one that you have used in the past.
/// The policy of your user account does not allow this.
/// Select a password that you have not previously used.
PWD_HISTORY_CONFLICT = 0xC000025C,
/// You have attempted to load a legacy device driver while its device instance had been disabled.
PLUGPLAY_NO_DEVICE = 0xC000025E,
/// The specified compression format is unsupported.
UNSUPPORTED_COMPRESSION = 0xC000025F,
/// The specified hardware profile configuration is invalid.
INVALID_HW_PROFILE = 0xC0000260,
/// The specified Plug and Play registry device path is invalid.
INVALID_PLUGPLAY_DEVICE_PATH = 0xC0000261,
/// {Driver Entry Point Not Found} The %hs device driver could not locate the ordinal %ld in driver %hs.
DRIVER_ORDINAL_NOT_FOUND = 0xC0000262,
/// {Driver Entry Point Not Found} The %hs device driver could not locate the entry point %hs in driver %hs.
DRIVER_ENTRYPOINT_NOT_FOUND = 0xC0000263,
/// {Application Error} The application attempted to release a resource it did not own. Click OK to terminate the application.
RESOURCE_NOT_OWNED = 0xC0000264,
/// An attempt was made to create more links on a file than the file system supports.
TOO_MANY_LINKS = 0xC0000265,
/// The specified quota list is internally inconsistent with its descriptor.
QUOTA_LIST_INCONSISTENT = 0xC0000266,
/// The specified file has been relocated to offline storage.
FILE_IS_OFFLINE = 0xC0000267,
/// {Windows Evaluation Notification} The evaluation period for this installation of Windows has expired. This system will shutdown in 1 hour.
/// To restore access to this installation of Windows, upgrade this installation by using a licensed distribution of this product.
EVALUATION_EXPIRATION = 0xC0000268,
/// {Illegal System DLL Relocation} The system DLL %hs was relocated in memory. The application will not run properly.
/// The relocation occurred because the DLL %hs occupied an address range that is reserved for Windows system DLLs.
/// The vendor supplying the DLL should be contacted for a new DLL.
ILLEGAL_DLL_RELOCATION = 0xC0000269,
/// {License Violation} The system has detected tampering with your registered product type.
/// This is a violation of your software license. Tampering with the product type is not permitted.
LICENSE_VIOLATION = 0xC000026A,
/// {DLL Initialization Failed} The application failed to initialize because the window station is shutting down.
DLL_INIT_FAILED_LOGOFF = 0xC000026B,
/// {Unable to Load Device Driver} %hs device driver could not be loaded. Error Status was 0x%x.
DRIVER_UNABLE_TO_LOAD = 0xC000026C,
/// DFS is unavailable on the contacted server.
DFS_UNAVAILABLE = 0xC000026D,
/// An operation was attempted to a volume after it was dismounted.
VOLUME_DISMOUNTED = 0xC000026E,
/// An internal error occurred in the Win32 x86 emulation subsystem.
WX86_INTERNAL_ERROR = 0xC000026F,
/// Win32 x86 emulation subsystem floating-point stack check.
WX86_FLOAT_STACK_CHECK = 0xC0000270,
/// The validation process needs to continue on to the next step.
VALIDATE_CONTINUE = 0xC0000271,
/// There was no match for the specified key in the index.
NO_MATCH = 0xC0000272,
/// There are no more matches for the current index enumeration.
NO_MORE_MATCHES = 0xC0000273,
/// The NTFS file or directory is not a reparse point.
NOT_A_REPARSE_POINT = 0xC0000275,
/// The Windows I/O reparse tag passed for the NTFS reparse point is invalid.
IO_REPARSE_TAG_INVALID = 0xC0000276,
/// The Windows I/O reparse tag does not match the one that is in the NTFS reparse point.
IO_REPARSE_TAG_MISMATCH = 0xC0000277,
/// The user data passed for the NTFS reparse point is invalid.
IO_REPARSE_DATA_INVALID = 0xC0000278,
/// The layered file system driver for this I/O tag did not handle it when needed.
IO_REPARSE_TAG_NOT_HANDLED = 0xC0000279,
/// The NTFS symbolic link could not be resolved even though the initial file name is valid.
REPARSE_POINT_NOT_RESOLVED = 0xC0000280,
/// The NTFS directory is a reparse point.
DIRECTORY_IS_A_REPARSE_POINT = 0xC0000281,
/// The range could not be added to the range list because of a conflict.
RANGE_LIST_CONFLICT = 0xC0000282,
/// The specified medium changer source element contains no media.
SOURCE_ELEMENT_EMPTY = 0xC0000283,
/// The specified medium changer destination element already contains media.
DESTINATION_ELEMENT_FULL = 0xC0000284,
/// The specified medium changer element does not exist.
ILLEGAL_ELEMENT_ADDRESS = 0xC0000285,
/// The specified element is contained in a magazine that is no longer present.
MAGAZINE_NOT_PRESENT = 0xC0000286,
/// The device requires re-initialization due to hardware errors.
REINITIALIZATION_NEEDED = 0xC0000287,
/// The file encryption attempt failed.
ENCRYPTION_FAILED = 0xC000028A,
/// The file decryption attempt failed.
DECRYPTION_FAILED = 0xC000028B,
/// The specified range could not be found in the range list.
RANGE_NOT_FOUND = 0xC000028C,
/// There is no encryption recovery policy configured for this system.
NO_RECOVERY_POLICY = 0xC000028D,
/// The required encryption driver is not loaded for this system.
NO_EFS = 0xC000028E,
/// The file was encrypted with a different encryption driver than is currently loaded.
WRONG_EFS = 0xC000028F,
/// There are no EFS keys defined for the user.
NO_USER_KEYS = 0xC0000290,
/// The specified file is not encrypted.
FILE_NOT_ENCRYPTED = 0xC0000291,
/// The specified file is not in the defined EFS export format.
NOT_EXPORT_FORMAT = 0xC0000292,
/// The specified file is encrypted and the user does not have the ability to decrypt it.
FILE_ENCRYPTED = 0xC0000293,
/// The GUID passed was not recognized as valid by a WMI data provider.
WMI_GUID_NOT_FOUND = 0xC0000295,
/// The instance name passed was not recognized as valid by a WMI data provider.
WMI_INSTANCE_NOT_FOUND = 0xC0000296,
/// The data item ID passed was not recognized as valid by a WMI data provider.
WMI_ITEMID_NOT_FOUND = 0xC0000297,
/// The WMI request could not be completed and should be retried.
WMI_TRY_AGAIN = 0xC0000298,
/// The policy object is shared and can only be modified at the root.
SHARED_POLICY = 0xC0000299,
/// The policy object does not exist when it should.
POLICY_OBJECT_NOT_FOUND = 0xC000029A,
/// The requested policy information only lives in the Ds.
POLICY_ONLY_IN_DS = 0xC000029B,
/// The volume must be upgraded to enable this feature.
VOLUME_NOT_UPGRADED = 0xC000029C,
/// The remote storage service is not operational at this time.
REMOTE_STORAGE_NOT_ACTIVE = 0xC000029D,
/// The remote storage service encountered a media error.
REMOTE_STORAGE_MEDIA_ERROR = 0xC000029E,
/// The tracking (workstation) service is not running.
NO_TRACKING_SERVICE = 0xC000029F,
/// The server process is running under a SID that is different from the SID that is required by client.
SERVER_SID_MISMATCH = 0xC00002A0,
/// The specified directory service attribute or value does not exist.
DS_NO_ATTRIBUTE_OR_VALUE = 0xC00002A1,
/// The attribute syntax specified to the directory service is invalid.
DS_INVALID_ATTRIBUTE_SYNTAX = 0xC00002A2,
/// The attribute type specified to the directory service is not defined.
DS_ATTRIBUTE_TYPE_UNDEFINED = 0xC00002A3,
/// The specified directory service attribute or value already exists.
DS_ATTRIBUTE_OR_VALUE_EXISTS = 0xC00002A4,
/// The directory service is busy.
DS_BUSY = 0xC00002A5,
/// The directory service is unavailable.
DS_UNAVAILABLE = 0xC00002A6,
/// The directory service was unable to allocate a relative identifier.
DS_NO_RIDS_ALLOCATED = 0xC00002A7,
/// The directory service has exhausted the pool of relative identifiers.
DS_NO_MORE_RIDS = 0xC00002A8,
/// The requested operation could not be performed because the directory service is not the master for that type of operation.
DS_INCORRECT_ROLE_OWNER = 0xC00002A9,
/// The directory service was unable to initialize the subsystem that allocates relative identifiers.
DS_RIDMGR_INIT_ERROR = 0xC00002AA,
/// The requested operation did not satisfy one or more constraints that are associated with the class of the object.
DS_OBJ_CLASS_VIOLATION = 0xC00002AB,
/// The directory service can perform the requested operation only on a leaf object.
DS_CANT_ON_NON_LEAF = 0xC00002AC,
/// The directory service cannot perform the requested operation on the Relatively Defined Name (RDN) attribute of an object.
DS_CANT_ON_RDN = 0xC00002AD,
/// The directory service detected an attempt to modify the object class of an object.
DS_CANT_MOD_OBJ_CLASS = 0xC00002AE,
/// An error occurred while performing a cross domain move operation.
DS_CROSS_DOM_MOVE_FAILED = 0xC00002AF,
/// Unable to contact the global catalog server.
DS_GC_NOT_AVAILABLE = 0xC00002B0,
/// The requested operation requires a directory service, and none was available.
DIRECTORY_SERVICE_REQUIRED = 0xC00002B1,
/// The reparse attribute cannot be set because it is incompatible with an existing attribute.
REPARSE_ATTRIBUTE_CONFLICT = 0xC00002B2,
/// A group marked "use for deny only" cannot be enabled.
CANT_ENABLE_DENY_ONLY = 0xC00002B3,
/// {EXCEPTION} Multiple floating-point faults.
FLOAT_MULTIPLE_FAULTS = 0xC00002B4,
/// {EXCEPTION} Multiple floating-point traps.
FLOAT_MULTIPLE_TRAPS = 0xC00002B5,
/// The device has been removed.
DEVICE_REMOVED = 0xC00002B6,
/// The volume change journal is being deleted.
JOURNAL_DELETE_IN_PROGRESS = 0xC00002B7,
/// The volume change journal is not active.
JOURNAL_NOT_ACTIVE = 0xC00002B8,
/// The requested interface is not supported.
NOINTERFACE = 0xC00002B9,
/// A directory service resource limit has been exceeded.
DS_ADMIN_LIMIT_EXCEEDED = 0xC00002C1,
/// {System Standby Failed} The driver %hs does not support standby mode.
/// Updating this driver allows the system to go to standby mode.
DRIVER_FAILED_SLEEP = 0xC00002C2,
/// Mutual Authentication failed. The server password is out of date at the domain controller.
MUTUAL_AUTHENTICATION_FAILED = 0xC00002C3,
/// The system file %1 has become corrupt and has been replaced.
CORRUPT_SYSTEM_FILE = 0xC00002C4,
/// {EXCEPTION} Alignment Error A data type misalignment error was detected in a load or store instruction.
DATATYPE_MISALIGNMENT_ERROR = 0xC00002C5,
/// The WMI data item or data block is read-only.
WMI_READ_ONLY = 0xC00002C6,
/// The WMI data item or data block could not be changed.
WMI_SET_FAILURE = 0xC00002C7,
/// {Virtual Memory Minimum Too Low} Your system is low on virtual memory.
/// Windows is increasing the size of your virtual memory paging file.
/// During this process, memory requests for some applications might be denied. For more information, see Help.
COMMITMENT_MINIMUM = 0xC00002C8,
/// {EXCEPTION} Register NaT consumption faults.
/// A NaT value is consumed on a non-speculative instruction.
REG_NAT_CONSUMPTION = 0xC00002C9,
/// The transport element of the medium changer contains media, which is causing the operation to fail.
TRANSPORT_FULL = 0xC00002CA,
/// Security Accounts Manager initialization failed because of the following error: %hs Error Status: 0x%x.
/// Click OK to shut down this system and restart in Directory Services Restore Mode.
/// Check the event log for more detailed information.
DS_SAM_INIT_FAILURE = 0xC00002CB,
/// This operation is supported only when you are connected to the server.
ONLY_IF_CONNECTED = 0xC00002CC,
/// Only an administrator can modify the membership list of an administrative group.
DS_SENSITIVE_GROUP_VIOLATION = 0xC00002CD,
/// A device was removed so enumeration must be restarted.
PNP_RESTART_ENUMERATION = 0xC00002CE,
/// The journal entry has been deleted from the journal.
JOURNAL_ENTRY_DELETED = 0xC00002CF,
/// Cannot change the primary group ID of a domain controller account.
DS_CANT_MOD_PRIMARYGROUPID = 0xC00002D0,
/// {Fatal System Error} The system image %s is not properly signed.
/// The file has been replaced with the signed file. The system has been shut down.
SYSTEM_IMAGE_BAD_SIGNATURE = 0xC00002D1,
/// The device will not start without a reboot.
PNP_REBOOT_REQUIRED = 0xC00002D2,
/// The power state of the current device cannot support this request.
POWER_STATE_INVALID = 0xC00002D3,
/// The specified group type is invalid.
DS_INVALID_GROUP_TYPE = 0xC00002D4,
/// In a mixed domain, no nesting of a global group if the group is security enabled.
DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN = 0xC00002D5,
/// In a mixed domain, cannot nest local groups with other local groups, if the group is security enabled.
DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN = 0xC00002D6,
/// A global group cannot have a local group as a member.
DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER = 0xC00002D7,
/// A global group cannot have a universal group as a member.
DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER = 0xC00002D8,
/// A universal group cannot have a local group as a member.
DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER = 0xC00002D9,
/// A global group cannot have a cross-domain member.
DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER = 0xC00002DA,
/// A local group cannot have another cross-domain local group as a member.
DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER = 0xC00002DB,
/// Cannot change to a security-disabled group because primary members are in this group.
DS_HAVE_PRIMARY_MEMBERS = 0xC00002DC,
/// The WMI operation is not supported by the data block or method.
WMI_NOT_SUPPORTED = 0xC00002DD,
/// There is not enough power to complete the requested operation.
INSUFFICIENT_POWER = 0xC00002DE,
/// The Security Accounts Manager needs to get the boot password.
SAM_NEED_BOOTKEY_PASSWORD = 0xC00002DF,
/// The Security Accounts Manager needs to get the boot key from the floppy disk.
SAM_NEED_BOOTKEY_FLOPPY = 0xC00002E0,
/// The directory service cannot start.
DS_CANT_START = 0xC00002E1,
/// The directory service could not start because of the following error: %hs Error Status: 0x%x.
/// Click OK to shut down this system and restart in Directory Services Restore Mode.
/// Check the event log for more detailed information.
DS_INIT_FAILURE = 0xC00002E2,
/// The Security Accounts Manager initialization failed because of the following error: %hs Error Status: 0x%x.
/// Click OK to shut down this system and restart in Safe Mode.
/// Check the event log for more detailed information.
SAM_INIT_FAILURE = 0xC00002E3,
/// The requested operation can be performed only on a global catalog server.
DS_GC_REQUIRED = 0xC00002E4,
/// A local group can only be a member of other local groups in the same domain.
DS_LOCAL_MEMBER_OF_LOCAL_ONLY = 0xC00002E5,
/// Foreign security principals cannot be members of universal groups.
DS_NO_FPO_IN_UNIVERSAL_GROUPS = 0xC00002E6,
/// Your computer could not be joined to the domain.
/// You have exceeded the maximum number of computer accounts you are allowed to create in this domain.
/// Contact your system administrator to have this limit reset or increased.
DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED = 0xC00002E7,
/// This operation cannot be performed on the current domain.
CURRENT_DOMAIN_NOT_ALLOWED = 0xC00002E9,
/// The directory or file cannot be created.
CANNOT_MAKE = 0xC00002EA,
/// The system is in the process of shutting down.
SYSTEM_SHUTDOWN = 0xC00002EB,
/// Directory Services could not start because of the following error: %hs Error Status: 0x%x. Click OK to shut down the system.
/// You can use the recovery console to diagnose the system further.
DS_INIT_FAILURE_CONSOLE = 0xC00002EC,
/// Security Accounts Manager initialization failed because of the following error: %hs Error Status: 0x%x. Click OK to shut down the system.
/// You can use the recovery console to diagnose the system further.
DS_SAM_INIT_FAILURE_CONSOLE = 0xC00002ED,
/// A security context was deleted before the context was completed. This is considered a logon failure.
UNFINISHED_CONTEXT_DELETED = 0xC00002EE,
/// The client is trying to negotiate a context and the server requires user-to-user but did not send a TGT reply.
NO_TGT_REPLY = 0xC00002EF,
/// An object ID was not found in the file.
OBJECTID_NOT_FOUND = 0xC00002F0,
/// Unable to accomplish the requested task because the local machine does not have any IP addresses.
NO_IP_ADDRESSES = 0xC00002F1,
/// The supplied credential handle does not match the credential that is associated with the security context.
WRONG_CREDENTIAL_HANDLE = 0xC00002F2,
/// The crypto system or checksum function is invalid because a required function is unavailable.
CRYPTO_SYSTEM_INVALID = 0xC00002F3,
/// The number of maximum ticket referrals has been exceeded.
MAX_REFERRALS_EXCEEDED = 0xC00002F4,
/// The local machine must be a Kerberos KDC (domain controller) and it is not.
MUST_BE_KDC = 0xC00002F5,
/// The other end of the security negotiation requires strong crypto but it is not supported on the local machine.
STRONG_CRYPTO_NOT_SUPPORTED = 0xC00002F6,
/// The KDC reply contained more than one principal name.
TOO_MANY_PRINCIPALS = 0xC00002F7,
/// Expected to find PA data for a hint of what etype to use, but it was not found.
NO_PA_DATA = 0xC00002F8,
/// The client certificate does not contain a valid UPN, or does not match the client name in the logon request. Contact your administrator.
PKINIT_NAME_MISMATCH = 0xC00002F9,
/// Smart card logon is required and was not used.
SMARTCARD_LOGON_REQUIRED = 0xC00002FA,
/// An invalid request was sent to the KDC.
KDC_INVALID_REQUEST = 0xC00002FB,
/// The KDC was unable to generate a referral for the service requested.
KDC_UNABLE_TO_REFER = 0xC00002FC,
/// The encryption type requested is not supported by the KDC.
KDC_UNKNOWN_ETYPE = 0xC00002FD,
/// A system shutdown is in progress.
SHUTDOWN_IN_PROGRESS = 0xC00002FE,
/// The server machine is shutting down.
SERVER_SHUTDOWN_IN_PROGRESS = 0xC00002FF,
/// This operation is not supported on a computer running Windows Server 2003 operating system for Small Business Server.
NOT_SUPPORTED_ON_SBS = 0xC0000300,
/// The WMI GUID is no longer available.
WMI_GUID_DISCONNECTED = 0xC0000301,
/// Collection or events for the WMI GUID is already disabled.
WMI_ALREADY_DISABLED = 0xC0000302,
/// Collection or events for the WMI GUID is already enabled.
WMI_ALREADY_ENABLED = 0xC0000303,
/// The master file table on the volume is too fragmented to complete this operation.
MFT_TOO_FRAGMENTED = 0xC0000304,
/// Copy protection failure.
COPY_PROTECTION_FAILURE = 0xC0000305,
/// Copy protection error—DVD CSS Authentication failed.
CSS_AUTHENTICATION_FAILURE = 0xC0000306,
/// Copy protection error—The specified sector does not contain a valid key.
CSS_KEY_NOT_PRESENT = 0xC0000307,
/// Copy protection error—DVD session key not established.
CSS_KEY_NOT_ESTABLISHED = 0xC0000308,
/// Copy protection error—The read failed because the sector is encrypted.
CSS_SCRAMBLED_SECTOR = 0xC0000309,
/// Copy protection error—The region of the specified DVD does not correspond to the region setting of the drive.
CSS_REGION_MISMATCH = 0xC000030A,
/// Copy protection error—The region setting of the drive might be permanent.
CSS_RESETS_EXHAUSTED = 0xC000030B,
/// The Kerberos protocol encountered an error while validating the KDC certificate during smart card logon.
/// There is more information in the system event log.
PKINIT_FAILURE = 0xC0000320,
/// The Kerberos protocol encountered an error while attempting to use the smart card subsystem.
SMARTCARD_SUBSYSTEM_FAILURE = 0xC0000321,
/// The target server does not have acceptable Kerberos credentials.
NO_KERB_KEY = 0xC0000322,
/// The transport determined that the remote system is down.
HOST_DOWN = 0xC0000350,
/// An unsupported pre-authentication mechanism was presented to the Kerberos package.
UNSUPPORTED_PREAUTH = 0xC0000351,
/// The encryption algorithm that is used on the source file needs a bigger key buffer than the one that is used on the destination file.
EFS_ALG_BLOB_TOO_BIG = 0xC0000352,
/// An attempt to remove a processes DebugPort was made, but a port was not already associated with the process.
PORT_NOT_SET = 0xC0000353,
/// An attempt to do an operation on a debug port failed because the port is in the process of being deleted.
DEBUGGER_INACTIVE = 0xC0000354,
/// This version of Windows is not compatible with the behavior version of the directory forest, domain, or domain controller.
DS_VERSION_CHECK_FAILURE = 0xC0000355,
/// The specified event is currently not being audited.
AUDITING_DISABLED = 0xC0000356,
/// The machine account was created prior to Windows NT 4.0 operating system. The account needs to be recreated.
PRENT4_MACHINE_ACCOUNT = 0xC0000357,
/// An account group cannot have a universal group as a member.
DS_AG_CANT_HAVE_UNIVERSAL_MEMBER = 0xC0000358,
/// The specified image file did not have the correct format; it appears to be a 32-bit Windows image.
INVALID_IMAGE_WIN_32 = 0xC0000359,
/// The specified image file did not have the correct format; it appears to be a 64-bit Windows image.
INVALID_IMAGE_WIN_64 = 0xC000035A,
/// The client's supplied SSPI channel bindings were incorrect.
BAD_BINDINGS = 0xC000035B,
/// The client session has expired; so the client must re-authenticate to continue accessing the remote resources.
NETWORK_SESSION_EXPIRED = 0xC000035C,
/// The AppHelp dialog box canceled; thus preventing the application from starting.
APPHELP_BLOCK = 0xC000035D,
/// The SID filtering operation removed all SIDs.
ALL_SIDS_FILTERED = 0xC000035E,
/// The driver was not loaded because the system is starting in safe mode.
NOT_SAFE_MODE_DRIVER = 0xC000035F,
/// Access to %1 has been restricted by your Administrator by the default software restriction policy level.
ACCESS_DISABLED_BY_POLICY_DEFAULT = 0xC0000361,
/// Access to %1 has been restricted by your Administrator by location with policy rule %2 placed on path %3.
ACCESS_DISABLED_BY_POLICY_PATH = 0xC0000362,
/// Access to %1 has been restricted by your Administrator by software publisher policy.
ACCESS_DISABLED_BY_POLICY_PUBLISHER = 0xC0000363,
/// Access to %1 has been restricted by your Administrator by policy rule %2.
ACCESS_DISABLED_BY_POLICY_OTHER = 0xC0000364,
/// The driver was not loaded because it failed its initialization call.
FAILED_DRIVER_ENTRY = 0xC0000365,
/// The device encountered an error while applying power or reading the device configuration.
/// This might be caused by a failure of your hardware or by a poor connection.
DEVICE_ENUMERATION_ERROR = 0xC0000366,
/// The create operation failed because the name contained at least one mount point that resolves to a volume to which the specified device object is not attached.
MOUNT_POINT_NOT_RESOLVED = 0xC0000368,
/// The device object parameter is either not a valid device object or is not attached to the volume that is specified by the file name.
INVALID_DEVICE_OBJECT_PARAMETER = 0xC0000369,
/// A machine check error has occurred.
/// Check the system event log for additional information.
MCA_OCCURED = 0xC000036A,
/// Driver %2 has been blocked from loading.
DRIVER_BLOCKED_CRITICAL = 0xC000036B,
/// Driver %2 has been blocked from loading.
DRIVER_BLOCKED = 0xC000036C,
/// There was error [%2] processing the driver database.
DRIVER_DATABASE_ERROR = 0xC000036D,
/// System hive size has exceeded its limit.
SYSTEM_HIVE_TOO_LARGE = 0xC000036E,
/// A dynamic link library (DLL) referenced a module that was neither a DLL nor the process's executable image.
INVALID_IMPORT_OF_NON_DLL = 0xC000036F,
/// The local account store does not contain secret material for the specified account.
NO_SECRETS = 0xC0000371,
/// Access to %1 has been restricted by your Administrator by policy rule %2.
ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY = 0xC0000372,
/// The system was not able to allocate enough memory to perform a stack switch.
FAILED_STACK_SWITCH = 0xC0000373,
/// A heap has been corrupted.
HEAP_CORRUPTION = 0xC0000374,
/// An incorrect PIN was presented to the smart card.
SMARTCARD_WRONG_PIN = 0xC0000380,
/// The smart card is blocked.
SMARTCARD_CARD_BLOCKED = 0xC0000381,
/// No PIN was presented to the smart card.
SMARTCARD_CARD_NOT_AUTHENTICATED = 0xC0000382,
/// No smart card is available.
SMARTCARD_NO_CARD = 0xC0000383,
/// The requested key container does not exist on the smart card.
SMARTCARD_NO_KEY_CONTAINER = 0xC0000384,
/// The requested certificate does not exist on the smart card.
SMARTCARD_NO_CERTIFICATE = 0xC0000385,
/// The requested keyset does not exist.
SMARTCARD_NO_KEYSET = 0xC0000386,
/// A communication error with the smart card has been detected.
SMARTCARD_IO_ERROR = 0xC0000387,
/// The system detected a possible attempt to compromise security.
/// Ensure that you can contact the server that authenticated you.
DOWNGRADE_DETECTED = 0xC0000388,
/// The smart card certificate used for authentication has been revoked. Contact your system administrator.
/// There might be additional information in the event log.
SMARTCARD_CERT_REVOKED = 0xC0000389,
/// An untrusted certificate authority was detected while processing the smart card certificate that is used for authentication. Contact your system administrator.
ISSUING_CA_UNTRUSTED = 0xC000038A,
/// The revocation status of the smart card certificate that is used for authentication could not be determined. Contact your system administrator.
REVOCATION_OFFLINE_C = 0xC000038B,
/// The smart card certificate used for authentication was not trusted. Contact your system administrator.
PKINIT_CLIENT_FAILURE = 0xC000038C,
/// The smart card certificate used for authentication has expired. Contact your system administrator.
SMARTCARD_CERT_EXPIRED = 0xC000038D,
/// The driver could not be loaded because a previous version of the driver is still in memory.
DRIVER_FAILED_PRIOR_UNLOAD = 0xC000038E,
/// The smart card provider could not perform the action because the context was acquired as silent.
SMARTCARD_SILENT_CONTEXT = 0xC000038F,
/// The delegated trust creation quota of the current user has been exceeded.
PER_USER_TRUST_QUOTA_EXCEEDED = 0xC0000401,
/// The total delegated trust creation quota has been exceeded.
ALL_USER_TRUST_QUOTA_EXCEEDED = 0xC0000402,
/// The delegated trust deletion quota of the current user has been exceeded.
USER_DELETE_TRUST_QUOTA_EXCEEDED = 0xC0000403,
/// The requested name already exists as a unique identifier.
DS_NAME_NOT_UNIQUE = 0xC0000404,
/// The requested object has a non-unique identifier and cannot be retrieved.
DS_DUPLICATE_ID_FOUND = 0xC0000405,
/// The group cannot be converted due to attribute restrictions on the requested group type.
DS_GROUP_CONVERSION_ERROR = 0xC0000406,
/// {Volume Shadow Copy Service} Wait while the Volume Shadow Copy Service prepares volume %hs for hibernation.
VOLSNAP_PREPARE_HIBERNATE = 0xC0000407,
/// Kerberos sub-protocol User2User is required.
USER2USER_REQUIRED = 0xC0000408,
/// The system detected an overrun of a stack-based buffer in this application.
/// This overrun could potentially allow a malicious user to gain control of this application.
STACK_BUFFER_OVERRUN = 0xC0000409,
/// The Kerberos subsystem encountered an error.
/// A service for user protocol request was made against a domain controller which does not support service for user.
NO_S4U_PROT_SUPPORT = 0xC000040A,
/// An attempt was made by this server to make a Kerberos constrained delegation request for a target that is outside the server realm.
/// This action is not supported and the resulting error indicates a misconfiguration on the allowed-to-delegate-to list for this server. Contact your administrator.
CROSSREALM_DELEGATION_FAILURE = 0xC000040B,
/// The revocation status of the domain controller certificate used for smart card authentication could not be determined.
/// There is additional information in the system event log. Contact your system administrator.
REVOCATION_OFFLINE_KDC = 0xC000040C,
/// An untrusted certificate authority was detected while processing the domain controller certificate used for authentication.
/// There is additional information in the system event log. Contact your system administrator.
ISSUING_CA_UNTRUSTED_KDC = 0xC000040D,
/// The domain controller certificate used for smart card logon has expired.
/// Contact your system administrator with the contents of your system event log.
KDC_CERT_EXPIRED = 0xC000040E,
/// The domain controller certificate used for smart card logon has been revoked.
/// Contact your system administrator with the contents of your system event log.
KDC_CERT_REVOKED = 0xC000040F,
/// Data present in one of the parameters is more than the function can operate on.
PARAMETER_QUOTA_EXCEEDED = 0xC0000410,
/// The system has failed to hibernate (The error code is %hs).
/// Hibernation will be disabled until the system is restarted.
HIBERNATION_FAILURE = 0xC0000411,
/// An attempt to delay-load a .dll or get a function address in a delay-loaded .dll failed.
DELAY_LOAD_FAILED = 0xC0000412,
/// Logon Failure: The machine you are logging onto is protected by an authentication firewall.
/// The specified account is not allowed to authenticate to the machine.
AUTHENTICATION_FIREWALL_FAILED = 0xC0000413,
/// %hs is a 16-bit application. You do not have permissions to execute 16-bit applications.
/// Check your permissions with your system administrator.
VDM_DISALLOWED = 0xC0000414,
/// {Display Driver Stopped Responding} The %hs display driver has stopped working normally.
/// Save your work and reboot the system to restore full display functionality.
/// The next time you reboot the machine a dialog will be displayed giving you a chance to report this failure to Microsoft.
HUNG_DISPLAY_DRIVER_THREAD = 0xC0000415,
/// The Desktop heap encountered an error while allocating session memory.
/// There is more information in the system event log.
INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE = 0xC0000416,
/// An invalid parameter was passed to a C runtime function.
INVALID_CRUNTIME_PARAMETER = 0xC0000417,
/// The authentication failed because NTLM was blocked.
NTLM_BLOCKED = 0xC0000418,
/// The source object's SID already exists in destination forest.
DS_SRC_SID_EXISTS_IN_FOREST = 0xC0000419,
/// The domain name of the trusted domain already exists in the forest.
DS_DOMAIN_NAME_EXISTS_IN_FOREST = 0xC000041A,
/// The flat name of the trusted domain already exists in the forest.
DS_FLAT_NAME_EXISTS_IN_FOREST = 0xC000041B,
/// The User Principal Name (UPN) is invalid.
INVALID_USER_PRINCIPAL_NAME = 0xC000041C,
/// There has been an assertion failure.
ASSERTION_FAILURE = 0xC0000420,
/// Application verifier has found an error in the current process.
VERIFIER_STOP = 0xC0000421,
/// A user mode unwind is in progress.
CALLBACK_POP_STACK = 0xC0000423,
/// %2 has been blocked from loading due to incompatibility with this system.
/// Contact your software vendor for a compatible version of the driver.
INCOMPATIBLE_DRIVER_BLOCKED = 0xC0000424,
/// Illegal operation attempted on a registry key which has already been unloaded.
HIVE_UNLOADED = 0xC0000425,
/// Compression is disabled for this volume.
COMPRESSION_DISABLED = 0xC0000426,
/// The requested operation could not be completed due to a file system limitation.
FILE_SYSTEM_LIMITATION = 0xC0000427,
/// The hash for image %hs cannot be found in the system catalogs.
/// The image is likely corrupt or the victim of tampering.
INVALID_IMAGE_HASH = 0xC0000428,
/// The implementation is not capable of performing the request.
NOT_CAPABLE = 0xC0000429,
/// The requested operation is out of order with respect to other operations.
REQUEST_OUT_OF_SEQUENCE = 0xC000042A,
/// An operation attempted to exceed an implementation-defined limit.
IMPLEMENTATION_LIMIT = 0xC000042B,
/// The requested operation requires elevation.
ELEVATION_REQUIRED = 0xC000042C,
/// The required security context does not exist.
NO_SECURITY_CONTEXT = 0xC000042D,
/// The PKU2U protocol encountered an error while attempting to utilize the associated certificates.
PKU2U_CERT_FAILURE = 0xC000042E,
/// The operation was attempted beyond the valid data length of the file.
BEYOND_VDL = 0xC0000432,
/// The attempted write operation encountered a write already in progress for some portion of the range.
ENCOUNTERED_WRITE_IN_PROGRESS = 0xC0000433,
/// The page fault mappings changed in the middle of processing a fault so the operation must be retried.
PTE_CHANGED = 0xC0000434,
/// The attempt to purge this file from memory failed to purge some or all the data from memory.
PURGE_FAILED = 0xC0000435,
/// The requested credential requires confirmation.
CRED_REQUIRES_CONFIRMATION = 0xC0000440,
/// The remote server sent an invalid response for a file being opened with Client Side Encryption.
CS_ENCRYPTION_INVALID_SERVER_RESPONSE = 0xC0000441,
/// Client Side Encryption is not supported by the remote server even though it claims to support it.
CS_ENCRYPTION_UNSUPPORTED_SERVER = 0xC0000442,
/// File is encrypted and should be opened in Client Side Encryption mode.
CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE = 0xC0000443,
/// A new encrypted file is being created and a $EFS needs to be provided.
CS_ENCRYPTION_NEW_ENCRYPTED_FILE = 0xC0000444,
/// The SMB client requested a CSE FSCTL on a non-CSE file.
CS_ENCRYPTION_FILE_NOT_CSE = 0xC0000445,
/// Indicates a particular Security ID cannot be assigned as the label of an object.
INVALID_LABEL = 0xC0000446,
/// The process hosting the driver for this device has terminated.
DRIVER_PROCESS_TERMINATED = 0xC0000450,
/// The requested system device cannot be identified due to multiple indistinguishable devices potentially matching the identification criteria.
AMBIGUOUS_SYSTEM_DEVICE = 0xC0000451,
/// The requested system device cannot be found.
SYSTEM_DEVICE_NOT_FOUND = 0xC0000452,
/// This boot application must be restarted.
RESTART_BOOT_APPLICATION = 0xC0000453,
/// Insufficient NVRAM resources exist to complete the API. A reboot might be required.
INSUFFICIENT_NVRAM_RESOURCES = 0xC0000454,
/// No ranges for the specified operation were able to be processed.
NO_RANGES_PROCESSED = 0xC0000460,
/// The storage device does not support Offload Write.
DEVICE_FEATURE_NOT_SUPPORTED = 0xC0000463,
/// Data cannot be moved because the source device cannot communicate with the destination device.
DEVICE_UNREACHABLE = 0xC0000464,
/// The token representing the data is invalid or expired.
INVALID_TOKEN = 0xC0000465,
/// The file server is temporarily unavailable.
SERVER_UNAVAILABLE = 0xC0000466,
/// The specified task name is invalid.
INVALID_TASK_NAME = 0xC0000500,
/// The specified task index is invalid.
INVALID_TASK_INDEX = 0xC0000501,
/// The specified thread is already joining a task.
THREAD_ALREADY_IN_TASK = 0xC0000502,
/// A callback has requested to bypass native code.
CALLBACK_BYPASS = 0xC0000503,
/// A fail fast exception occurred.
/// Exception handlers will not be invoked and the process will be terminated immediately.
FAIL_FAST_EXCEPTION = 0xC0000602,
/// Windows cannot verify the digital signature for this file.
/// The signing certificate for this file has been revoked.
IMAGE_CERT_REVOKED = 0xC0000603,
/// The ALPC port is closed.
PORT_CLOSED = 0xC0000700,
/// The ALPC message requested is no longer available.
MESSAGE_LOST = 0xC0000701,
/// The ALPC message supplied is invalid.
INVALID_MESSAGE = 0xC0000702,
/// The ALPC message has been canceled.
REQUEST_CANCELED = 0xC0000703,
/// Invalid recursive dispatch attempt.
RECURSIVE_DISPATCH = 0xC0000704,
/// No receive buffer has been supplied in a synchronous request.
LPC_RECEIVE_BUFFER_EXPECTED = 0xC0000705,
/// The connection port is used in an invalid context.
LPC_INVALID_CONNECTION_USAGE = 0xC0000706,
/// The ALPC port does not accept new request messages.
LPC_REQUESTS_NOT_ALLOWED = 0xC0000707,
/// The resource requested is already in use.
RESOURCE_IN_USE = 0xC0000708,
/// The hardware has reported an uncorrectable memory error.
HARDWARE_MEMORY_ERROR = 0xC0000709,
/// Status 0x%08x was returned, waiting on handle 0x%x for wait 0x%p, in waiter 0x%p.
THREADPOOL_HANDLE_EXCEPTION = 0xC000070A,
/// After a callback to 0x%p(0x%p), a completion call to Set event(0x%p) failed with status 0x%08x.
THREADPOOL_SET_EVENT_ON_COMPLETION_FAILED = 0xC000070B,
/// After a callback to 0x%p(0x%p), a completion call to ReleaseSemaphore(0x%p, %d) failed with status 0x%08x.
THREADPOOL_RELEASE_SEMAPHORE_ON_COMPLETION_FAILED = 0xC000070C,
/// After a callback to 0x%p(0x%p), a completion call to ReleaseMutex(%p) failed with status 0x%08x.
THREADPOOL_RELEASE_MUTEX_ON_COMPLETION_FAILED = 0xC000070D,
/// After a callback to 0x%p(0x%p), a completion call to FreeLibrary(%p) failed with status 0x%08x.
THREADPOOL_FREE_LIBRARY_ON_COMPLETION_FAILED = 0xC000070E,
/// The thread pool 0x%p was released while a thread was posting a callback to 0x%p(0x%p) to it.
THREADPOOL_RELEASED_DURING_OPERATION = 0xC000070F,
/// A thread pool worker thread is impersonating a client, after a callback to 0x%p(0x%p).
/// This is unexpected, indicating that the callback is missing a call to revert the impersonation.
CALLBACK_RETURNED_WHILE_IMPERSONATING = 0xC0000710,
/// A thread pool worker thread is impersonating a client, after executing an APC.
/// This is unexpected, indicating that the APC is missing a call to revert the impersonation.
APC_RETURNED_WHILE_IMPERSONATING = 0xC0000711,
/// Either the target process, or the target thread's containing process, is a protected process.
PROCESS_IS_PROTECTED = 0xC0000712,
/// A thread is getting dispatched with MCA EXCEPTION because of MCA.
MCA_EXCEPTION = 0xC0000713,
/// The client certificate account mapping is not unique.
CERTIFICATE_MAPPING_NOT_UNIQUE = 0xC0000714,
/// The symbolic link cannot be followed because its type is disabled.
SYMLINK_CLASS_DISABLED = 0xC0000715,
/// Indicates that the specified string is not valid for IDN normalization.
INVALID_IDN_NORMALIZATION = 0xC0000716,
/// No mapping for the Unicode character exists in the target multi-byte code page.
NO_UNICODE_TRANSLATION = 0xC0000717,
/// The provided callback is already registered.
ALREADY_REGISTERED = 0xC0000718,
/// The provided context did not match the target.
CONTEXT_MISMATCH = 0xC0000719,
/// The specified port already has a completion list.
PORT_ALREADY_HAS_COMPLETION_LIST = 0xC000071A,
/// A threadpool worker thread entered a callback at thread base priority 0x%x and exited at priority 0x%x.
/// This is unexpected, indicating that the callback missed restoring the priority.
CALLBACK_RETURNED_THREAD_PRIORITY = 0xC000071B,
/// An invalid thread, handle %p, is specified for this operation.
/// Possibly, a threadpool worker thread was specified.
INVALID_THREAD = 0xC000071C,
/// A threadpool worker thread entered a callback, which left transaction state.
/// This is unexpected, indicating that the callback missed clearing the transaction.
CALLBACK_RETURNED_TRANSACTION = 0xC000071D,
/// A threadpool worker thread entered a callback, which left the loader lock held.
/// This is unexpected, indicating that the callback missed releasing the lock.
CALLBACK_RETURNED_LDR_LOCK = 0xC000071E,
/// A threadpool worker thread entered a callback, which left with preferred languages set.
/// This is unexpected, indicating that the callback missed clearing them.
CALLBACK_RETURNED_LANG = 0xC000071F,
/// A threadpool worker thread entered a callback, which left with background priorities set.
/// This is unexpected, indicating that the callback missed restoring the original priorities.
CALLBACK_RETURNED_PRI_BACK = 0xC0000720,
/// The attempted operation required self healing to be enabled.
DISK_REPAIR_DISABLED = 0xC0000800,
/// The directory service cannot perform the requested operation because a domain rename operation is in progress.
DS_DOMAIN_RENAME_IN_PROGRESS = 0xC0000801,
/// An operation failed because the storage quota was exceeded.
DISK_QUOTA_EXCEEDED = 0xC0000802,
/// An operation failed because the content was blocked.
CONTENT_BLOCKED = 0xC0000804,
/// The operation could not be completed due to bad clusters on disk.
BAD_CLUSTERS = 0xC0000805,
/// The operation could not be completed because the volume is dirty. Please run the Chkdsk utility and try again.
VOLUME_DIRTY = 0xC0000806,
/// This file is checked out or locked for editing by another user.
FILE_CHECKED_OUT = 0xC0000901,
/// The file must be checked out before saving changes.
CHECKOUT_REQUIRED = 0xC0000902,
/// The file type being saved or retrieved has been blocked.
BAD_FILE_TYPE = 0xC0000903,
/// The file size exceeds the limit allowed and cannot be saved.
FILE_TOO_LARGE = 0xC0000904,
/// Access Denied. Before opening files in this location, you must first browse to the e.g.
/// site and select the option to log on automatically.
FORMS_AUTH_REQUIRED = 0xC0000905,
/// The operation did not complete successfully because the file contains a virus.
VIRUS_INFECTED = 0xC0000906,
/// This file contains a virus and cannot be opened.
/// Due to the nature of this virus, the file has been removed from this location.
VIRUS_DELETED = 0xC0000907,
/// The resources required for this device conflict with the MCFG table.
BAD_MCFG_TABLE = 0xC0000908,
/// The operation did not complete successfully because it would cause an oplock to be broken.
/// The caller has requested that existing oplocks not be broken.
CANNOT_BREAK_OPLOCK = 0xC0000909,
/// WOW Assertion Error.
WOW_ASSERTION = 0xC0009898,
/// The cryptographic signature is invalid.
INVALID_SIGNATURE = 0xC000A000,
/// The cryptographic provider does not support HMAC.
HMAC_NOT_SUPPORTED = 0xC000A001,
/// The IPsec queue overflowed.
IPSEC_QUEUE_OVERFLOW = 0xC000A010,
/// The neighbor discovery queue overflowed.
ND_QUEUE_OVERFLOW = 0xC000A011,
/// An Internet Control Message Protocol (ICMP) hop limit exceeded error was received.
HOPLIMIT_EXCEEDED = 0xC000A012,
/// The protocol is not installed on the local machine.
PROTOCOL_NOT_SUPPORTED = 0xC000A013,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost.
/// This error might be caused by network connectivity issues. Try to save this file elsewhere.
LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED = 0xC000A080,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost.
/// This error was returned by the server on which the file exists. Try to save this file elsewhere.
LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR = 0xC000A081,
/// {Delayed Write Failed} Windows was unable to save all the data for the file %hs; the data has been lost.
/// This error might be caused if the device has been removed or the media is write-protected.
LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR = 0xC000A082,
/// Windows was unable to parse the requested XML data.
XML_PARSE_ERROR = 0xC000A083,
/// An error was encountered while processing an XML digital signature.
XMLDSIG_ERROR = 0xC000A084,
/// This indicates that the caller made the connection request in the wrong routing compartment.
WRONG_COMPARTMENT = 0xC000A085,
/// This indicates that there was an AuthIP failure when attempting to connect to the remote host.
AUTHIP_FAILURE = 0xC000A086,
/// OID mapped groups cannot have members.
DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS = 0xC000A087,
/// The specified OID cannot be found.
DS_OID_NOT_FOUND = 0xC000A088,
/// Hash generation for the specified version and hash type is not enabled on server.
HASH_NOT_SUPPORTED = 0xC000A100,
/// The hash requests is not present or not up to date with the current file contents.
HASH_NOT_PRESENT = 0xC000A101,
/// A file system filter on the server has not opted in for Offload Read support.
OFFLOAD_READ_FLT_NOT_SUPPORTED = 0xC000A2A1,
/// A file system filter on the server has not opted in for Offload Write support.
OFFLOAD_WRITE_FLT_NOT_SUPPORTED = 0xC000A2A2,
/// Offload read operations cannot be performed on:
/// - Compressed files
/// - Sparse files
/// - Encrypted files
/// - File system metadata files
OFFLOAD_READ_FILE_NOT_SUPPORTED = 0xC000A2A3,
/// Offload write operations cannot be performed on:
/// - Compressed files
/// - Sparse files
/// - Encrypted files
/// - File system metadata files
OFFLOAD_WRITE_FILE_NOT_SUPPORTED = 0xC000A2A4,
/// The debugger did not perform a state change.
DBG_NO_STATE_CHANGE = 0xC0010001,
/// The debugger found that the application is not idle.
DBG_APP_NOT_IDLE = 0xC0010002,
/// The string binding is invalid.
RPC_NT_INVALID_STRING_BINDING = 0xC0020001,
/// The binding handle is not the correct type.
RPC_NT_WRONG_KIND_OF_BINDING = 0xC0020002,
/// The binding handle is invalid.
RPC_NT_INVALID_BINDING = 0xC0020003,
/// The RPC protocol sequence is not supported.
RPC_NT_PROTSEQ_NOT_SUPPORTED = 0xC0020004,
/// The RPC protocol sequence is invalid.
RPC_NT_INVALID_RPC_PROTSEQ = 0xC0020005,
/// The string UUID is invalid.
RPC_NT_INVALID_STRING_UUID = 0xC0020006,
/// The endpoint format is invalid.
RPC_NT_INVALID_ENDPOINT_FORMAT = 0xC0020007,
/// The network address is invalid.
RPC_NT_INVALID_NET_ADDR = 0xC0020008,
/// No endpoint was found.
RPC_NT_NO_ENDPOINT_FOUND = 0xC0020009,
/// The time-out value is invalid.
RPC_NT_INVALID_TIMEOUT = 0xC002000A,
/// The object UUID was not found.
RPC_NT_OBJECT_NOT_FOUND = 0xC002000B,
/// The object UUID has already been registered.
RPC_NT_ALREADY_REGISTERED = 0xC002000C,
/// The type UUID has already been registered.
RPC_NT_TYPE_ALREADY_REGISTERED = 0xC002000D,
/// The RPC server is already listening.
RPC_NT_ALREADY_LISTENING = 0xC002000E,
/// No protocol sequences have been registered.
RPC_NT_NO_PROTSEQS_REGISTERED = 0xC002000F,
/// The RPC server is not listening.
RPC_NT_NOT_LISTENING = 0xC0020010,
/// The manager type is unknown.
RPC_NT_UNKNOWN_MGR_TYPE = 0xC0020011,
/// The interface is unknown.
RPC_NT_UNKNOWN_IF = 0xC0020012,
/// There are no bindings.
RPC_NT_NO_BINDINGS = 0xC0020013,
/// There are no protocol sequences.
RPC_NT_NO_PROTSEQS = 0xC0020014,
/// The endpoint cannot be created.
RPC_NT_CANT_CREATE_ENDPOINT = 0xC0020015,
/// Insufficient resources are available to complete this operation.
RPC_NT_OUT_OF_RESOURCES = 0xC0020016,
/// The RPC server is unavailable.
RPC_NT_SERVER_UNAVAILABLE = 0xC0020017,
/// The RPC server is too busy to complete this operation.
RPC_NT_SERVER_TOO_BUSY = 0xC0020018,
/// The network options are invalid.
RPC_NT_INVALID_NETWORK_OPTIONS = 0xC0020019,
/// No RPCs are active on this thread.
RPC_NT_NO_CALL_ACTIVE = 0xC002001A,
/// The RPC failed.
RPC_NT_CALL_FAILED = 0xC002001B,
/// The RPC failed and did not execute.
RPC_NT_CALL_FAILED_DNE = 0xC002001C,
/// An RPC protocol error occurred.
RPC_NT_PROTOCOL_ERROR = 0xC002001D,
/// The RPC server does not support the transfer syntax.
RPC_NT_UNSUPPORTED_TRANS_SYN = 0xC002001F,
/// The type UUID is not supported.
RPC_NT_UNSUPPORTED_TYPE = 0xC0020021,
/// The tag is invalid.
RPC_NT_INVALID_TAG = 0xC0020022,
/// The array bounds are invalid.
RPC_NT_INVALID_BOUND = 0xC0020023,
/// The binding does not contain an entry name.
RPC_NT_NO_ENTRY_NAME = 0xC0020024,
/// The name syntax is invalid.
RPC_NT_INVALID_NAME_SYNTAX = 0xC0020025,
/// The name syntax is not supported.
RPC_NT_UNSUPPORTED_NAME_SYNTAX = 0xC0020026,
/// No network address is available to construct a UUID.
RPC_NT_UUID_NO_ADDRESS = 0xC0020028,
/// The endpoint is a duplicate.
RPC_NT_DUPLICATE_ENDPOINT = 0xC0020029,
/// The authentication type is unknown.
RPC_NT_UNKNOWN_AUTHN_TYPE = 0xC002002A,
/// The maximum number of calls is too small.
RPC_NT_MAX_CALLS_TOO_SMALL = 0xC002002B,
/// The string is too long.
RPC_NT_STRING_TOO_LONG = 0xC002002C,
/// The RPC protocol sequence was not found.
RPC_NT_PROTSEQ_NOT_FOUND = 0xC002002D,
/// The procedure number is out of range.
RPC_NT_PROCNUM_OUT_OF_RANGE = 0xC002002E,
/// The binding does not contain any authentication information.
RPC_NT_BINDING_HAS_NO_AUTH = 0xC002002F,
/// The authentication service is unknown.
RPC_NT_UNKNOWN_AUTHN_SERVICE = 0xC0020030,
/// The authentication level is unknown.
RPC_NT_UNKNOWN_AUTHN_LEVEL = 0xC0020031,
/// The security context is invalid.
RPC_NT_INVALID_AUTH_IDENTITY = 0xC0020032,
/// The authorization service is unknown.
RPC_NT_UNKNOWN_AUTHZ_SERVICE = 0xC0020033,
/// The entry is invalid.
EPT_NT_INVALID_ENTRY = 0xC0020034,
/// The operation cannot be performed.
EPT_NT_CANT_PERFORM_OP = 0xC0020035,
/// No more endpoints are available from the endpoint mapper.
EPT_NT_NOT_REGISTERED = 0xC0020036,
/// No interfaces have been exported.
RPC_NT_NOTHING_TO_EXPORT = 0xC0020037,
/// The entry name is incomplete.
RPC_NT_INCOMPLETE_NAME = 0xC0020038,
/// The version option is invalid.
RPC_NT_INVALID_VERS_OPTION = 0xC0020039,
/// There are no more members.
RPC_NT_NO_MORE_MEMBERS = 0xC002003A,
/// There is nothing to unexport.
RPC_NT_NOT_ALL_OBJS_UNEXPORTED = 0xC002003B,
/// The interface was not found.
RPC_NT_INTERFACE_NOT_FOUND = 0xC002003C,
/// The entry already exists.
RPC_NT_ENTRY_ALREADY_EXISTS = 0xC002003D,
/// The entry was not found.
RPC_NT_ENTRY_NOT_FOUND = 0xC002003E,
/// The name service is unavailable.
RPC_NT_NAME_SERVICE_UNAVAILABLE = 0xC002003F,
/// The network address family is invalid.
RPC_NT_INVALID_NAF_ID = 0xC0020040,
/// The requested operation is not supported.
RPC_NT_CANNOT_SUPPORT = 0xC0020041,
/// No security context is available to allow impersonation.
RPC_NT_NO_CONTEXT_AVAILABLE = 0xC0020042,
/// An internal error occurred in the RPC.
RPC_NT_INTERNAL_ERROR = 0xC0020043,
/// The RPC server attempted to divide an integer by zero.
RPC_NT_ZERO_DIVIDE = 0xC0020044,
/// An addressing error occurred in the RPC server.
RPC_NT_ADDRESS_ERROR = 0xC0020045,
/// A floating point operation at the RPC server caused a divide by zero.
RPC_NT_FP_DIV_ZERO = 0xC0020046,
/// A floating point underflow occurred at the RPC server.
RPC_NT_FP_UNDERFLOW = 0xC0020047,
/// A floating point overflow occurred at the RPC server.
RPC_NT_FP_OVERFLOW = 0xC0020048,
/// An RPC is already in progress for this thread.
RPC_NT_CALL_IN_PROGRESS = 0xC0020049,
/// There are no more bindings.
RPC_NT_NO_MORE_BINDINGS = 0xC002004A,
/// The group member was not found.
RPC_NT_GROUP_MEMBER_NOT_FOUND = 0xC002004B,
/// The endpoint mapper database entry could not be created.
EPT_NT_CANT_CREATE = 0xC002004C,
/// The object UUID is the nil UUID.
RPC_NT_INVALID_OBJECT = 0xC002004D,
/// No interfaces have been registered.
RPC_NT_NO_INTERFACES = 0xC002004F,
/// The RPC was canceled.
RPC_NT_CALL_CANCELLED = 0xC0020050,
/// The binding handle does not contain all the required information.
RPC_NT_BINDING_INCOMPLETE = 0xC0020051,
/// A communications failure occurred during an RPC.
RPC_NT_COMM_FAILURE = 0xC0020052,
/// The requested authentication level is not supported.
RPC_NT_UNSUPPORTED_AUTHN_LEVEL = 0xC0020053,
/// No principal name was registered.
RPC_NT_NO_PRINC_NAME = 0xC0020054,
/// The error specified is not a valid Windows RPC error code.
RPC_NT_NOT_RPC_ERROR = 0xC0020055,
/// A security package-specific error occurred.
RPC_NT_SEC_PKG_ERROR = 0xC0020057,
/// The thread was not canceled.
RPC_NT_NOT_CANCELLED = 0xC0020058,
/// Invalid asynchronous RPC handle.
RPC_NT_INVALID_ASYNC_HANDLE = 0xC0020062,
/// Invalid asynchronous RPC call handle for this operation.
RPC_NT_INVALID_ASYNC_CALL = 0xC0020063,
/// Access to the HTTP proxy is denied.
RPC_NT_PROXY_ACCESS_DENIED = 0xC0020064,
/// The list of RPC servers available for auto-handle binding has been exhausted.
RPC_NT_NO_MORE_ENTRIES = 0xC0030001,
/// The file designated by DCERPCCHARTRANS cannot be opened.
RPC_NT_SS_CHAR_TRANS_OPEN_FAIL = 0xC0030002,
/// The file containing the character translation table has fewer than 512 bytes.
RPC_NT_SS_CHAR_TRANS_SHORT_FILE = 0xC0030003,
/// A null context handle is passed as an [in] parameter.
RPC_NT_SS_IN_NULL_CONTEXT = 0xC0030004,
/// The context handle does not match any known context handles.
RPC_NT_SS_CONTEXT_MISMATCH = 0xC0030005,
/// The context handle changed during a call.
RPC_NT_SS_CONTEXT_DAMAGED = 0xC0030006,
/// The binding handles passed to an RPC do not match.
RPC_NT_SS_HANDLES_MISMATCH = 0xC0030007,
/// The stub is unable to get the call handle.
RPC_NT_SS_CANNOT_GET_CALL_HANDLE = 0xC0030008,
/// A null reference pointer was passed to the stub.
RPC_NT_NULL_REF_POINTER = 0xC0030009,
/// The enumeration value is out of range.
RPC_NT_ENUM_VALUE_OUT_OF_RANGE = 0xC003000A,
/// The byte count is too small.
RPC_NT_BYTE_COUNT_TOO_SMALL = 0xC003000B,
/// The stub received bad data.
RPC_NT_BAD_STUB_DATA = 0xC003000C,
/// Invalid operation on the encoding/decoding handle.
RPC_NT_INVALID_ES_ACTION = 0xC0030059,
/// Incompatible version of the serializing package.
RPC_NT_WRONG_ES_VERSION = 0xC003005A,
/// Incompatible version of the RPC stub.
RPC_NT_WRONG_STUB_VERSION = 0xC003005B,
/// The RPC pipe object is invalid or corrupt.
RPC_NT_INVALID_PIPE_OBJECT = 0xC003005C,
/// An invalid operation was attempted on an RPC pipe object.
RPC_NT_INVALID_PIPE_OPERATION = 0xC003005D,
/// Unsupported RPC pipe version.
RPC_NT_WRONG_PIPE_VERSION = 0xC003005E,
/// The RPC pipe object has already been closed.
RPC_NT_PIPE_CLOSED = 0xC003005F,
/// The RPC call completed before all pipes were processed.
RPC_NT_PIPE_DISCIPLINE_ERROR = 0xC0030060,
/// No more data is available from the RPC pipe.
RPC_NT_PIPE_EMPTY = 0xC0030061,
/// A device is missing in the system BIOS MPS table. This device will not be used.
/// Contact your system vendor for a system BIOS update.
PNP_BAD_MPS_TABLE = 0xC0040035,
/// A translator failed to translate resources.
PNP_TRANSLATION_FAILED = 0xC0040036,
/// An IRQ translator failed to translate resources.
PNP_IRQ_TRANSLATION_FAILED = 0xC0040037,
/// Driver %2 returned an invalid ID for a child device (%3).
PNP_INVALID_ID = 0xC0040038,
/// Reissue the given operation as a cached I/O operation
IO_REISSUE_AS_CACHED = 0xC0040039,
/// Session name %1 is invalid.
CTX_WINSTATION_NAME_INVALID = 0xC00A0001,
/// The protocol driver %1 is invalid.
CTX_INVALID_PD = 0xC00A0002,
/// The protocol driver %1 was not found in the system path.
CTX_PD_NOT_FOUND = 0xC00A0003,
/// A close operation is pending on the terminal connection.
CTX_CLOSE_PENDING = 0xC00A0006,
/// No free output buffers are available.
CTX_NO_OUTBUF = 0xC00A0007,
/// The MODEM.INF file was not found.
CTX_MODEM_INF_NOT_FOUND = 0xC00A0008,
/// The modem (%1) was not found in the MODEM.INF file.
CTX_INVALID_MODEMNAME = 0xC00A0009,
/// The modem did not accept the command sent to it.
/// Verify that the configured modem name matches the attached modem.
CTX_RESPONSE_ERROR = 0xC00A000A,
/// The modem did not respond to the command sent to it.
/// Verify that the modem cable is properly attached and the modem is turned on.
CTX_MODEM_RESPONSE_TIMEOUT = 0xC00A000B,
/// Carrier detection has failed or the carrier has been dropped due to disconnection.
CTX_MODEM_RESPONSE_NO_CARRIER = 0xC00A000C,
/// A dial tone was not detected within the required time.
/// Verify that the phone cable is properly attached and functional.
CTX_MODEM_RESPONSE_NO_DIALTONE = 0xC00A000D,
/// A busy signal was detected at a remote site on callback.
CTX_MODEM_RESPONSE_BUSY = 0xC00A000E,
/// A voice was detected at a remote site on callback.
CTX_MODEM_RESPONSE_VOICE = 0xC00A000F,
/// Transport driver error.
CTX_TD_ERROR = 0xC00A0010,
/// The client you are using is not licensed to use this system. Your logon request is denied.
CTX_LICENSE_CLIENT_INVALID = 0xC00A0012,
/// The system has reached its licensed logon limit. Try again later.
CTX_LICENSE_NOT_AVAILABLE = 0xC00A0013,
/// The system license has expired. Your logon request is denied.
CTX_LICENSE_EXPIRED = 0xC00A0014,
/// The specified session cannot be found.
CTX_WINSTATION_NOT_FOUND = 0xC00A0015,
/// The specified session name is already in use.
CTX_WINSTATION_NAME_COLLISION = 0xC00A0016,
/// The requested operation cannot be completed because the terminal connection is currently processing a connect, disconnect, reset, or delete operation.
CTX_WINSTATION_BUSY = 0xC00A0017,
/// An attempt has been made to connect to a session whose video mode is not supported by the current client.
CTX_BAD_VIDEO_MODE = 0xC00A0018,
/// The application attempted to enable DOS graphics mode. DOS graphics mode is not supported.
CTX_GRAPHICS_INVALID = 0xC00A0022,
/// The requested operation can be performed only on the system console.
/// This is most often the result of a driver or system DLL requiring direct console access.
CTX_NOT_CONSOLE = 0xC00A0024,
/// The client failed to respond to the server connect message.
CTX_CLIENT_QUERY_TIMEOUT = 0xC00A0026,
/// Disconnecting the console session is not supported.
CTX_CONSOLE_DISCONNECT = 0xC00A0027,
/// Reconnecting a disconnected session to the console is not supported.
CTX_CONSOLE_CONNECT = 0xC00A0028,
/// The request to control another session remotely was denied.
CTX_SHADOW_DENIED = 0xC00A002A,
/// A process has requested access to a session, but has not been granted those access rights.
CTX_WINSTATION_ACCESS_DENIED = 0xC00A002B,
/// The terminal connection driver %1 is invalid.
CTX_INVALID_WD = 0xC00A002E,
/// The terminal connection driver %1 was not found in the system path.
CTX_WD_NOT_FOUND = 0xC00A002F,
/// The requested session cannot be controlled remotely.
/// You cannot control your own session, a session that is trying to control your session, a session that has no user logged on, or other sessions from the console.
CTX_SHADOW_INVALID = 0xC00A0030,
/// The requested session is not configured to allow remote control.
CTX_SHADOW_DISABLED = 0xC00A0031,
/// The RDP protocol component %2 detected an error in the protocol stream and has disconnected the client.
RDP_PROTOCOL_ERROR = 0xC00A0032,
/// Your request to connect to this terminal server has been rejected.
/// Your terminal server client license number has not been entered for this copy of the terminal client.
/// Contact your system administrator for help in entering a valid, unique license number for this terminal server client. Click OK to continue.
CTX_CLIENT_LICENSE_NOT_SET = 0xC00A0033,
/// Your request to connect to this terminal server has been rejected.
/// Your terminal server client license number is currently being used by another user.
/// Contact your system administrator to obtain a new copy of the terminal server client with a valid, unique license number. Click OK to continue.
CTX_CLIENT_LICENSE_IN_USE = 0xC00A0034,
/// The remote control of the console was terminated because the display mode was changed.
/// Changing the display mode in a remote control session is not supported.
CTX_SHADOW_ENDED_BY_MODE_CHANGE = 0xC00A0035,
/// Remote control could not be terminated because the specified session is not currently being remotely controlled.
CTX_SHADOW_NOT_RUNNING = 0xC00A0036,
/// Your interactive logon privilege has been disabled. Contact your system administrator.
CTX_LOGON_DISABLED = 0xC00A0037,
/// The terminal server security layer detected an error in the protocol stream and has disconnected the client.
CTX_SECURITY_LAYER_ERROR = 0xC00A0038,
/// The target session is incompatible with the current session.
TS_INCOMPATIBLE_SESSIONS = 0xC00A0039,
/// The resource loader failed to find an MUI file.
MUI_FILE_NOT_FOUND = 0xC00B0001,
/// The resource loader failed to load an MUI file because the file failed to pass validation.
MUI_INVALID_FILE = 0xC00B0002,
/// The RC manifest is corrupted with garbage data, is an unsupported version, or is missing a required item.
MUI_INVALID_RC_CONFIG = 0xC00B0003,
/// The RC manifest has an invalid culture name.
MUI_INVALID_LOCALE_NAME = 0xC00B0004,
/// The RC manifest has and invalid ultimate fallback name.
MUI_INVALID_ULTIMATEFALLBACK_NAME = 0xC00B0005,
/// The resource loader cache does not have a loaded MUI entry.
MUI_FILE_NOT_LOADED = 0xC00B0006,
/// The user stopped resource enumeration.
RESOURCE_ENUM_USER_STOP = 0xC00B0007,
/// The cluster node is not valid.
CLUSTER_INVALID_NODE = 0xC0130001,
/// The cluster node already exists.
CLUSTER_NODE_EXISTS = 0xC0130002,
/// A node is in the process of joining the cluster.
CLUSTER_JOIN_IN_PROGRESS = 0xC0130003,
/// The cluster node was not found.
CLUSTER_NODE_NOT_FOUND = 0xC0130004,
/// The cluster local node information was not found.
CLUSTER_LOCAL_NODE_NOT_FOUND = 0xC0130005,
/// The cluster network already exists.
CLUSTER_NETWORK_EXISTS = 0xC0130006,
/// The cluster network was not found.
CLUSTER_NETWORK_NOT_FOUND = 0xC0130007,
/// The cluster network interface already exists.
CLUSTER_NETINTERFACE_EXISTS = 0xC0130008,
/// The cluster network interface was not found.
CLUSTER_NETINTERFACE_NOT_FOUND = 0xC0130009,
/// The cluster request is not valid for this object.
CLUSTER_INVALID_REQUEST = 0xC013000A,
/// The cluster network provider is not valid.
CLUSTER_INVALID_NETWORK_PROVIDER = 0xC013000B,
/// The cluster node is down.
CLUSTER_NODE_DOWN = 0xC013000C,
/// The cluster node is not reachable.
CLUSTER_NODE_UNREACHABLE = 0xC013000D,
/// The cluster node is not a member of the cluster.
CLUSTER_NODE_NOT_MEMBER = 0xC013000E,
/// A cluster join operation is not in progress.
CLUSTER_JOIN_NOT_IN_PROGRESS = 0xC013000F,
/// The cluster network is not valid.
CLUSTER_INVALID_NETWORK = 0xC0130010,
/// No network adapters are available.
CLUSTER_NO_NET_ADAPTERS = 0xC0130011,
/// The cluster node is up.
CLUSTER_NODE_UP = 0xC0130012,
/// The cluster node is paused.
CLUSTER_NODE_PAUSED = 0xC0130013,
/// The cluster node is not paused.
CLUSTER_NODE_NOT_PAUSED = 0xC0130014,
/// No cluster security context is available.
CLUSTER_NO_SECURITY_CONTEXT = 0xC0130015,
/// The cluster network is not configured for internal cluster communication.
CLUSTER_NETWORK_NOT_INTERNAL = 0xC0130016,
/// The cluster node has been poisoned.
CLUSTER_POISONED = 0xC0130017,
/// An attempt was made to run an invalid AML opcode.
ACPI_INVALID_OPCODE = 0xC0140001,
/// The AML interpreter stack has overflowed.
ACPI_STACK_OVERFLOW = 0xC0140002,
/// An inconsistent state has occurred.
ACPI_ASSERT_FAILED = 0xC0140003,
/// An attempt was made to access an array outside its bounds.
ACPI_INVALID_INDEX = 0xC0140004,
/// A required argument was not specified.
ACPI_INVALID_ARGUMENT = 0xC0140005,
/// A fatal error has occurred.
ACPI_FATAL = 0xC0140006,
/// An invalid SuperName was specified.
ACPI_INVALID_SUPERNAME = 0xC0140007,
/// An argument with an incorrect type was specified.
ACPI_INVALID_ARGTYPE = 0xC0140008,
/// An object with an incorrect type was specified.
ACPI_INVALID_OBJTYPE = 0xC0140009,
/// A target with an incorrect type was specified.
ACPI_INVALID_TARGETTYPE = 0xC014000A,
/// An incorrect number of arguments was specified.
ACPI_INCORRECT_ARGUMENT_COUNT = 0xC014000B,
/// An address failed to translate.
ACPI_ADDRESS_NOT_MAPPED = 0xC014000C,
/// An incorrect event type was specified.
ACPI_INVALID_EVENTTYPE = 0xC014000D,
/// A handler for the target already exists.
ACPI_HANDLER_COLLISION = 0xC014000E,
/// Invalid data for the target was specified.
ACPI_INVALID_DATA = 0xC014000F,
/// An invalid region for the target was specified.
ACPI_INVALID_REGION = 0xC0140010,
/// An attempt was made to access a field outside the defined range.
ACPI_INVALID_ACCESS_SIZE = 0xC0140011,
/// The global system lock could not be acquired.
ACPI_ACQUIRE_GLOBAL_LOCK = 0xC0140012,
/// An attempt was made to reinitialize the ACPI subsystem.
ACPI_ALREADY_INITIALIZED = 0xC0140013,
/// The ACPI subsystem has not been initialized.
ACPI_NOT_INITIALIZED = 0xC0140014,
/// An incorrect mutex was specified.
ACPI_INVALID_MUTEX_LEVEL = 0xC0140015,
/// The mutex is not currently owned.
ACPI_MUTEX_NOT_OWNED = 0xC0140016,
/// An attempt was made to access the mutex by a process that was not the owner.
ACPI_MUTEX_NOT_OWNER = 0xC0140017,
/// An error occurred during an access to region space.
ACPI_RS_ACCESS = 0xC0140018,
/// An attempt was made to use an incorrect table.
ACPI_INVALID_TABLE = 0xC0140019,
/// The registration of an ACPI event failed.
ACPI_REG_HANDLER_FAILED = 0xC0140020,
/// An ACPI power object failed to transition state.
ACPI_POWER_REQUEST_FAILED = 0xC0140021,
/// The requested section is not present in the activation context.
SXS_SECTION_NOT_FOUND = 0xC0150001,
/// Windows was unble to process the application binding information.
/// Refer to the system event log for further information.
SXS_CANT_GEN_ACTCTX = 0xC0150002,
/// The application binding data format is invalid.
SXS_INVALID_ACTCTXDATA_FORMAT = 0xC0150003,
/// The referenced assembly is not installed on the system.
SXS_ASSEMBLY_NOT_FOUND = 0xC0150004,
/// The manifest file does not begin with the required tag and format information.
SXS_MANIFEST_FORMAT_ERROR = 0xC0150005,
/// The manifest file contains one or more syntax errors.
SXS_MANIFEST_PARSE_ERROR = 0xC0150006,
/// The application attempted to activate a disabled activation context.
SXS_ACTIVATION_CONTEXT_DISABLED = 0xC0150007,
/// The requested lookup key was not found in any active activation context.
SXS_KEY_NOT_FOUND = 0xC0150008,
/// A component version required by the application conflicts with another component version that is already active.
SXS_VERSION_CONFLICT = 0xC0150009,
/// The type requested activation context section does not match the query API used.
SXS_WRONG_SECTION_TYPE = 0xC015000A,
/// Lack of system resources has required isolated activation to be disabled for the current thread of execution.
SXS_THREAD_QUERIES_DISABLED = 0xC015000B,
/// The referenced assembly could not be found.
SXS_ASSEMBLY_MISSING = 0xC015000C,
/// An attempt to set the process default activation context failed because the process default activation context was already set.
SXS_PROCESS_DEFAULT_ALREADY_SET = 0xC015000E,
/// The activation context being deactivated is not the most recently activated one.
SXS_EARLY_DEACTIVATION = 0xC015000F,
/// The activation context being deactivated is not active for the current thread of execution.
SXS_INVALID_DEACTIVATION = 0xC0150010,
/// The activation context being deactivated has already been deactivated.
SXS_MULTIPLE_DEACTIVATION = 0xC0150011,
/// The activation context of the system default assembly could not be generated.
SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY = 0xC0150012,
/// A component used by the isolation facility has requested that the process be terminated.
SXS_PROCESS_TERMINATION_REQUESTED = 0xC0150013,
/// The activation context activation stack for the running thread of execution is corrupt.
SXS_CORRUPT_ACTIVATION_STACK = 0xC0150014,
/// The application isolation metadata for this process or thread has become corrupt.
SXS_CORRUPTION = 0xC0150015,
/// The value of an attribute in an identity is not within the legal range.
SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE = 0xC0150016,
/// The name of an attribute in an identity is not within the legal range.
SXS_INVALID_IDENTITY_ATTRIBUTE_NAME = 0xC0150017,
/// An identity contains two definitions for the same attribute.
SXS_IDENTITY_DUPLICATE_ATTRIBUTE = 0xC0150018,
/// The identity string is malformed.
/// This might be due to a trailing comma, more than two unnamed attributes, a missing attribute name, or a missing attribute value.
SXS_IDENTITY_PARSE_ERROR = 0xC0150019,
/// The component store has become corrupted.
SXS_COMPONENT_STORE_CORRUPT = 0xC015001A,
/// A component's file does not match the verification information present in the component manifest.
SXS_FILE_HASH_MISMATCH = 0xC015001B,
/// The identities of the manifests are identical, but their contents are different.
SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT = 0xC015001C,
/// The component identities are different.
SXS_IDENTITIES_DIFFERENT = 0xC015001D,
/// The assembly is not a deployment.
SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT = 0xC015001E,
/// The file is not a part of the assembly.
SXS_FILE_NOT_PART_OF_ASSEMBLY = 0xC015001F,
/// An advanced installer failed during setup or servicing.
ADVANCED_INSTALLER_FAILED = 0xC0150020,
/// The character encoding in the XML declaration did not match the encoding used in the document.
XML_ENCODING_MISMATCH = 0xC0150021,
/// The size of the manifest exceeds the maximum allowed.
SXS_MANIFEST_TOO_BIG = 0xC0150022,
/// The setting is not registered.
SXS_SETTING_NOT_REGISTERED = 0xC0150023,
/// One or more required transaction members are not present.
SXS_TRANSACTION_CLOSURE_INCOMPLETE = 0xC0150024,
/// The SMI primitive installer failed during setup or servicing.
SMI_PRIMITIVE_INSTALLER_FAILED = 0xC0150025,
/// A generic command executable returned a result that indicates failure.
GENERIC_COMMAND_FAILED = 0xC0150026,
/// A component is missing file verification information in its manifest.
SXS_FILE_HASH_MISSING = 0xC0150027,
/// The function attempted to use a name that is reserved for use by another transaction.
TRANSACTIONAL_CONFLICT = 0xC0190001,
/// The transaction handle associated with this operation is invalid.
INVALID_TRANSACTION = 0xC0190002,
/// The requested operation was made in the context of a transaction that is no longer active.
TRANSACTION_NOT_ACTIVE = 0xC0190003,
/// The transaction manager was unable to be successfully initialized. Transacted operations are not supported.
TM_INITIALIZATION_FAILED = 0xC0190004,
/// Transaction support within the specified file system resource manager was not started or was shut down due to an error.
RM_NOT_ACTIVE = 0xC0190005,
/// The metadata of the resource manager has been corrupted. The resource manager will not function.
RM_METADATA_CORRUPT = 0xC0190006,
/// The resource manager attempted to prepare a transaction that it has not successfully joined.
TRANSACTION_NOT_JOINED = 0xC0190007,
/// The specified directory does not contain a file system resource manager.
DIRECTORY_NOT_RM = 0xC0190008,
/// The remote server or share does not support transacted file operations.
TRANSACTIONS_UNSUPPORTED_REMOTE = 0xC019000A,
/// The requested log size for the file system resource manager is invalid.
LOG_RESIZE_INVALID_SIZE = 0xC019000B,
/// The remote server sent mismatching version number or Fid for a file opened with transactions.
REMOTE_FILE_VERSION_MISMATCH = 0xC019000C,
/// The resource manager tried to register a protocol that already exists.
CRM_PROTOCOL_ALREADY_EXISTS = 0xC019000F,
/// The attempt to propagate the transaction failed.
TRANSACTION_PROPAGATION_FAILED = 0xC0190010,
/// The requested propagation protocol was not registered as a CRM.
CRM_PROTOCOL_NOT_FOUND = 0xC0190011,
/// The transaction object already has a superior enlistment, and the caller attempted an operation that would have created a new superior. Only a single superior enlistment is allowed.
TRANSACTION_SUPERIOR_EXISTS = 0xC0190012,
/// The requested operation is not valid on the transaction object in its current state.
TRANSACTION_REQUEST_NOT_VALID = 0xC0190013,
/// The caller has called a response API, but the response is not expected because the transaction manager did not issue the corresponding request to the caller.
TRANSACTION_NOT_REQUESTED = 0xC0190014,
/// It is too late to perform the requested operation, because the transaction has already been aborted.
TRANSACTION_ALREADY_ABORTED = 0xC0190015,
/// It is too late to perform the requested operation, because the transaction has already been committed.
TRANSACTION_ALREADY_COMMITTED = 0xC0190016,
/// The buffer passed in to NtPushTransaction or NtPullTransaction is not in a valid format.
TRANSACTION_INVALID_MARSHALL_BUFFER = 0xC0190017,
/// The current transaction context associated with the thread is not a valid handle to a transaction object.
CURRENT_TRANSACTION_NOT_VALID = 0xC0190018,
/// An attempt to create space in the transactional resource manager's log failed.
/// The failure status has been recorded in the event log.
LOG_GROWTH_FAILED = 0xC0190019,
/// The object (file, stream, or link) that corresponds to the handle has been deleted by a transaction savepoint rollback.
OBJECT_NO_LONGER_EXISTS = 0xC0190021,
/// The specified file miniversion was not found for this transacted file open.
STREAM_MINIVERSION_NOT_FOUND = 0xC0190022,
/// The specified file miniversion was found but has been invalidated.
/// The most likely cause is a transaction savepoint rollback.
STREAM_MINIVERSION_NOT_VALID = 0xC0190023,
/// A miniversion can be opened only in the context of the transaction that created it.
MINIVERSION_INACCESSIBLE_FROM_SPECIFIED_TRANSACTION = 0xC0190024,
/// It is not possible to open a miniversion with modify access.
CANT_OPEN_MINIVERSION_WITH_MODIFY_INTENT = 0xC0190025,
/// It is not possible to create any more miniversions for this stream.
CANT_CREATE_MORE_STREAM_MINIVERSIONS = 0xC0190026,
/// The handle has been invalidated by a transaction.
/// The most likely cause is the presence of memory mapping on a file or an open handle when the transaction ended or rolled back to savepoint.
HANDLE_NO_LONGER_VALID = 0xC0190028,
/// The log data is corrupt.
LOG_CORRUPTION_DETECTED = 0xC0190030,
/// The transaction outcome is unavailable because the resource manager responsible for it is disconnected.
RM_DISCONNECTED = 0xC0190032,
/// The request was rejected because the enlistment in question is not a superior enlistment.
ENLISTMENT_NOT_SUPERIOR = 0xC0190033,
/// The file cannot be opened in a transaction because its identity depends on the outcome of an unresolved transaction.
FILE_IDENTITY_NOT_PERSISTENT = 0xC0190036,
/// The operation cannot be performed because another transaction is depending on this property not changing.
CANT_BREAK_TRANSACTIONAL_DEPENDENCY = 0xC0190037,
/// The operation would involve a single file with two transactional resource managers and is, therefore, not allowed.
CANT_CROSS_RM_BOUNDARY = 0xC0190038,
/// The $Txf directory must be empty for this operation to succeed.
TXF_DIR_NOT_EMPTY = 0xC0190039,
/// The operation would leave a transactional resource manager in an inconsistent state and is therefore not allowed.
INDOUBT_TRANSACTIONS_EXIST = 0xC019003A,
/// The operation could not be completed because the transaction manager does not have a log.
TM_VOLATILE = 0xC019003B,
/// A rollback could not be scheduled because a previously scheduled rollback has already executed or been queued for execution.
ROLLBACK_TIMER_EXPIRED = 0xC019003C,
/// The transactional metadata attribute on the file or directory %hs is corrupt and unreadable.
TXF_ATTRIBUTE_CORRUPT = 0xC019003D,
/// The encryption operation could not be completed because a transaction is active.
EFS_NOT_ALLOWED_IN_TRANSACTION = 0xC019003E,
/// This object is not allowed to be opened in a transaction.
TRANSACTIONAL_OPEN_NOT_ALLOWED = 0xC019003F,
/// Memory mapping (creating a mapped section) a remote file under a transaction is not supported.
TRANSACTED_MAPPING_UNSUPPORTED_REMOTE = 0xC0190040,
/// Promotion was required to allow the resource manager to enlist, but the transaction was set to disallow it.
TRANSACTION_REQUIRED_PROMOTION = 0xC0190043,
/// This file is open for modification in an unresolved transaction and can be opened for execute only by a transacted reader.
CANNOT_EXECUTE_FILE_IN_TRANSACTION = 0xC0190044,
/// The request to thaw frozen transactions was ignored because transactions were not previously frozen.
TRANSACTIONS_NOT_FROZEN = 0xC0190045,
/// Transactions cannot be frozen because a freeze is already in progress.
TRANSACTION_FREEZE_IN_PROGRESS = 0xC0190046,
/// The target volume is not a snapshot volume.
/// This operation is valid only on a volume mounted as a snapshot.
NOT_SNAPSHOT_VOLUME = 0xC0190047,
/// The savepoint operation failed because files are open on the transaction, which is not permitted.
NO_SAVEPOINT_WITH_OPEN_FILES = 0xC0190048,
/// The sparse operation could not be completed because a transaction is active on the file.
SPARSE_NOT_ALLOWED_IN_TRANSACTION = 0xC0190049,
/// The call to create a transaction manager object failed because the Tm Identity that is stored in the log file does not match the Tm Identity that was passed in as an argument.
TM_IDENTITY_MISMATCH = 0xC019004A,
/// I/O was attempted on a section object that has been floated as a result of a transaction ending. There is no valid data.
FLOATED_SECTION = 0xC019004B,
/// The transactional resource manager cannot currently accept transacted work due to a transient condition, such as low resources.
CANNOT_ACCEPT_TRANSACTED_WORK = 0xC019004C,
/// The transactional resource manager had too many transactions outstanding that could not be aborted.
/// The transactional resource manager has been shut down.
CANNOT_ABORT_TRANSACTIONS = 0xC019004D,
/// The specified transaction was unable to be opened because it was not found.
TRANSACTION_NOT_FOUND = 0xC019004E,
/// The specified resource manager was unable to be opened because it was not found.
RESOURCEMANAGER_NOT_FOUND = 0xC019004F,
/// The specified enlistment was unable to be opened because it was not found.
ENLISTMENT_NOT_FOUND = 0xC0190050,
/// The specified transaction manager was unable to be opened because it was not found.
TRANSACTIONMANAGER_NOT_FOUND = 0xC0190051,
/// The specified resource manager was unable to create an enlistment because its associated transaction manager is not online.
TRANSACTIONMANAGER_NOT_ONLINE = 0xC0190052,
/// The specified transaction manager was unable to create the objects contained in its log file in the Ob namespace.
/// Therefore, the transaction manager was unable to recover.
TRANSACTIONMANAGER_RECOVERY_NAME_COLLISION = 0xC0190053,
/// The call to create a superior enlistment on this transaction object could not be completed because the transaction object specified for the enlistment is a subordinate branch of the transaction.
/// Only the root of the transaction can be enlisted as a superior.
TRANSACTION_NOT_ROOT = 0xC0190054,
/// Because the associated transaction manager or resource manager has been closed, the handle is no longer valid.
TRANSACTION_OBJECT_EXPIRED = 0xC0190055,
/// The compression operation could not be completed because a transaction is active on the file.
COMPRESSION_NOT_ALLOWED_IN_TRANSACTION = 0xC0190056,
/// The specified operation could not be performed on this superior enlistment because the enlistment was not created with the corresponding completion response in the NotificationMask.
TRANSACTION_RESPONSE_NOT_ENLISTED = 0xC0190057,
/// The specified operation could not be performed because the record to be logged was too long.
/// This can occur because either there are too many enlistments on this transaction or the combined RecoveryInformation being logged on behalf of those enlistments is too long.
TRANSACTION_RECORD_TOO_LONG = 0xC0190058,
/// The link-tracking operation could not be completed because a transaction is active.
NO_LINK_TRACKING_IN_TRANSACTION = 0xC0190059,
/// This operation cannot be performed in a transaction.
OPERATION_NOT_SUPPORTED_IN_TRANSACTION = 0xC019005A,
/// The kernel transaction manager had to abort or forget the transaction because it blocked forward progress.
TRANSACTION_INTEGRITY_VIOLATED = 0xC019005B,
/// The handle is no longer properly associated with its transaction.
/// It might have been opened in a transactional resource manager that was subsequently forced to restart. Please close the handle and open a new one.
EXPIRED_HANDLE = 0xC0190060,
/// The specified operation could not be performed because the resource manager is not enlisted in the transaction.
TRANSACTION_NOT_ENLISTED = 0xC0190061,
/// The log service found an invalid log sector.
LOG_SECTOR_INVALID = 0xC01A0001,
/// The log service encountered a log sector with invalid block parity.
LOG_SECTOR_PARITY_INVALID = 0xC01A0002,
/// The log service encountered a remapped log sector.
LOG_SECTOR_REMAPPED = 0xC01A0003,
/// The log service encountered a partial or incomplete log block.
LOG_BLOCK_INCOMPLETE = 0xC01A0004,
/// The log service encountered an attempt to access data outside the active log range.
LOG_INVALID_RANGE = 0xC01A0005,
/// The log service user-log marshaling buffers are exhausted.
LOG_BLOCKS_EXHAUSTED = 0xC01A0006,
/// The log service encountered an attempt to read from a marshaling area with an invalid read context.
LOG_READ_CONTEXT_INVALID = 0xC01A0007,
/// The log service encountered an invalid log restart area.
LOG_RESTART_INVALID = 0xC01A0008,
/// The log service encountered an invalid log block version.
LOG_BLOCK_VERSION = 0xC01A0009,
/// The log service encountered an invalid log block.
LOG_BLOCK_INVALID = 0xC01A000A,
/// The log service encountered an attempt to read the log with an invalid read mode.
LOG_READ_MODE_INVALID = 0xC01A000B,
/// The log service encountered a corrupted metadata file.
LOG_METADATA_CORRUPT = 0xC01A000D,
/// The log service encountered a metadata file that could not be created by the log file system.
LOG_METADATA_INVALID = 0xC01A000E,
/// The log service encountered a metadata file with inconsistent data.
LOG_METADATA_INCONSISTENT = 0xC01A000F,
/// The log service encountered an attempt to erroneously allocate or dispose reservation space.
LOG_RESERVATION_INVALID = 0xC01A0010,
/// The log service cannot delete the log file or the file system container.
LOG_CANT_DELETE = 0xC01A0011,
/// The log service has reached the maximum allowable containers allocated to a log file.
LOG_CONTAINER_LIMIT_EXCEEDED = 0xC01A0012,
/// The log service has attempted to read or write backward past the start of the log.
LOG_START_OF_LOG = 0xC01A0013,
/// The log policy could not be installed because a policy of the same type is already present.
LOG_POLICY_ALREADY_INSTALLED = 0xC01A0014,
/// The log policy in question was not installed at the time of the request.
LOG_POLICY_NOT_INSTALLED = 0xC01A0015,
/// The installed set of policies on the log is invalid.
LOG_POLICY_INVALID = 0xC01A0016,
/// A policy on the log in question prevented the operation from completing.
LOG_POLICY_CONFLICT = 0xC01A0017,
/// The log space cannot be reclaimed because the log is pinned by the archive tail.
LOG_PINNED_ARCHIVE_TAIL = 0xC01A0018,
/// The log record is not a record in the log file.
LOG_RECORD_NONEXISTENT = 0xC01A0019,
/// The number of reserved log records or the adjustment of the number of reserved log records is invalid.
LOG_RECORDS_RESERVED_INVALID = 0xC01A001A,
/// The reserved log space or the adjustment of the log space is invalid.
LOG_SPACE_RESERVED_INVALID = 0xC01A001B,
/// A new or existing archive tail or the base of the active log is invalid.
LOG_TAIL_INVALID = 0xC01A001C,
/// The log space is exhausted.
LOG_FULL = 0xC01A001D,
/// The log is multiplexed; no direct writes to the physical log are allowed.
LOG_MULTIPLEXED = 0xC01A001E,
/// The operation failed because the log is dedicated.
LOG_DEDICATED = 0xC01A001F,
/// The operation requires an archive context.
LOG_ARCHIVE_NOT_IN_PROGRESS = 0xC01A0020,
/// Log archival is in progress.
LOG_ARCHIVE_IN_PROGRESS = 0xC01A0021,
/// The operation requires a nonephemeral log, but the log is ephemeral.
LOG_EPHEMERAL = 0xC01A0022,
/// The log must have at least two containers before it can be read from or written to.
LOG_NOT_ENOUGH_CONTAINERS = 0xC01A0023,
/// A log client has already registered on the stream.
LOG_CLIENT_ALREADY_REGISTERED = 0xC01A0024,
/// A log client has not been registered on the stream.
LOG_CLIENT_NOT_REGISTERED = 0xC01A0025,
/// A request has already been made to handle the log full condition.
LOG_FULL_HANDLER_IN_PROGRESS = 0xC01A0026,
/// The log service encountered an error when attempting to read from a log container.
LOG_CONTAINER_READ_FAILED = 0xC01A0027,
/// The log service encountered an error when attempting to write to a log container.
LOG_CONTAINER_WRITE_FAILED = 0xC01A0028,
/// The log service encountered an error when attempting to open a log container.
LOG_CONTAINER_OPEN_FAILED = 0xC01A0029,
/// The log service encountered an invalid container state when attempting a requested action.
LOG_CONTAINER_STATE_INVALID = 0xC01A002A,
/// The log service is not in the correct state to perform a requested action.
LOG_STATE_INVALID = 0xC01A002B,
/// The log space cannot be reclaimed because the log is pinned.
LOG_PINNED = 0xC01A002C,
/// The log metadata flush failed.
LOG_METADATA_FLUSH_FAILED = 0xC01A002D,
/// Security on the log and its containers is inconsistent.
LOG_INCONSISTENT_SECURITY = 0xC01A002E,
/// Records were appended to the log or reservation changes were made, but the log could not be flushed.
LOG_APPENDED_FLUSH_FAILED = 0xC01A002F,
/// The log is pinned due to reservation consuming most of the log space.
/// Free some reserved records to make space available.
LOG_PINNED_RESERVATION = 0xC01A0030,
/// {Display Driver Stopped Responding} The %hs display driver has stopped working normally.
/// Save your work and reboot the system to restore full display functionality.
/// The next time you reboot the computer, a dialog box will allow you to upload data about this failure to Microsoft.
VIDEO_HUNG_DISPLAY_DRIVER_THREAD = 0xC01B00EA,
/// A handler was not defined by the filter for this operation.
FLT_NO_HANDLER_DEFINED = 0xC01C0001,
/// A context is already defined for this object.
FLT_CONTEXT_ALREADY_DEFINED = 0xC01C0002,
/// Asynchronous requests are not valid for this operation.
FLT_INVALID_ASYNCHRONOUS_REQUEST = 0xC01C0003,
/// This is an internal error code used by the filter manager to determine if a fast I/O operation should be forced down the input/output request packet (IRP) path. Minifilters should never return this value.
FLT_DISALLOW_FAST_IO = 0xC01C0004,
/// An invalid name request was made.
/// The name requested cannot be retrieved at this time.
FLT_INVALID_NAME_REQUEST = 0xC01C0005,
/// Posting this operation to a worker thread for further processing is not safe at this time because it could lead to a system deadlock.
FLT_NOT_SAFE_TO_POST_OPERATION = 0xC01C0006,
/// The Filter Manager was not initialized when a filter tried to register.
/// Make sure that the Filter Manager is loaded as a driver.
FLT_NOT_INITIALIZED = 0xC01C0007,
/// The filter is not ready for attachment to volumes because it has not finished initializing (FltStartFiltering has not been called).
FLT_FILTER_NOT_READY = 0xC01C0008,
/// The filter must clean up any operation-specific context at this time because it is being removed from the system before the operation is completed by the lower drivers.
FLT_POST_OPERATION_CLEANUP = 0xC01C0009,
/// The Filter Manager had an internal error from which it cannot recover; therefore, the operation has failed.
/// This is usually the result of a filter returning an invalid value from a pre-operation callback.
FLT_INTERNAL_ERROR = 0xC01C000A,
/// The object specified for this action is in the process of being deleted; therefore, the action requested cannot be completed at this time.
FLT_DELETING_OBJECT = 0xC01C000B,
/// A nonpaged pool must be used for this type of context.
FLT_MUST_BE_NONPAGED_POOL = 0xC01C000C,
/// A duplicate handler definition has been provided for an operation.
FLT_DUPLICATE_ENTRY = 0xC01C000D,
/// The callback data queue has been disabled.
FLT_CBDQ_DISABLED = 0xC01C000E,
/// Do not attach the filter to the volume at this time.
FLT_DO_NOT_ATTACH = 0xC01C000F,
/// Do not detach the filter from the volume at this time.
FLT_DO_NOT_DETACH = 0xC01C0010,
/// An instance already exists at this altitude on the volume specified.
FLT_INSTANCE_ALTITUDE_COLLISION = 0xC01C0011,
/// An instance already exists with this name on the volume specified.
FLT_INSTANCE_NAME_COLLISION = 0xC01C0012,
/// The system could not find the filter specified.
FLT_FILTER_NOT_FOUND = 0xC01C0013,
/// The system could not find the volume specified.
FLT_VOLUME_NOT_FOUND = 0xC01C0014,
/// The system could not find the instance specified.
FLT_INSTANCE_NOT_FOUND = 0xC01C0015,
/// No registered context allocation definition was found for the given request.
FLT_CONTEXT_ALLOCATION_NOT_FOUND = 0xC01C0016,
/// An invalid parameter was specified during context registration.
FLT_INVALID_CONTEXT_REGISTRATION = 0xC01C0017,
/// The name requested was not found in the Filter Manager name cache and could not be retrieved from the file system.
FLT_NAME_CACHE_MISS = 0xC01C0018,
/// The requested device object does not exist for the given volume.
FLT_NO_DEVICE_OBJECT = 0xC01C0019,
/// The specified volume is already mounted.
FLT_VOLUME_ALREADY_MOUNTED = 0xC01C001A,
/// The specified transaction context is already enlisted in a transaction.
FLT_ALREADY_ENLISTED = 0xC01C001B,
/// The specified context is already attached to another object.
FLT_CONTEXT_ALREADY_LINKED = 0xC01C001C,
/// No waiter is present for the filter's reply to this message.
FLT_NO_WAITER_FOR_REPLY = 0xC01C0020,
/// A monitor descriptor could not be obtained.
MONITOR_NO_DESCRIPTOR = 0xC01D0001,
/// This release does not support the format of the obtained monitor descriptor.
MONITOR_UNKNOWN_DESCRIPTOR_FORMAT = 0xC01D0002,
/// The checksum of the obtained monitor descriptor is invalid.
MONITOR_INVALID_DESCRIPTOR_CHECKSUM = 0xC01D0003,
/// The monitor descriptor contains an invalid standard timing block.
MONITOR_INVALID_STANDARD_TIMING_BLOCK = 0xC01D0004,
/// WMI data-block registration failed for one of the MSMonitorClass WMI subclasses.
MONITOR_WMI_DATABLOCK_REGISTRATION_FAILED = 0xC01D0005,
/// The provided monitor descriptor block is either corrupted or does not contain the monitor's detailed serial number.
MONITOR_INVALID_SERIAL_NUMBER_MONDSC_BLOCK = 0xC01D0006,
/// The provided monitor descriptor block is either corrupted or does not contain the monitor's user-friendly name.
MONITOR_INVALID_USER_FRIENDLY_MONDSC_BLOCK = 0xC01D0007,
/// There is no monitor descriptor data at the specified (offset or size) region.
MONITOR_NO_MORE_DESCRIPTOR_DATA = 0xC01D0008,
/// The monitor descriptor contains an invalid detailed timing block.
MONITOR_INVALID_DETAILED_TIMING_BLOCK = 0xC01D0009,
/// Monitor descriptor contains invalid manufacture date.
MONITOR_INVALID_MANUFACTURE_DATE = 0xC01D000A,
/// Exclusive mode ownership is needed to create an unmanaged primary allocation.
GRAPHICS_NOT_EXCLUSIVE_MODE_OWNER = 0xC01E0000,
/// The driver needs more DMA buffer space to complete the requested operation.
GRAPHICS_INSUFFICIENT_DMA_BUFFER = 0xC01E0001,
/// The specified display adapter handle is invalid.
GRAPHICS_INVALID_DISPLAY_ADAPTER = 0xC01E0002,
/// The specified display adapter and all of its state have been reset.
GRAPHICS_ADAPTER_WAS_RESET = 0xC01E0003,
/// The driver stack does not match the expected driver model.
GRAPHICS_INVALID_DRIVER_MODEL = 0xC01E0004,
/// Present happened but ended up into the changed desktop mode.
GRAPHICS_PRESENT_MODE_CHANGED = 0xC01E0005,
/// Nothing to present due to desktop occlusion.
GRAPHICS_PRESENT_OCCLUDED = 0xC01E0006,
/// Not able to present due to denial of desktop access.
GRAPHICS_PRESENT_DENIED = 0xC01E0007,
/// Not able to present with color conversion.
GRAPHICS_CANNOTCOLORCONVERT = 0xC01E0008,
/// Present redirection is disabled (desktop windowing management subsystem is off).
GRAPHICS_PRESENT_REDIRECTION_DISABLED = 0xC01E000B,
/// Previous exclusive VidPn source owner has released its ownership
GRAPHICS_PRESENT_UNOCCLUDED = 0xC01E000C,
/// Not enough video memory is available to complete the operation.
GRAPHICS_NO_VIDEO_MEMORY = 0xC01E0100,
/// Could not probe and lock the underlying memory of an allocation.
GRAPHICS_CANT_LOCK_MEMORY = 0xC01E0101,
/// The allocation is currently busy.
GRAPHICS_ALLOCATION_BUSY = 0xC01E0102,
/// An object being referenced has already reached the maximum reference count and cannot be referenced further.
GRAPHICS_TOO_MANY_REFERENCES = 0xC01E0103,
/// A problem could not be solved due to an existing condition. Try again later.
GRAPHICS_TRY_AGAIN_LATER = 0xC01E0104,
/// A problem could not be solved due to an existing condition. Try again now.
GRAPHICS_TRY_AGAIN_NOW = 0xC01E0105,
/// The allocation is invalid.
GRAPHICS_ALLOCATION_INVALID = 0xC01E0106,
/// No more unswizzling apertures are currently available.
GRAPHICS_UNSWIZZLING_APERTURE_UNAVAILABLE = 0xC01E0107,
/// The current allocation cannot be unswizzled by an aperture.
GRAPHICS_UNSWIZZLING_APERTURE_UNSUPPORTED = 0xC01E0108,
/// The request failed because a pinned allocation cannot be evicted.
GRAPHICS_CANT_EVICT_PINNED_ALLOCATION = 0xC01E0109,
/// The allocation cannot be used from its current segment location for the specified operation.
GRAPHICS_INVALID_ALLOCATION_USAGE = 0xC01E0110,
/// A locked allocation cannot be used in the current command buffer.
GRAPHICS_CANT_RENDER_LOCKED_ALLOCATION = 0xC01E0111,
/// The allocation being referenced has been closed permanently.
GRAPHICS_ALLOCATION_CLOSED = 0xC01E0112,
/// An invalid allocation instance is being referenced.
GRAPHICS_INVALID_ALLOCATION_INSTANCE = 0xC01E0113,
/// An invalid allocation handle is being referenced.
GRAPHICS_INVALID_ALLOCATION_HANDLE = 0xC01E0114,
/// The allocation being referenced does not belong to the current device.
GRAPHICS_WRONG_ALLOCATION_DEVICE = 0xC01E0115,
/// The specified allocation lost its content.
GRAPHICS_ALLOCATION_CONTENT_LOST = 0xC01E0116,
/// A GPU exception was detected on the given device. The device cannot be scheduled.
GRAPHICS_GPU_EXCEPTION_ON_DEVICE = 0xC01E0200,
/// The specified VidPN topology is invalid.
GRAPHICS_INVALID_VIDPN_TOPOLOGY = 0xC01E0300,
/// The specified VidPN topology is valid but is not supported by this model of the display adapter.
GRAPHICS_VIDPN_TOPOLOGY_NOT_SUPPORTED = 0xC01E0301,
/// The specified VidPN topology is valid but is not currently supported by the display adapter due to allocation of its resources.
GRAPHICS_VIDPN_TOPOLOGY_CURRENTLY_NOT_SUPPORTED = 0xC01E0302,
/// The specified VidPN handle is invalid.
GRAPHICS_INVALID_VIDPN = 0xC01E0303,
/// The specified video present source is invalid.
GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE = 0xC01E0304,
/// The specified video present target is invalid.
GRAPHICS_INVALID_VIDEO_PRESENT_TARGET = 0xC01E0305,
/// The specified VidPN modality is not supported (for example, at least two of the pinned modes are not co-functional).
GRAPHICS_VIDPN_MODALITY_NOT_SUPPORTED = 0xC01E0306,
/// The specified VidPN source mode set is invalid.
GRAPHICS_INVALID_VIDPN_SOURCEMODESET = 0xC01E0308,
/// The specified VidPN target mode set is invalid.
GRAPHICS_INVALID_VIDPN_TARGETMODESET = 0xC01E0309,
/// The specified video signal frequency is invalid.
GRAPHICS_INVALID_FREQUENCY = 0xC01E030A,
/// The specified video signal active region is invalid.
GRAPHICS_INVALID_ACTIVE_REGION = 0xC01E030B,
/// The specified video signal total region is invalid.
GRAPHICS_INVALID_TOTAL_REGION = 0xC01E030C,
/// The specified video present source mode is invalid.
GRAPHICS_INVALID_VIDEO_PRESENT_SOURCE_MODE = 0xC01E0310,
/// The specified video present target mode is invalid.
GRAPHICS_INVALID_VIDEO_PRESENT_TARGET_MODE = 0xC01E0311,
/// The pinned mode must remain in the set on the VidPN's co-functional modality enumeration.
GRAPHICS_PINNED_MODE_MUST_REMAIN_IN_SET = 0xC01E0312,
/// The specified video present path is already in the VidPN's topology.
GRAPHICS_PATH_ALREADY_IN_TOPOLOGY = 0xC01E0313,
/// The specified mode is already in the mode set.
GRAPHICS_MODE_ALREADY_IN_MODESET = 0xC01E0314,
/// The specified video present source set is invalid.
GRAPHICS_INVALID_VIDEOPRESENTSOURCESET = 0xC01E0315,
/// The specified video present target set is invalid.
GRAPHICS_INVALID_VIDEOPRESENTTARGETSET = 0xC01E0316,
/// The specified video present source is already in the video present source set.
GRAPHICS_SOURCE_ALREADY_IN_SET = 0xC01E0317,
/// The specified video present target is already in the video present target set.
GRAPHICS_TARGET_ALREADY_IN_SET = 0xC01E0318,
/// The specified VidPN present path is invalid.
GRAPHICS_INVALID_VIDPN_PRESENT_PATH = 0xC01E0319,
/// The miniport has no recommendation for augmenting the specified VidPN's topology.
GRAPHICS_NO_RECOMMENDED_VIDPN_TOPOLOGY = 0xC01E031A,
/// The specified monitor frequency range set is invalid.
GRAPHICS_INVALID_MONITOR_FREQUENCYRANGESET = 0xC01E031B,
/// The specified monitor frequency range is invalid.
GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE = 0xC01E031C,
/// The specified frequency range is not in the specified monitor frequency range set.
GRAPHICS_FREQUENCYRANGE_NOT_IN_SET = 0xC01E031D,
/// The specified frequency range is already in the specified monitor frequency range set.
GRAPHICS_FREQUENCYRANGE_ALREADY_IN_SET = 0xC01E031F,
/// The specified mode set is stale. Reacquire the new mode set.
GRAPHICS_STALE_MODESET = 0xC01E0320,
/// The specified monitor source mode set is invalid.
GRAPHICS_INVALID_MONITOR_SOURCEMODESET = 0xC01E0321,
/// The specified monitor source mode is invalid.
GRAPHICS_INVALID_MONITOR_SOURCE_MODE = 0xC01E0322,
/// The miniport does not have a recommendation regarding the request to provide a functional VidPN given the current display adapter configuration.
GRAPHICS_NO_RECOMMENDED_FUNCTIONAL_VIDPN = 0xC01E0323,
/// The ID of the specified mode is being used by another mode in the set.
GRAPHICS_MODE_ID_MUST_BE_UNIQUE = 0xC01E0324,
/// The system failed to determine a mode that is supported by both the display adapter and the monitor connected to it.
GRAPHICS_EMPTY_ADAPTER_MONITOR_MODE_SUPPORT_INTERSECTION = 0xC01E0325,
/// The number of video present targets must be greater than or equal to the number of video present sources.
GRAPHICS_VIDEO_PRESENT_TARGETS_LESS_THAN_SOURCES = 0xC01E0326,
/// The specified present path is not in the VidPN's topology.
GRAPHICS_PATH_NOT_IN_TOPOLOGY = 0xC01E0327,
/// The display adapter must have at least one video present source.
GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_SOURCE = 0xC01E0328,
/// The display adapter must have at least one video present target.
GRAPHICS_ADAPTER_MUST_HAVE_AT_LEAST_ONE_TARGET = 0xC01E0329,
/// The specified monitor descriptor set is invalid.
GRAPHICS_INVALID_MONITORDESCRIPTORSET = 0xC01E032A,
/// The specified monitor descriptor is invalid.
GRAPHICS_INVALID_MONITORDESCRIPTOR = 0xC01E032B,
/// The specified descriptor is not in the specified monitor descriptor set.
GRAPHICS_MONITORDESCRIPTOR_NOT_IN_SET = 0xC01E032C,
/// The specified descriptor is already in the specified monitor descriptor set.
GRAPHICS_MONITORDESCRIPTOR_ALREADY_IN_SET = 0xC01E032D,
/// The ID of the specified monitor descriptor is being used by another descriptor in the set.
GRAPHICS_MONITORDESCRIPTOR_ID_MUST_BE_UNIQUE = 0xC01E032E,
/// The specified video present target subset type is invalid.
GRAPHICS_INVALID_VIDPN_TARGET_SUBSET_TYPE = 0xC01E032F,
/// Two or more of the specified resources are not related to each other, as defined by the interface semantics.
GRAPHICS_RESOURCES_NOT_RELATED = 0xC01E0330,
/// The ID of the specified video present source is being used by another source in the set.
GRAPHICS_SOURCE_ID_MUST_BE_UNIQUE = 0xC01E0331,
/// The ID of the specified video present target is being used by another target in the set.
GRAPHICS_TARGET_ID_MUST_BE_UNIQUE = 0xC01E0332,
/// The specified VidPN source cannot be used because there is no available VidPN target to connect it to.
GRAPHICS_NO_AVAILABLE_VIDPN_TARGET = 0xC01E0333,
/// The newly arrived monitor could not be associated with a display adapter.
GRAPHICS_MONITOR_COULD_NOT_BE_ASSOCIATED_WITH_ADAPTER = 0xC01E0334,
/// The particular display adapter does not have an associated VidPN manager.
GRAPHICS_NO_VIDPNMGR = 0xC01E0335,
/// The VidPN manager of the particular display adapter does not have an active VidPN.
GRAPHICS_NO_ACTIVE_VIDPN = 0xC01E0336,
/// The specified VidPN topology is stale; obtain the new topology.
GRAPHICS_STALE_VIDPN_TOPOLOGY = 0xC01E0337,
/// No monitor is connected on the specified video present target.
GRAPHICS_MONITOR_NOT_CONNECTED = 0xC01E0338,
/// The specified source is not part of the specified VidPN's topology.
GRAPHICS_SOURCE_NOT_IN_TOPOLOGY = 0xC01E0339,
/// The specified primary surface size is invalid.
GRAPHICS_INVALID_PRIMARYSURFACE_SIZE = 0xC01E033A,
/// The specified visible region size is invalid.
GRAPHICS_INVALID_VISIBLEREGION_SIZE = 0xC01E033B,
/// The specified stride is invalid.
GRAPHICS_INVALID_STRIDE = 0xC01E033C,
/// The specified pixel format is invalid.
GRAPHICS_INVALID_PIXELFORMAT = 0xC01E033D,
/// The specified color basis is invalid.
GRAPHICS_INVALID_COLORBASIS = 0xC01E033E,
/// The specified pixel value access mode is invalid.
GRAPHICS_INVALID_PIXELVALUEACCESSMODE = 0xC01E033F,
/// The specified target is not part of the specified VidPN's topology.
GRAPHICS_TARGET_NOT_IN_TOPOLOGY = 0xC01E0340,
/// Failed to acquire the display mode management interface.
GRAPHICS_NO_DISPLAY_MODE_MANAGEMENT_SUPPORT = 0xC01E0341,
/// The specified VidPN source is already owned by a DMM client and cannot be used until that client releases it.
GRAPHICS_VIDPN_SOURCE_IN_USE = 0xC01E0342,
/// The specified VidPN is active and cannot be accessed.
GRAPHICS_CANT_ACCESS_ACTIVE_VIDPN = 0xC01E0343,
/// The specified VidPN's present path importance ordinal is invalid.
GRAPHICS_INVALID_PATH_IMPORTANCE_ORDINAL = 0xC01E0344,
/// The specified VidPN's present path content geometry transformation is invalid.
GRAPHICS_INVALID_PATH_CONTENT_GEOMETRY_TRANSFORMATION = 0xC01E0345,
/// The specified content geometry transformation is not supported on the respective VidPN present path.
GRAPHICS_PATH_CONTENT_GEOMETRY_TRANSFORMATION_NOT_SUPPORTED = 0xC01E0346,
/// The specified gamma ramp is invalid.
GRAPHICS_INVALID_GAMMA_RAMP = 0xC01E0347,
/// The specified gamma ramp is not supported on the respective VidPN present path.
GRAPHICS_GAMMA_RAMP_NOT_SUPPORTED = 0xC01E0348,
/// Multisampling is not supported on the respective VidPN present path.
GRAPHICS_MULTISAMPLING_NOT_SUPPORTED = 0xC01E0349,
/// The specified mode is not in the specified mode set.
GRAPHICS_MODE_NOT_IN_MODESET = 0xC01E034A,
/// The specified VidPN topology recommendation reason is invalid.
GRAPHICS_INVALID_VIDPN_TOPOLOGY_RECOMMENDATION_REASON = 0xC01E034D,
/// The specified VidPN present path content type is invalid.
GRAPHICS_INVALID_PATH_CONTENT_TYPE = 0xC01E034E,
/// The specified VidPN present path copy protection type is invalid.
GRAPHICS_INVALID_COPYPROTECTION_TYPE = 0xC01E034F,
/// Only one unassigned mode set can exist at any one time for a particular VidPN source or target.
GRAPHICS_UNASSIGNED_MODESET_ALREADY_EXISTS = 0xC01E0350,
/// The specified scan line ordering type is invalid.
GRAPHICS_INVALID_SCANLINE_ORDERING = 0xC01E0352,
/// The topology changes are not allowed for the specified VidPN.
GRAPHICS_TOPOLOGY_CHANGES_NOT_ALLOWED = 0xC01E0353,
/// All available importance ordinals are being used in the specified topology.
GRAPHICS_NO_AVAILABLE_IMPORTANCE_ORDINALS = 0xC01E0354,
/// The specified primary surface has a different private-format attribute than the current primary surface.
GRAPHICS_INCOMPATIBLE_PRIVATE_FORMAT = 0xC01E0355,
/// The specified mode-pruning algorithm is invalid.
GRAPHICS_INVALID_MODE_PRUNING_ALGORITHM = 0xC01E0356,
/// The specified monitor-capability origin is invalid.
GRAPHICS_INVALID_MONITOR_CAPABILITY_ORIGIN = 0xC01E0357,
/// The specified monitor-frequency range constraint is invalid.
GRAPHICS_INVALID_MONITOR_FREQUENCYRANGE_CONSTRAINT = 0xC01E0358,
/// The maximum supported number of present paths has been reached.
GRAPHICS_MAX_NUM_PATHS_REACHED = 0xC01E0359,
/// The miniport requested that augmentation be canceled for the specified source of the specified VidPN's topology.
GRAPHICS_CANCEL_VIDPN_TOPOLOGY_AUGMENTATION = 0xC01E035A,
/// The specified client type was not recognized.
GRAPHICS_INVALID_CLIENT_TYPE = 0xC01E035B,
/// The client VidPN is not set on this adapter (for example, no user mode-initiated mode changes have taken place on this adapter).
GRAPHICS_CLIENTVIDPN_NOT_SET = 0xC01E035C,
/// The specified display adapter child device already has an external device connected to it.
GRAPHICS_SPECIFIED_CHILD_ALREADY_CONNECTED = 0xC01E0400,
/// The display adapter child device does not support reporting a descriptor.
GRAPHICS_CHILD_DESCRIPTOR_NOT_SUPPORTED = 0xC01E0401,
/// The display adapter is not linked to any other adapters.
GRAPHICS_NOT_A_LINKED_ADAPTER = 0xC01E0430,
/// The lead adapter in a linked configuration was not enumerated yet.
GRAPHICS_LEADLINK_NOT_ENUMERATED = 0xC01E0431,
/// Some chain adapters in a linked configuration have not yet been enumerated.
GRAPHICS_CHAINLINKS_NOT_ENUMERATED = 0xC01E0432,
/// The chain of linked adapters is not ready to start because of an unknown failure.
GRAPHICS_ADAPTER_CHAIN_NOT_READY = 0xC01E0433,
/// An attempt was made to start a lead link display adapter when the chain links had not yet started.
GRAPHICS_CHAINLINKS_NOT_STARTED = 0xC01E0434,
/// An attempt was made to turn on a lead link display adapter when the chain links were turned off.
GRAPHICS_CHAINLINKS_NOT_POWERED_ON = 0xC01E0435,
/// The adapter link was found in an inconsistent state.
/// Not all adapters are in an expected PNP/power state.
GRAPHICS_INCONSISTENT_DEVICE_LINK_STATE = 0xC01E0436,
/// The driver trying to start is not the same as the driver for the posted display adapter.
GRAPHICS_NOT_POST_DEVICE_DRIVER = 0xC01E0438,
/// An operation is being attempted that requires the display adapter to be in a quiescent state.
GRAPHICS_ADAPTER_ACCESS_NOT_EXCLUDED = 0xC01E043B,
/// The driver does not support OPM.
GRAPHICS_OPM_NOT_SUPPORTED = 0xC01E0500,
/// The driver does not support COPP.
GRAPHICS_COPP_NOT_SUPPORTED = 0xC01E0501,
/// The driver does not support UAB.
GRAPHICS_UAB_NOT_SUPPORTED = 0xC01E0502,
/// The specified encrypted parameters are invalid.
GRAPHICS_OPM_INVALID_ENCRYPTED_PARAMETERS = 0xC01E0503,
/// An array passed to a function cannot hold all of the data that the function wants to put in it.
GRAPHICS_OPM_PARAMETER_ARRAY_TOO_SMALL = 0xC01E0504,
/// The GDI display device passed to this function does not have any active protected outputs.
GRAPHICS_OPM_NO_PROTECTED_OUTPUTS_EXIST = 0xC01E0505,
/// The PVP cannot find an actual GDI display device that corresponds to the passed-in GDI display device name.
GRAPHICS_PVP_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = 0xC01E0506,
/// This function failed because the GDI display device passed to it was not attached to the Windows desktop.
GRAPHICS_PVP_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = 0xC01E0507,
/// The PVP does not support mirroring display devices because they do not have any protected outputs.
GRAPHICS_PVP_MIRRORING_DEVICES_NOT_SUPPORTED = 0xC01E0508,
/// The function failed because an invalid pointer parameter was passed to it.
/// A pointer parameter is invalid if it is null, is not correctly aligned, or it points to an invalid address or a kernel mode address.
GRAPHICS_OPM_INVALID_POINTER = 0xC01E050A,
/// An internal error caused an operation to fail.
GRAPHICS_OPM_INTERNAL_ERROR = 0xC01E050B,
/// The function failed because the caller passed in an invalid OPM user-mode handle.
GRAPHICS_OPM_INVALID_HANDLE = 0xC01E050C,
/// This function failed because the GDI device passed to it did not have any monitors associated with it.
GRAPHICS_PVP_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = 0xC01E050D,
/// A certificate could not be returned because the certificate buffer passed to the function was too small.
GRAPHICS_PVP_INVALID_CERTIFICATE_LENGTH = 0xC01E050E,
/// DxgkDdiOpmCreateProtectedOutput() could not create a protected output because the video present yarget is in spanning mode.
GRAPHICS_OPM_SPANNING_MODE_ENABLED = 0xC01E050F,
/// DxgkDdiOpmCreateProtectedOutput() could not create a protected output because the video present target is in theater mode.
GRAPHICS_OPM_THEATER_MODE_ENABLED = 0xC01E0510,
/// The function call failed because the display adapter's hardware functionality scan (HFS) failed to validate the graphics hardware.
GRAPHICS_PVP_HFS_FAILED = 0xC01E0511,
/// The HDCP SRM passed to this function did not comply with section 5 of the HDCP 1.1 specification.
GRAPHICS_OPM_INVALID_SRM = 0xC01E0512,
/// The protected output cannot enable the HDCP system because it does not support it.
GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_HDCP = 0xC01E0513,
/// The protected output cannot enable analog copy protection because it does not support it.
GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_ACP = 0xC01E0514,
/// The protected output cannot enable the CGMS-A protection technology because it does not support it.
GRAPHICS_OPM_OUTPUT_DOES_NOT_SUPPORT_CGMSA = 0xC01E0515,
/// DxgkDdiOPMGetInformation() cannot return the version of the SRM being used because the application never successfully passed an SRM to the protected output.
GRAPHICS_OPM_HDCP_SRM_NEVER_SET = 0xC01E0516,
/// DxgkDdiOPMConfigureProtectedOutput() cannot enable the specified output protection technology because the output's screen resolution is too high.
GRAPHICS_OPM_RESOLUTION_TOO_HIGH = 0xC01E0517,
/// DxgkDdiOPMConfigureProtectedOutput() cannot enable HDCP because other physical outputs are using the display adapter's HDCP hardware.
GRAPHICS_OPM_ALL_HDCP_HARDWARE_ALREADY_IN_USE = 0xC01E0518,
/// The operating system asynchronously destroyed this OPM-protected output because the operating system state changed.
/// This error typically occurs because the monitor PDO associated with this protected output was removed or stopped, the protected output's session became a nonconsole session, or the protected output's desktop became inactive.
GRAPHICS_OPM_PROTECTED_OUTPUT_NO_LONGER_EXISTS = 0xC01E051A,
/// OPM functions cannot be called when a session is changing its type.
/// Three types of sessions currently exist: console, disconnected, and remote (RDP or ICA).
GRAPHICS_OPM_SESSION_TYPE_CHANGE_IN_PROGRESS = 0xC01E051B,
/// The DxgkDdiOPMGetCOPPCompatibleInformation, DxgkDdiOPMGetInformation, or DxgkDdiOPMConfigureProtectedOutput function failed.
/// This error is returned only if a protected output has OPM semantics.
/// DxgkDdiOPMGetCOPPCompatibleInformation always returns this error if a protected output has OPM semantics.
/// DxgkDdiOPMGetInformation returns this error code if the caller requested COPP-specific information.
/// DxgkDdiOPMConfigureProtectedOutput returns this error when the caller tries to use a COPP-specific command.
GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_COPP_SEMANTICS = 0xC01E051C,
/// The DxgkDdiOPMGetInformation and DxgkDdiOPMGetCOPPCompatibleInformation functions return this error code if the passed-in sequence number is not the expected sequence number or the passed-in OMAC value is invalid.
GRAPHICS_OPM_INVALID_INFORMATION_REQUEST = 0xC01E051D,
/// The function failed because an unexpected error occurred inside a display driver.
GRAPHICS_OPM_DRIVER_INTERNAL_ERROR = 0xC01E051E,
/// The DxgkDdiOPMGetCOPPCompatibleInformation, DxgkDdiOPMGetInformation, or DxgkDdiOPMConfigureProtectedOutput function failed.
/// This error is returned only if a protected output has COPP semantics.
/// DxgkDdiOPMGetCOPPCompatibleInformation returns this error code if the caller requested OPM-specific information.
/// DxgkDdiOPMGetInformation always returns this error if a protected output has COPP semantics.
/// DxgkDdiOPMConfigureProtectedOutput returns this error when the caller tries to use an OPM-specific command.
GRAPHICS_OPM_PROTECTED_OUTPUT_DOES_NOT_HAVE_OPM_SEMANTICS = 0xC01E051F,
/// The DxgkDdiOPMGetCOPPCompatibleInformation and DxgkDdiOPMConfigureProtectedOutput functions return this error if the display driver does not support the DXGKMDT_OPM_GET_ACP_AND_CGMSA_SIGNALING and DXGKMDT_OPM_SET_ACP_AND_CGMSA_SIGNALING GUIDs.
GRAPHICS_OPM_SIGNALING_NOT_SUPPORTED = 0xC01E0520,
/// The DxgkDdiOPMConfigureProtectedOutput function returns this error code if the passed-in sequence number is not the expected sequence number or the passed-in OMAC value is invalid.
GRAPHICS_OPM_INVALID_CONFIGURATION_REQUEST = 0xC01E0521,
/// The monitor connected to the specified video output does not have an I2C bus.
GRAPHICS_I2C_NOT_SUPPORTED = 0xC01E0580,
/// No device on the I2C bus has the specified address.
GRAPHICS_I2C_DEVICE_DOES_NOT_EXIST = 0xC01E0581,
/// An error occurred while transmitting data to the device on the I2C bus.
GRAPHICS_I2C_ERROR_TRANSMITTING_DATA = 0xC01E0582,
/// An error occurred while receiving data from the device on the I2C bus.
GRAPHICS_I2C_ERROR_RECEIVING_DATA = 0xC01E0583,
/// The monitor does not support the specified VCP code.
GRAPHICS_DDCCI_VCP_NOT_SUPPORTED = 0xC01E0584,
/// The data received from the monitor is invalid.
GRAPHICS_DDCCI_INVALID_DATA = 0xC01E0585,
/// A function call failed because a monitor returned an invalid timing status byte when the operating system used the DDC/CI get timing report and timing message command to get a timing report from a monitor.
GRAPHICS_DDCCI_MONITOR_RETURNED_INVALID_TIMING_STATUS_BYTE = 0xC01E0586,
/// A monitor returned a DDC/CI capabilities string that did not comply with the ACCESS.bus 3.0, DDC/CI 1.1, or MCCS 2 Revision 1 specification.
GRAPHICS_DDCCI_INVALID_CAPABILITIES_STRING = 0xC01E0587,
/// An internal error caused an operation to fail.
GRAPHICS_MCA_INTERNAL_ERROR = 0xC01E0588,
/// An operation failed because a DDC/CI message had an invalid value in its command field.
GRAPHICS_DDCCI_INVALID_MESSAGE_COMMAND = 0xC01E0589,
/// This error occurred because a DDC/CI message had an invalid value in its length field.
GRAPHICS_DDCCI_INVALID_MESSAGE_LENGTH = 0xC01E058A,
/// This error occurred because the value in a DDC/CI message's checksum field did not match the message's computed checksum value.
/// This error implies that the data was corrupted while it was being transmitted from a monitor to a computer.
GRAPHICS_DDCCI_INVALID_MESSAGE_CHECKSUM = 0xC01E058B,
/// This function failed because an invalid monitor handle was passed to it.
GRAPHICS_INVALID_PHYSICAL_MONITOR_HANDLE = 0xC01E058C,
/// The operating system asynchronously destroyed the monitor that corresponds to this handle because the operating system's state changed.
/// This error typically occurs because the monitor PDO associated with this handle was removed or stopped, or a display mode change occurred.
/// A display mode change occurs when Windows sends a WM_DISPLAYCHANGE message to applications.
GRAPHICS_MONITOR_NO_LONGER_EXISTS = 0xC01E058D,
/// This function can be used only if a program is running in the local console session.
/// It cannot be used if a program is running on a remote desktop session or on a terminal server session.
GRAPHICS_ONLY_CONSOLE_SESSION_SUPPORTED = 0xC01E05E0,
/// This function cannot find an actual GDI display device that corresponds to the specified GDI display device name.
GRAPHICS_NO_DISPLAY_DEVICE_CORRESPONDS_TO_NAME = 0xC01E05E1,
/// The function failed because the specified GDI display device was not attached to the Windows desktop.
GRAPHICS_DISPLAY_DEVICE_NOT_ATTACHED_TO_DESKTOP = 0xC01E05E2,
/// This function does not support GDI mirroring display devices because GDI mirroring display devices do not have any physical monitors associated with them.
GRAPHICS_MIRRORING_DEVICES_NOT_SUPPORTED = 0xC01E05E3,
/// The function failed because an invalid pointer parameter was passed to it.
/// A pointer parameter is invalid if it is null, is not correctly aligned, or points to an invalid address or to a kernel mode address.
GRAPHICS_INVALID_POINTER = 0xC01E05E4,
/// This function failed because the GDI device passed to it did not have a monitor associated with it.
GRAPHICS_NO_MONITORS_CORRESPOND_TO_DISPLAY_DEVICE = 0xC01E05E5,
/// An array passed to the function cannot hold all of the data that the function must copy into the array.
GRAPHICS_PARAMETER_ARRAY_TOO_SMALL = 0xC01E05E6,
/// An internal error caused an operation to fail.
GRAPHICS_INTERNAL_ERROR = 0xC01E05E7,
/// The function failed because the current session is changing its type.
/// This function cannot be called when the current session is changing its type.
/// Three types of sessions currently exist: console, disconnected, and remote (RDP or ICA).
GRAPHICS_SESSION_TYPE_CHANGE_IN_PROGRESS = 0xC01E05E8,
/// The volume must be unlocked before it can be used.
FVE_LOCKED_VOLUME = 0xC0210000,
/// The volume is fully decrypted and no key is available.
FVE_NOT_ENCRYPTED = 0xC0210001,
/// The control block for the encrypted volume is not valid.
FVE_BAD_INFORMATION = 0xC0210002,
/// Not enough free space remains on the volume to allow encryption.
FVE_TOO_SMALL = 0xC0210003,
/// The partition cannot be encrypted because the file system is not supported.
FVE_FAILED_WRONG_FS = 0xC0210004,
/// The file system is inconsistent. Run the Check Disk utility.
FVE_FAILED_BAD_FS = 0xC0210005,
/// The file system does not extend to the end of the volume.
FVE_FS_NOT_EXTENDED = 0xC0210006,
/// This operation cannot be performed while a file system is mounted on the volume.
FVE_FS_MOUNTED = 0xC0210007,
/// BitLocker Drive Encryption is not included with this version of Windows.
FVE_NO_LICENSE = 0xC0210008,
/// The requested action was denied by the FVE control engine.
FVE_ACTION_NOT_ALLOWED = 0xC0210009,
/// The data supplied is malformed.
FVE_BAD_DATA = 0xC021000A,
/// The volume is not bound to the system.
FVE_VOLUME_NOT_BOUND = 0xC021000B,
/// The volume specified is not a data volume.
FVE_NOT_DATA_VOLUME = 0xC021000C,
/// A read operation failed while converting the volume.
FVE_CONV_READ_ERROR = 0xC021000D,
/// A write operation failed while converting the volume.
FVE_CONV_WRITE_ERROR = 0xC021000E,
/// The control block for the encrypted volume was updated by another thread. Try again.
FVE_OVERLAPPED_UPDATE = 0xC021000F,
/// The volume encryption algorithm cannot be used on this sector size.
FVE_FAILED_SECTOR_SIZE = 0xC0210010,
/// BitLocker recovery authentication failed.
FVE_FAILED_AUTHENTICATION = 0xC0210011,
/// The volume specified is not the boot operating system volume.
FVE_NOT_OS_VOLUME = 0xC0210012,
/// The BitLocker startup key or recovery password could not be read from external media.
FVE_KEYFILE_NOT_FOUND = 0xC0210013,
/// The BitLocker startup key or recovery password file is corrupt or invalid.
FVE_KEYFILE_INVALID = 0xC0210014,
/// The BitLocker encryption key could not be obtained from the startup key or the recovery password.
FVE_KEYFILE_NO_VMK = 0xC0210015,
/// The TPM is disabled.
FVE_TPM_DISABLED = 0xC0210016,
/// The authorization data for the SRK of the TPM is not zero.
FVE_TPM_SRK_AUTH_NOT_ZERO = 0xC0210017,
/// The system boot information changed or the TPM locked out access to BitLocker encryption keys until the computer is restarted.
FVE_TPM_INVALID_PCR = 0xC0210018,
/// The BitLocker encryption key could not be obtained from the TPM.
FVE_TPM_NO_VMK = 0xC0210019,
/// The BitLocker encryption key could not be obtained from the TPM and PIN.
FVE_PIN_INVALID = 0xC021001A,
/// A boot application hash does not match the hash computed when BitLocker was turned on.
FVE_AUTH_INVALID_APPLICATION = 0xC021001B,
/// The Boot Configuration Data (BCD) settings are not supported or have changed because BitLocker was enabled.
FVE_AUTH_INVALID_CONFIG = 0xC021001C,
/// Boot debugging is enabled. Run Windows Boot Configuration Data Store Editor (bcdedit.exe) to turn it off.
FVE_DEBUGGER_ENABLED = 0xC021001D,
/// The BitLocker encryption key could not be obtained.
FVE_DRY_RUN_FAILED = 0xC021001E,
/// The metadata disk region pointer is incorrect.
FVE_BAD_METADATA_POINTER = 0xC021001F,
/// The backup copy of the metadata is out of date.
FVE_OLD_METADATA_COPY = 0xC0210020,
/// No action was taken because a system restart is required.
FVE_REBOOT_REQUIRED = 0xC0210021,
/// No action was taken because BitLocker Drive Encryption is in RAW access mode.
FVE_RAW_ACCESS = 0xC0210022,
/// BitLocker Drive Encryption cannot enter RAW access mode for this volume.
FVE_RAW_BLOCKED = 0xC0210023,
/// This feature of BitLocker Drive Encryption is not included with this version of Windows.
FVE_NO_FEATURE_LICENSE = 0xC0210026,
/// Group policy does not permit turning off BitLocker Drive Encryption on roaming data volumes.
FVE_POLICY_USER_DISABLE_RDV_NOT_ALLOWED = 0xC0210027,
/// Bitlocker Drive Encryption failed to recover from aborted conversion.
/// This could be due to either all conversion logs being corrupted or the media being write-protected.
FVE_CONV_RECOVERY_FAILED = 0xC0210028,
/// The requested virtualization size is too big.
FVE_VIRTUALIZED_SPACE_TOO_BIG = 0xC0210029,
/// The drive is too small to be protected using BitLocker Drive Encryption.
FVE_VOLUME_TOO_SMALL = 0xC0210030,
/// The callout does not exist.
FWP_CALLOUT_NOT_FOUND = 0xC0220001,
/// The filter condition does not exist.
FWP_CONDITION_NOT_FOUND = 0xC0220002,
/// The filter does not exist.
FWP_FILTER_NOT_FOUND = 0xC0220003,
/// The layer does not exist.
FWP_LAYER_NOT_FOUND = 0xC0220004,
/// The provider does not exist.
FWP_PROVIDER_NOT_FOUND = 0xC0220005,
/// The provider context does not exist.
FWP_PROVIDER_CONTEXT_NOT_FOUND = 0xC0220006,
/// The sublayer does not exist.
FWP_SUBLAYER_NOT_FOUND = 0xC0220007,
/// The object does not exist.
FWP_NOT_FOUND = 0xC0220008,
/// An object with that GUID or LUID already exists.
FWP_ALREADY_EXISTS = 0xC0220009,
/// The object is referenced by other objects and cannot be deleted.
FWP_IN_USE = 0xC022000A,
/// The call is not allowed from within a dynamic session.
FWP_DYNAMIC_SESSION_IN_PROGRESS = 0xC022000B,
/// The call was made from the wrong session and cannot be completed.
FWP_WRONG_SESSION = 0xC022000C,
/// The call must be made from within an explicit transaction.
FWP_NO_TXN_IN_PROGRESS = 0xC022000D,
/// The call is not allowed from within an explicit transaction.
FWP_TXN_IN_PROGRESS = 0xC022000E,
/// The explicit transaction has been forcibly canceled.
FWP_TXN_ABORTED = 0xC022000F,
/// The session has been canceled.
FWP_SESSION_ABORTED = 0xC0220010,
/// The call is not allowed from within a read-only transaction.
FWP_INCOMPATIBLE_TXN = 0xC0220011,
/// The call timed out while waiting to acquire the transaction lock.
FWP_TIMEOUT = 0xC0220012,
/// The collection of network diagnostic events is disabled.
FWP_NET_EVENTS_DISABLED = 0xC0220013,
/// The operation is not supported by the specified layer.
FWP_INCOMPATIBLE_LAYER = 0xC0220014,
/// The call is allowed for kernel-mode callers only.
FWP_KM_CLIENTS_ONLY = 0xC0220015,
/// The call tried to associate two objects with incompatible lifetimes.
FWP_LIFETIME_MISMATCH = 0xC0220016,
/// The object is built-in and cannot be deleted.
FWP_BUILTIN_OBJECT = 0xC0220017,
/// The maximum number of callouts has been reached.
FWP_TOO_MANY_CALLOUTS = 0xC0220018,
/// A notification could not be delivered because a message queue has reached maximum capacity.
FWP_NOTIFICATION_DROPPED = 0xC0220019,
/// The traffic parameters do not match those for the security association context.
FWP_TRAFFIC_MISMATCH = 0xC022001A,
/// The call is not allowed for the current security association state.
FWP_INCOMPATIBLE_SA_STATE = 0xC022001B,
/// A required pointer is null.
FWP_NULL_POINTER = 0xC022001C,
/// An enumerator is not valid.
FWP_INVALID_ENUMERATOR = 0xC022001D,
/// The flags field contains an invalid value.
FWP_INVALID_FLAGS = 0xC022001E,
/// A network mask is not valid.
FWP_INVALID_NET_MASK = 0xC022001F,
/// An FWP_RANGE is not valid.
FWP_INVALID_RANGE = 0xC0220020,
/// The time interval is not valid.
FWP_INVALID_INTERVAL = 0xC0220021,
/// An array that must contain at least one element has a zero length.
FWP_ZERO_LENGTH_ARRAY = 0xC0220022,
/// The displayData.name field cannot be null.
FWP_NULL_DISPLAY_NAME = 0xC0220023,
/// The action type is not one of the allowed action types for a filter.
FWP_INVALID_ACTION_TYPE = 0xC0220024,
/// The filter weight is not valid.
FWP_INVALID_WEIGHT = 0xC0220025,
/// A filter condition contains a match type that is not compatible with the operands.
FWP_MATCH_TYPE_MISMATCH = 0xC0220026,
/// An FWP_VALUE or FWPM_CONDITION_VALUE is of the wrong type.
FWP_TYPE_MISMATCH = 0xC0220027,
/// An integer value is outside the allowed range.
FWP_OUT_OF_BOUNDS = 0xC0220028,
/// A reserved field is nonzero.
FWP_RESERVED = 0xC0220029,
/// A filter cannot contain multiple conditions operating on a single field.
FWP_DUPLICATE_CONDITION = 0xC022002A,
/// A policy cannot contain the same keying module more than once.
FWP_DUPLICATE_KEYMOD = 0xC022002B,
/// The action type is not compatible with the layer.
FWP_ACTION_INCOMPATIBLE_WITH_LAYER = 0xC022002C,
/// The action type is not compatible with the sublayer.
FWP_ACTION_INCOMPATIBLE_WITH_SUBLAYER = 0xC022002D,
/// The raw context or the provider context is not compatible with the layer.
FWP_CONTEXT_INCOMPATIBLE_WITH_LAYER = 0xC022002E,
/// The raw context or the provider context is not compatible with the callout.
FWP_CONTEXT_INCOMPATIBLE_WITH_CALLOUT = 0xC022002F,
/// The authentication method is not compatible with the policy type.
FWP_INCOMPATIBLE_AUTH_METHOD = 0xC0220030,
/// The Diffie-Hellman group is not compatible with the policy type.
FWP_INCOMPATIBLE_DH_GROUP = 0xC0220031,
/// An IKE policy cannot contain an Extended Mode policy.
FWP_EM_NOT_SUPPORTED = 0xC0220032,
/// The enumeration template or subscription will never match any objects.
FWP_NEVER_MATCH = 0xC0220033,
/// The provider context is of the wrong type.
FWP_PROVIDER_CONTEXT_MISMATCH = 0xC0220034,
/// The parameter is incorrect.
FWP_INVALID_PARAMETER = 0xC0220035,
/// The maximum number of sublayers has been reached.
FWP_TOO_MANY_SUBLAYERS = 0xC0220036,
/// The notification function for a callout returned an error.
FWP_CALLOUT_NOTIFICATION_FAILED = 0xC0220037,
/// The IPsec authentication configuration is not compatible with the authentication type.
FWP_INCOMPATIBLE_AUTH_CONFIG = 0xC0220038,
/// The IPsec cipher configuration is not compatible with the cipher type.
FWP_INCOMPATIBLE_CIPHER_CONFIG = 0xC0220039,
/// A policy cannot contain the same auth method more than once.
FWP_DUPLICATE_AUTH_METHOD = 0xC022003C,
/// The TCP/IP stack is not ready.
FWP_TCPIP_NOT_READY = 0xC0220100,
/// The injection handle is being closed by another thread.
FWP_INJECT_HANDLE_CLOSING = 0xC0220101,
/// The injection handle is stale.
FWP_INJECT_HANDLE_STALE = 0xC0220102,
/// The classify cannot be pended.
FWP_CANNOT_PEND = 0xC0220103,
/// The binding to the network interface is being closed.
NDIS_CLOSING = 0xC0230002,
/// An invalid version was specified.
NDIS_BAD_VERSION = 0xC0230004,
/// An invalid characteristics table was used.
NDIS_BAD_CHARACTERISTICS = 0xC0230005,
/// Failed to find the network interface or the network interface is not ready.
NDIS_ADAPTER_NOT_FOUND = 0xC0230006,
/// Failed to open the network interface.
NDIS_OPEN_FAILED = 0xC0230007,
/// The network interface has encountered an internal unrecoverable failure.
NDIS_DEVICE_FAILED = 0xC0230008,
/// The multicast list on the network interface is full.
NDIS_MULTICAST_FULL = 0xC0230009,
/// An attempt was made to add a duplicate multicast address to the list.
NDIS_MULTICAST_EXISTS = 0xC023000A,
/// At attempt was made to remove a multicast address that was never added.
NDIS_MULTICAST_NOT_FOUND = 0xC023000B,
/// The network interface aborted the request.
NDIS_REQUEST_ABORTED = 0xC023000C,
/// The network interface cannot process the request because it is being reset.
NDIS_RESET_IN_PROGRESS = 0xC023000D,
/// An attempt was made to send an invalid packet on a network interface.
NDIS_INVALID_PACKET = 0xC023000F,
/// The specified request is not a valid operation for the target device.
NDIS_INVALID_DEVICE_REQUEST = 0xC0230010,
/// The network interface is not ready to complete this operation.
NDIS_ADAPTER_NOT_READY = 0xC0230011,
/// The length of the buffer submitted for this operation is not valid.
NDIS_INVALID_LENGTH = 0xC0230014,
/// The data used for this operation is not valid.
NDIS_INVALID_DATA = 0xC0230015,
/// The length of the submitted buffer for this operation is too small.
NDIS_BUFFER_TOO_SHORT = 0xC0230016,
/// The network interface does not support this object identifier.
NDIS_INVALID_OID = 0xC0230017,
/// The network interface has been removed.
NDIS_ADAPTER_REMOVED = 0xC0230018,
/// The network interface does not support this media type.
NDIS_UNSUPPORTED_MEDIA = 0xC0230019,
/// An attempt was made to remove a token ring group address that is in use by other components.
NDIS_GROUP_ADDRESS_IN_USE = 0xC023001A,
/// An attempt was made to map a file that cannot be found.
NDIS_FILE_NOT_FOUND = 0xC023001B,
/// An error occurred while NDIS tried to map the file.
NDIS_ERROR_READING_FILE = 0xC023001C,
/// An attempt was made to map a file that is already mapped.
NDIS_ALREADY_MAPPED = 0xC023001D,
/// An attempt to allocate a hardware resource failed because the resource is used by another component.
NDIS_RESOURCE_CONFLICT = 0xC023001E,
/// The I/O operation failed because the network media is disconnected or the wireless access point is out of range.
NDIS_MEDIA_DISCONNECTED = 0xC023001F,
/// The network address used in the request is invalid.
NDIS_INVALID_ADDRESS = 0xC0230022,
/// The offload operation on the network interface has been paused.
NDIS_PAUSED = 0xC023002A,
/// The network interface was not found.
NDIS_INTERFACE_NOT_FOUND = 0xC023002B,
/// The revision number specified in the structure is not supported.
NDIS_UNSUPPORTED_REVISION = 0xC023002C,
/// The specified port does not exist on this network interface.
NDIS_INVALID_PORT = 0xC023002D,
/// The current state of the specified port on this network interface does not support the requested operation.
NDIS_INVALID_PORT_STATE = 0xC023002E,
/// The miniport adapter is in a lower power state.
NDIS_LOW_POWER_STATE = 0xC023002F,
/// The network interface does not support this request.
NDIS_NOT_SUPPORTED = 0xC02300BB,
/// The TCP connection is not offloadable because of a local policy setting.
NDIS_OFFLOAD_POLICY = 0xC023100F,
/// The TCP connection is not offloadable by the Chimney offload target.
NDIS_OFFLOAD_CONNECTION_REJECTED = 0xC0231012,
/// The IP Path object is not in an offloadable state.
NDIS_OFFLOAD_PATH_REJECTED = 0xC0231013,
/// The wireless LAN interface is in auto-configuration mode and does not support the requested parameter change operation.
NDIS_DOT11_AUTO_CONFIG_ENABLED = 0xC0232000,
/// The wireless LAN interface is busy and cannot perform the requested operation.
NDIS_DOT11_MEDIA_IN_USE = 0xC0232001,
/// The wireless LAN interface is power down and does not support the requested operation.
NDIS_DOT11_POWER_STATE_INVALID = 0xC0232002,
/// The list of wake on LAN patterns is full.
NDIS_PM_WOL_PATTERN_LIST_FULL = 0xC0232003,
/// The list of low power protocol offloads is full.
NDIS_PM_PROTOCOL_OFFLOAD_LIST_FULL = 0xC0232004,
/// The SPI in the packet does not match a valid IPsec SA.
IPSEC_BAD_SPI = 0xC0360001,
/// The packet was received on an IPsec SA whose lifetime has expired.
IPSEC_SA_LIFETIME_EXPIRED = 0xC0360002,
/// The packet was received on an IPsec SA that does not match the packet characteristics.
IPSEC_WRONG_SA = 0xC0360003,
/// The packet sequence number replay check failed.
IPSEC_REPLAY_CHECK_FAILED = 0xC0360004,
/// The IPsec header and/or trailer in the packet is invalid.
IPSEC_INVALID_PACKET = 0xC0360005,
/// The IPsec integrity check failed.
IPSEC_INTEGRITY_CHECK_FAILED = 0xC0360006,
/// IPsec dropped a clear text packet.
IPSEC_CLEAR_TEXT_DROP = 0xC0360007,
/// IPsec dropped an incoming ESP packet in authenticated firewall mode. This drop is benign.
IPSEC_AUTH_FIREWALL_DROP = 0xC0360008,
/// IPsec dropped a packet due to DOS throttle.
IPSEC_THROTTLE_DROP = 0xC0360009,
/// IPsec Dos Protection matched an explicit block rule.
IPSEC_DOSP_BLOCK = 0xC0368000,
/// IPsec Dos Protection received an IPsec specific multicast packet which is not allowed.
IPSEC_DOSP_RECEIVED_MULTICAST = 0xC0368001,
/// IPsec Dos Protection received an incorrectly formatted packet.
IPSEC_DOSP_INVALID_PACKET = 0xC0368002,
/// IPsec Dos Protection failed to lookup state.
IPSEC_DOSP_STATE_LOOKUP_FAILED = 0xC0368003,
/// IPsec Dos Protection failed to create state because there are already maximum number of entries allowed by policy.
IPSEC_DOSP_MAX_ENTRIES = 0xC0368004,
/// IPsec Dos Protection received an IPsec negotiation packet for a keying module which is not allowed by policy.
IPSEC_DOSP_KEYMOD_NOT_ALLOWED = 0xC0368005,
/// IPsec Dos Protection failed to create per internal IP ratelimit queue because there is already maximum number of queues allowed by policy.
IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES = 0xC0368006,
/// The system does not support mirrored volumes.
VOLMGR_MIRROR_NOT_SUPPORTED = 0xC038005B,
/// The system does not support RAID-5 volumes.
VOLMGR_RAID5_NOT_SUPPORTED = 0xC038005C,
/// A virtual disk support provider for the specified file was not found.
VIRTDISK_PROVIDER_NOT_FOUND = 0xC03A0014,
/// The specified disk is not a virtual disk.
VIRTDISK_NOT_VIRTUAL_DISK = 0xC03A0015,
/// The chain of virtual hard disks is inaccessible.
/// The process has not been granted access rights to the parent virtual hard disk for the differencing disk.
VHD_PARENT_VHD_ACCESS_DENIED = 0xC03A0016,
/// The chain of virtual hard disks is corrupted.
/// There is a mismatch in the virtual sizes of the parent virtual hard disk and differencing disk.
VHD_CHILD_PARENT_SIZE_MISMATCH = 0xC03A0017,
/// The chain of virtual hard disks is corrupted.
/// A differencing disk is indicated in its own parent chain.
VHD_DIFFERENCING_CHAIN_CYCLE_DETECTED = 0xC03A0018,
/// The chain of virtual hard disks is inaccessible.
/// There was an error opening a virtual hard disk further up the chain.
VHD_DIFFERENCING_CHAIN_ERROR_IN_PARENT = 0xC03A0019,
_,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/advapi32.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const BOOL = windows.BOOL;
const DWORD = windows.DWORD;
const HKEY = windows.HKEY;
const BYTE = windows.BYTE;
const LPCWSTR = windows.LPCWSTR;
const LSTATUS = windows.LSTATUS;
const REGSAM = windows.REGSAM;
const ULONG = windows.ULONG;
const WINAPI = windows.WINAPI;
pub extern "advapi32" fn RegOpenKeyExW(
hKey: HKEY,
lpSubKey: LPCWSTR,
ulOptions: DWORD,
samDesired: REGSAM,
phkResult: *HKEY,
) callconv(WINAPI) LSTATUS;
pub extern "advapi32" fn RegQueryValueExW(
hKey: HKEY,
lpValueName: LPCWSTR,
lpReserved: *DWORD,
lpType: *DWORD,
lpData: *BYTE,
lpcbData: *DWORD,
) callconv(WINAPI) LSTATUS;
// RtlGenRandom is known as SystemFunction036 under advapi32
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa387694.aspx */
pub extern "advapi32" fn SystemFunction036(output: [*]u8, length: ULONG) callconv(WINAPI) BOOL;
pub const RtlGenRandom = SystemFunction036;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/ws2_32.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const WINAPI = windows.WINAPI;
const OVERLAPPED = windows.OVERLAPPED;
const WORD = windows.WORD;
const DWORD = windows.DWORD;
const GUID = windows.GUID;
const USHORT = windows.USHORT;
const WCHAR = windows.WCHAR;
const BOOL = windows.BOOL;
const HANDLE = windows.HANDLE;
const timeval = windows.timeval;
const HWND = windows.HWND;
const INT = windows.INT;
const SHORT = windows.SHORT;
const CHAR = windows.CHAR;
const ULONG = windows.ULONG;
const LPARAM = windows.LPARAM;
const FARPROC = windows.FARPROC;
pub const SOCKET = *opaque {};
pub const INVALID_SOCKET = @as(SOCKET, @ptrFromInt(~@as(usize, 0)));
pub const GROUP = u32;
pub const ADDRESS_FAMILY = u16;
pub const WSAEVENT = HANDLE;
// Microsoft use the signed c_int for this, but it should never be negative
pub const socklen_t = u32;
pub const LM_HB_Extension = 128;
pub const LM_HB1_PnP = 1;
pub const LM_HB1_PDA_Palmtop = 2;
pub const LM_HB1_Computer = 4;
pub const LM_HB1_Printer = 8;
pub const LM_HB1_Modem = 16;
pub const LM_HB1_Fax = 32;
pub const LM_HB1_LANAccess = 64;
pub const LM_HB2_Telephony = 1;
pub const LM_HB2_FileServer = 2;
pub const ATMPROTO_AALUSER = 0;
pub const ATMPROTO_AAL1 = 1;
pub const ATMPROTO_AAL2 = 2;
pub const ATMPROTO_AAL34 = 3;
pub const ATMPROTO_AAL5 = 5;
pub const SAP_FIELD_ABSENT = 4294967294;
pub const SAP_FIELD_ANY = 4294967295;
pub const SAP_FIELD_ANY_AESA_SEL = 4294967290;
pub const SAP_FIELD_ANY_AESA_REST = 4294967291;
pub const ATM_E164 = 1;
pub const ATM_NSAP = 2;
pub const ATM_AESA = 2;
pub const ATM_ADDR_SIZE = 20;
pub const BLLI_L2_ISO_1745 = 1;
pub const BLLI_L2_Q921 = 2;
pub const BLLI_L2_X25L = 6;
pub const BLLI_L2_X25M = 7;
pub const BLLI_L2_ELAPB = 8;
pub const BLLI_L2_HDLC_ARM = 9;
pub const BLLI_L2_HDLC_NRM = 10;
pub const BLLI_L2_HDLC_ABM = 11;
pub const BLLI_L2_LLC = 12;
pub const BLLI_L2_X75 = 13;
pub const BLLI_L2_Q922 = 14;
pub const BLLI_L2_USER_SPECIFIED = 16;
pub const BLLI_L2_ISO_7776 = 17;
pub const BLLI_L3_X25 = 6;
pub const BLLI_L3_ISO_8208 = 7;
pub const BLLI_L3_X223 = 8;
pub const BLLI_L3_SIO_8473 = 9;
pub const BLLI_L3_T70 = 10;
pub const BLLI_L3_ISO_TR9577 = 11;
pub const BLLI_L3_USER_SPECIFIED = 16;
pub const BLLI_L3_IPI_SNAP = 128;
pub const BLLI_L3_IPI_IP = 204;
pub const BHLI_ISO = 0;
pub const BHLI_UserSpecific = 1;
pub const BHLI_HighLayerProfile = 2;
pub const BHLI_VendorSpecificAppId = 3;
pub const AAL5_MODE_MESSAGE = 1;
pub const AAL5_MODE_STREAMING = 2;
pub const AAL5_SSCS_NULL = 0;
pub const AAL5_SSCS_SSCOP_ASSURED = 1;
pub const AAL5_SSCS_SSCOP_NON_ASSURED = 2;
pub const AAL5_SSCS_FRAME_RELAY = 4;
pub const BCOB_A = 1;
pub const BCOB_C = 3;
pub const BCOB_X = 16;
pub const TT_NOIND = 0;
pub const TT_CBR = 4;
pub const TT_VBR = 8;
pub const TR_NOIND = 0;
pub const TR_END_TO_END = 1;
pub const TR_NO_END_TO_END = 2;
pub const CLIP_NOT = 0;
pub const CLIP_SUS = 32;
pub const UP_P2P = 0;
pub const UP_P2MP = 1;
pub const BLLI_L2_MODE_NORMAL = 64;
pub const BLLI_L2_MODE_EXT = 128;
pub const BLLI_L3_MODE_NORMAL = 64;
pub const BLLI_L3_MODE_EXT = 128;
pub const BLLI_L3_PACKET_16 = 4;
pub const BLLI_L3_PACKET_32 = 5;
pub const BLLI_L3_PACKET_64 = 6;
pub const BLLI_L3_PACKET_128 = 7;
pub const BLLI_L3_PACKET_256 = 8;
pub const BLLI_L3_PACKET_512 = 9;
pub const BLLI_L3_PACKET_1024 = 10;
pub const BLLI_L3_PACKET_2048 = 11;
pub const BLLI_L3_PACKET_4096 = 12;
pub const PI_ALLOWED = 0;
pub const PI_RESTRICTED = 64;
pub const PI_NUMBER_NOT_AVAILABLE = 128;
pub const SI_USER_NOT_SCREENED = 0;
pub const SI_USER_PASSED = 1;
pub const SI_USER_FAILED = 2;
pub const SI_NETWORK = 3;
pub const CAUSE_LOC_USER = 0;
pub const CAUSE_LOC_PRIVATE_LOCAL = 1;
pub const CAUSE_LOC_PUBLIC_LOCAL = 2;
pub const CAUSE_LOC_TRANSIT_NETWORK = 3;
pub const CAUSE_LOC_PUBLIC_REMOTE = 4;
pub const CAUSE_LOC_PRIVATE_REMOTE = 5;
pub const CAUSE_LOC_INTERNATIONAL_NETWORK = 7;
pub const CAUSE_LOC_BEYOND_INTERWORKING = 10;
pub const CAUSE_UNALLOCATED_NUMBER = 1;
pub const CAUSE_NO_ROUTE_TO_TRANSIT_NETWORK = 2;
pub const CAUSE_NO_ROUTE_TO_DESTINATION = 3;
pub const CAUSE_VPI_VCI_UNACCEPTABLE = 10;
pub const CAUSE_NORMAL_CALL_CLEARING = 16;
pub const CAUSE_USER_BUSY = 17;
pub const CAUSE_NO_USER_RESPONDING = 18;
pub const CAUSE_CALL_REJECTED = 21;
pub const CAUSE_NUMBER_CHANGED = 22;
pub const CAUSE_USER_REJECTS_CLIR = 23;
pub const CAUSE_DESTINATION_OUT_OF_ORDER = 27;
pub const CAUSE_INVALID_NUMBER_FORMAT = 28;
pub const CAUSE_STATUS_ENQUIRY_RESPONSE = 30;
pub const CAUSE_NORMAL_UNSPECIFIED = 31;
pub const CAUSE_VPI_VCI_UNAVAILABLE = 35;
pub const CAUSE_NETWORK_OUT_OF_ORDER = 38;
pub const CAUSE_TEMPORARY_FAILURE = 41;
pub const CAUSE_ACCESS_INFORMAION_DISCARDED = 43;
pub const CAUSE_NO_VPI_VCI_AVAILABLE = 45;
pub const CAUSE_RESOURCE_UNAVAILABLE = 47;
pub const CAUSE_QOS_UNAVAILABLE = 49;
pub const CAUSE_USER_CELL_RATE_UNAVAILABLE = 51;
pub const CAUSE_BEARER_CAPABILITY_UNAUTHORIZED = 57;
pub const CAUSE_BEARER_CAPABILITY_UNAVAILABLE = 58;
pub const CAUSE_OPTION_UNAVAILABLE = 63;
pub const CAUSE_BEARER_CAPABILITY_UNIMPLEMENTED = 65;
pub const CAUSE_UNSUPPORTED_TRAFFIC_PARAMETERS = 73;
pub const CAUSE_INVALID_CALL_REFERENCE = 81;
pub const CAUSE_CHANNEL_NONEXISTENT = 82;
pub const CAUSE_INCOMPATIBLE_DESTINATION = 88;
pub const CAUSE_INVALID_ENDPOINT_REFERENCE = 89;
pub const CAUSE_INVALID_TRANSIT_NETWORK_SELECTION = 91;
pub const CAUSE_TOO_MANY_PENDING_ADD_PARTY = 92;
pub const CAUSE_AAL_PARAMETERS_UNSUPPORTED = 93;
pub const CAUSE_MANDATORY_IE_MISSING = 96;
pub const CAUSE_UNIMPLEMENTED_MESSAGE_TYPE = 97;
pub const CAUSE_UNIMPLEMENTED_IE = 99;
pub const CAUSE_INVALID_IE_CONTENTS = 100;
pub const CAUSE_INVALID_STATE_FOR_MESSAGE = 101;
pub const CAUSE_RECOVERY_ON_TIMEOUT = 102;
pub const CAUSE_INCORRECT_MESSAGE_LENGTH = 104;
pub const CAUSE_PROTOCOL_ERROR = 111;
pub const CAUSE_COND_UNKNOWN = 0;
pub const CAUSE_COND_PERMANENT = 1;
pub const CAUSE_COND_TRANSIENT = 2;
pub const CAUSE_REASON_USER = 0;
pub const CAUSE_REASON_IE_MISSING = 4;
pub const CAUSE_REASON_IE_INSUFFICIENT = 8;
pub const CAUSE_PU_PROVIDER = 0;
pub const CAUSE_PU_USER = 8;
pub const CAUSE_NA_NORMAL = 0;
pub const CAUSE_NA_ABNORMAL = 4;
pub const QOS_CLASS0 = 0;
pub const QOS_CLASS1 = 1;
pub const QOS_CLASS2 = 2;
pub const QOS_CLASS3 = 3;
pub const QOS_CLASS4 = 4;
pub const TNS_TYPE_NATIONAL = 64;
pub const TNS_PLAN_CARRIER_ID_CODE = 1;
pub const SIO_GET_NUMBER_OF_ATM_DEVICES = 1343619073;
pub const SIO_GET_ATM_ADDRESS = 3491102722;
pub const SIO_ASSOCIATE_PVC = 2417360899;
pub const SIO_GET_ATM_CONNECTION_ID = 1343619076;
pub const RIO_MSG_DONT_NOTIFY = 1;
pub const RIO_MSG_DEFER = 2;
pub const RIO_MSG_WAITALL = 4;
pub const RIO_MSG_COMMIT_ONLY = 8;
pub const RIO_MAX_CQ_SIZE = 134217728;
pub const RIO_CORRUPT_CQ = 4294967295;
pub const WINDOWS_AF_IRDA = 26;
pub const WCE_AF_IRDA = 22;
pub const IRDA_PROTO_SOCK_STREAM = 1;
pub const IRLMP_ENUMDEVICES = 16;
pub const IRLMP_IAS_SET = 17;
pub const IRLMP_IAS_QUERY = 18;
pub const IRLMP_SEND_PDU_LEN = 19;
pub const IRLMP_EXCLUSIVE_MODE = 20;
pub const IRLMP_IRLPT_MODE = 21;
pub const IRLMP_9WIRE_MODE = 22;
pub const IRLMP_TINYTP_MODE = 23;
pub const IRLMP_PARAMETERS = 24;
pub const IRLMP_DISCOVERY_MODE = 25;
pub const IRLMP_SHARP_MODE = 32;
pub const IAS_ATTRIB_NO_CLASS = 16;
pub const IAS_ATTRIB_NO_ATTRIB = 0;
pub const IAS_ATTRIB_INT = 1;
pub const IAS_ATTRIB_OCTETSEQ = 2;
pub const IAS_ATTRIB_STR = 3;
pub const IAS_MAX_USER_STRING = 256;
pub const IAS_MAX_OCTET_STRING = 1024;
pub const IAS_MAX_CLASSNAME = 64;
pub const IAS_MAX_ATTRIBNAME = 256;
pub const LmCharSetASCII = 0;
pub const LmCharSetISO_8859_1 = 1;
pub const LmCharSetISO_8859_2 = 2;
pub const LmCharSetISO_8859_3 = 3;
pub const LmCharSetISO_8859_4 = 4;
pub const LmCharSetISO_8859_5 = 5;
pub const LmCharSetISO_8859_6 = 6;
pub const LmCharSetISO_8859_7 = 7;
pub const LmCharSetISO_8859_8 = 8;
pub const LmCharSetISO_8859_9 = 9;
pub const LmCharSetUNICODE = 255;
pub const LM_BAUD_1200 = 1200;
pub const LM_BAUD_2400 = 2400;
pub const LM_BAUD_9600 = 9600;
pub const LM_BAUD_19200 = 19200;
pub const LM_BAUD_38400 = 38400;
pub const LM_BAUD_57600 = 57600;
pub const LM_BAUD_115200 = 115200;
pub const LM_BAUD_576K = 576000;
pub const LM_BAUD_1152K = 1152000;
pub const LM_BAUD_4M = 4000000;
pub const LM_BAUD_16M = 16000000;
pub const IPX_PTYPE = 16384;
pub const IPX_FILTERPTYPE = 16385;
pub const IPX_STOPFILTERPTYPE = 16387;
pub const IPX_DSTYPE = 16386;
pub const IPX_EXTENDED_ADDRESS = 16388;
pub const IPX_RECVHDR = 16389;
pub const IPX_MAXSIZE = 16390;
pub const IPX_ADDRESS = 16391;
pub const IPX_GETNETINFO = 16392;
pub const IPX_GETNETINFO_NORIP = 16393;
pub const IPX_SPXGETCONNECTIONSTATUS = 16395;
pub const IPX_ADDRESS_NOTIFY = 16396;
pub const IPX_MAX_ADAPTER_NUM = 16397;
pub const IPX_RERIPNETNUMBER = 16398;
pub const IPX_RECEIVE_BROADCAST = 16399;
pub const IPX_IMMEDIATESPXACK = 16400;
pub const MAX_MCAST_TTL = 255;
pub const RM_OPTIONSBASE = 1000;
pub const RM_RATE_WINDOW_SIZE = 1001;
pub const RM_SET_MESSAGE_BOUNDARY = 1002;
pub const RM_FLUSHCACHE = 1003;
pub const RM_SENDER_WINDOW_ADVANCE_METHOD = 1004;
pub const RM_SENDER_STATISTICS = 1005;
pub const RM_LATEJOIN = 1006;
pub const RM_SET_SEND_IF = 1007;
pub const RM_ADD_RECEIVE_IF = 1008;
pub const RM_DEL_RECEIVE_IF = 1009;
pub const RM_SEND_WINDOW_ADV_RATE = 1010;
pub const RM_USE_FEC = 1011;
pub const RM_SET_MCAST_TTL = 1012;
pub const RM_RECEIVER_STATISTICS = 1013;
pub const RM_HIGH_SPEED_INTRANET_OPT = 1014;
pub const SENDER_DEFAULT_RATE_KBITS_PER_SEC = 56;
pub const SENDER_DEFAULT_WINDOW_ADV_PERCENTAGE = 15;
pub const MAX_WINDOW_INCREMENT_PERCENTAGE = 25;
pub const SENDER_DEFAULT_LATE_JOINER_PERCENTAGE = 0;
pub const SENDER_MAX_LATE_JOINER_PERCENTAGE = 75;
pub const BITS_PER_BYTE = 8;
pub const LOG2_BITS_PER_BYTE = 3;
pub const SOCKET_DEFAULT2_QM_POLICY = GUID.parse("{aec2ef9c-3a4d-4d3e-8842-239942e39a47}");
pub const REAL_TIME_NOTIFICATION_CAPABILITY = GUID.parse("{6b59819a-5cae-492d-a901-2a3c2c50164f}");
pub const REAL_TIME_NOTIFICATION_CAPABILITY_EX = GUID.parse("{6843da03-154a-4616-a508-44371295f96b}");
pub const ASSOCIATE_NAMERES_CONTEXT = GUID.parse("{59a38b67-d4fe-46e1-ba3c-87ea74ca3049}");
pub const WSAID_CONNECTEX = GUID{
.Data1 = 0x25a207b9,
.Data2 = 0xddf3,
.Data3 = 0x4660,
.Data4 = [8]u8{ 0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e },
};
pub const WSAID_ACCEPTEX = GUID{
.Data1 = 0xb5367df1,
.Data2 = 0xcbac,
.Data3 = 0x11cf,
.Data4 = [8]u8{ 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 },
};
pub const WSAID_GETACCEPTEXSOCKADDRS = GUID{
.Data1 = 0xb5367df2,
.Data2 = 0xcbac,
.Data3 = 0x11cf,
.Data4 = [8]u8{ 0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92 },
};
pub const WSAID_WSARECVMSG = GUID{
.Data1 = 0xf689d7c8,
.Data2 = 0x6f1f,
.Data3 = 0x436b,
.Data4 = [8]u8{ 0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22 },
};
pub const WSAID_WSAPOLL = GUID{
.Data1 = 0x18C76F85,
.Data2 = 0xDC66,
.Data3 = 0x4964,
.Data4 = [8]u8{ 0x97, 0x2E, 0x23, 0xC2, 0x72, 0x38, 0x31, 0x2B },
};
pub const WSAID_WSASENDMSG = GUID{
.Data1 = 0xa441e712,
.Data2 = 0x754f,
.Data3 = 0x43ca,
.Data4 = [8]u8{ 0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d },
};
pub const TCP_INITIAL_RTO_DEFAULT_RTT = 0;
pub const TCP_INITIAL_RTO_DEFAULT_MAX_SYN_RETRANSMISSIONS = 0;
pub const SOCKET_SETTINGS_GUARANTEE_ENCRYPTION = 1;
pub const SOCKET_SETTINGS_ALLOW_INSECURE = 2;
pub const SOCKET_SETTINGS_IPSEC_SKIP_FILTER_INSTANTIATION = 1;
pub const SOCKET_SETTINGS_IPSEC_OPTIONAL_PEER_NAME_VERIFICATION = 2;
pub const SOCKET_SETTINGS_IPSEC_ALLOW_FIRST_INBOUND_PKT_UNENCRYPTED = 4;
pub const SOCKET_SETTINGS_IPSEC_PEER_NAME_IS_RAW_FORMAT = 8;
pub const SOCKET_QUERY_IPSEC2_ABORT_CONNECTION_ON_FIELD_CHANGE = 1;
pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_MM_SA_ID = 1;
pub const SOCKET_QUERY_IPSEC2_FIELD_MASK_QM_SA_ID = 2;
pub const SOCKET_INFO_CONNECTION_SECURED = 1;
pub const SOCKET_INFO_CONNECTION_ENCRYPTED = 2;
pub const SOCKET_INFO_CONNECTION_IMPERSONATED = 4;
pub const IN4ADDR_LOOPBACK = 16777343;
pub const IN4ADDR_LOOPBACKPREFIX_LENGTH = 8;
pub const IN4ADDR_LINKLOCALPREFIX_LENGTH = 16;
pub const IN4ADDR_MULTICASTPREFIX_LENGTH = 4;
pub const IFF_UP = 1;
pub const IFF_BROADCAST = 2;
pub const IFF_LOOPBACK = 4;
pub const IFF_POINTTOPOINT = 8;
pub const IFF_MULTICAST = 16;
pub const IP_OPTIONS = 1;
pub const IP_HDRINCL = 2;
pub const IP_TOS = 3;
pub const IP_TTL = 4;
pub const IP_MULTICAST_IF = 9;
pub const IP_MULTICAST_TTL = 10;
pub const IP_MULTICAST_LOOP = 11;
pub const IP_ADD_MEMBERSHIP = 12;
pub const IP_DROP_MEMBERSHIP = 13;
pub const IP_DONTFRAGMENT = 14;
pub const IP_ADD_SOURCE_MEMBERSHIP = 15;
pub const IP_DROP_SOURCE_MEMBERSHIP = 16;
pub const IP_BLOCK_SOURCE = 17;
pub const IP_UNBLOCK_SOURCE = 18;
pub const IP_PKTINFO = 19;
pub const IP_HOPLIMIT = 21;
pub const IP_RECVTTL = 21;
pub const IP_RECEIVE_BROADCAST = 22;
pub const IP_RECVIF = 24;
pub const IP_RECVDSTADDR = 25;
pub const IP_IFLIST = 28;
pub const IP_ADD_IFLIST = 29;
pub const IP_DEL_IFLIST = 30;
pub const IP_UNICAST_IF = 31;
pub const IP_RTHDR = 32;
pub const IP_GET_IFLIST = 33;
pub const IP_RECVRTHDR = 38;
pub const IP_TCLASS = 39;
pub const IP_RECVTCLASS = 40;
pub const IP_RECVTOS = 40;
pub const IP_ORIGINAL_ARRIVAL_IF = 47;
pub const IP_ECN = 50;
pub const IP_PKTINFO_EX = 51;
pub const IP_WFP_REDIRECT_RECORDS = 60;
pub const IP_WFP_REDIRECT_CONTEXT = 70;
pub const IP_MTU_DISCOVER = 71;
pub const IP_MTU = 73;
pub const IP_NRT_INTERFACE = 74;
pub const IP_RECVERR = 75;
pub const IP_USER_MTU = 76;
pub const IP_UNSPECIFIED_TYPE_OF_SERVICE = -1;
pub const IN6ADDR_LINKLOCALPREFIX_LENGTH = 64;
pub const IN6ADDR_MULTICASTPREFIX_LENGTH = 8;
pub const IN6ADDR_SOLICITEDNODEMULTICASTPREFIX_LENGTH = 104;
pub const IN6ADDR_V4MAPPEDPREFIX_LENGTH = 96;
pub const IN6ADDR_6TO4PREFIX_LENGTH = 16;
pub const IN6ADDR_TEREDOPREFIX_LENGTH = 32;
pub const MCAST_JOIN_GROUP = 41;
pub const MCAST_LEAVE_GROUP = 42;
pub const MCAST_BLOCK_SOURCE = 43;
pub const MCAST_UNBLOCK_SOURCE = 44;
pub const MCAST_JOIN_SOURCE_GROUP = 45;
pub const MCAST_LEAVE_SOURCE_GROUP = 46;
pub const IPV6_HOPOPTS = 1;
pub const IPV6_HDRINCL = 2;
pub const IPV6_UNICAST_HOPS = 4;
pub const IPV6_MULTICAST_IF = 9;
pub const IPV6_MULTICAST_HOPS = 10;
pub const IPV6_MULTICAST_LOOP = 11;
pub const IPV6_ADD_MEMBERSHIP = 12;
pub const IPV6_DROP_MEMBERSHIP = 13;
pub const IPV6_DONTFRAG = 14;
pub const IPV6_PKTINFO = 19;
pub const IPV6_HOPLIMIT = 21;
pub const IPV6_PROTECTION_LEVEL = 23;
pub const IPV6_RECVIF = 24;
pub const IPV6_RECVDSTADDR = 25;
pub const IPV6_CHECKSUM = 26;
pub const IPV6_V6ONLY = 27;
pub const IPV6_IFLIST = 28;
pub const IPV6_ADD_IFLIST = 29;
pub const IPV6_DEL_IFLIST = 30;
pub const IPV6_UNICAST_IF = 31;
pub const IPV6_RTHDR = 32;
pub const IPV6_GET_IFLIST = 33;
pub const IPV6_RECVRTHDR = 38;
pub const IPV6_TCLASS = 39;
pub const IPV6_RECVTCLASS = 40;
pub const IPV6_ECN = 50;
pub const IPV6_PKTINFO_EX = 51;
pub const IPV6_WFP_REDIRECT_RECORDS = 60;
pub const IPV6_WFP_REDIRECT_CONTEXT = 70;
pub const IPV6_MTU_DISCOVER = 71;
pub const IPV6_MTU = 72;
pub const IPV6_NRT_INTERFACE = 74;
pub const IPV6_RECVERR = 75;
pub const IPV6_USER_MTU = 76;
pub const IP_UNSPECIFIED_HOP_LIMIT = -1;
pub const PROTECTION_LEVEL_UNRESTRICTED = 10;
pub const PROTECTION_LEVEL_EDGERESTRICTED = 20;
pub const PROTECTION_LEVEL_RESTRICTED = 30;
pub const INET_ADDRSTRLEN = 22;
pub const INET6_ADDRSTRLEN = 65;
pub const TCP = struct {
pub const NODELAY = 1;
pub const EXPEDITED_1122 = 2;
pub const OFFLOAD_NO_PREFERENCE = 0;
pub const OFFLOAD_NOT_PREFERRED = 1;
pub const OFFLOAD_PREFERRED = 2;
pub const KEEPALIVE = 3;
pub const MAXSEG = 4;
pub const MAXRT = 5;
pub const STDURG = 6;
pub const NOURG = 7;
pub const ATMARK = 8;
pub const NOSYNRETRIES = 9;
pub const TIMESTAMPS = 10;
pub const OFFLOAD_PREFERENCE = 11;
pub const CONGESTION_ALGORITHM = 12;
pub const DELAY_FIN_ACK = 13;
pub const MAXRTMS = 14;
pub const FASTOPEN = 15;
pub const KEEPCNT = 16;
pub const KEEPINTVL = 17;
pub const FAIL_CONNECT_ON_ICMP_ERROR = 18;
pub const ICMP_ERROR_INFO = 19;
pub const BSDURGENT = 28672;
};
pub const UDP_SEND_MSG_SIZE = 2;
pub const UDP_RECV_MAX_COALESCED_SIZE = 3;
pub const UDP_COALESCED_INFO = 3;
pub const AF = struct {
pub const UNSPEC = 0;
pub const UNIX = 1;
pub const INET = 2;
pub const IMPLINK = 3;
pub const PUP = 4;
pub const CHAOS = 5;
pub const NS = 6;
pub const IPX = 6;
pub const ISO = 7;
pub const ECMA = 8;
pub const DATAKIT = 9;
pub const CCITT = 10;
pub const SNA = 11;
pub const DECnet = 12;
pub const DLI = 13;
pub const LAT = 14;
pub const HYLINK = 15;
pub const APPLETALK = 16;
pub const NETBIOS = 17;
pub const VOICEVIEW = 18;
pub const FIREFOX = 19;
pub const UNKNOWN1 = 20;
pub const BAN = 21;
pub const ATM = 22;
pub const INET6 = 23;
pub const CLUSTER = 24;
pub const @"12844" = 25;
pub const IRDA = 26;
pub const NETDES = 28;
pub const MAX = 29;
pub const TCNPROCESS = 29;
pub const TCNMESSAGE = 30;
pub const ICLFXBM = 31;
pub const LINK = 33;
pub const HYPERV = 34;
};
pub const SOCK = struct {
pub const STREAM = 1;
pub const DGRAM = 2;
pub const RAW = 3;
pub const RDM = 4;
pub const SEQPACKET = 5;
/// WARNING: this flag is not supported by windows socket functions directly,
/// it is only supported by std.os.socket. Be sure that this value does
/// not share any bits with any of the `SOCK` values.
pub const CLOEXEC = 0x10000;
/// WARNING: this flag is not supported by windows socket functions directly,
/// it is only supported by std.os.socket. Be sure that this value does
/// not share any bits with any of the `SOCK` values.
pub const NONBLOCK = 0x20000;
};
pub const SOL = struct {
pub const IRLMP = 255;
pub const SOCKET = 65535;
};
pub const SO = struct {
pub const DEBUG = 1;
pub const ACCEPTCONN = 2;
pub const REUSEADDR = 4;
pub const KEEPALIVE = 8;
pub const DONTROUTE = 16;
pub const BROADCAST = 32;
pub const USELOOPBACK = 64;
pub const LINGER = 128;
pub const OOBINLINE = 256;
pub const SNDBUF = 4097;
pub const RCVBUF = 4098;
pub const SNDLOWAT = 4099;
pub const RCVLOWAT = 4100;
pub const SNDTIMEO = 4101;
pub const RCVTIMEO = 4102;
pub const ERROR = 4103;
pub const TYPE = 4104;
pub const BSP_STATE = 4105;
pub const GROUP_ID = 8193;
pub const GROUP_PRIORITY = 8194;
pub const MAX_MSG_SIZE = 8195;
pub const CONDITIONAL_ACCEPT = 12290;
pub const PAUSE_ACCEPT = 12291;
pub const COMPARTMENT_ID = 12292;
pub const RANDOMIZE_PORT = 12293;
pub const PORT_SCALABILITY = 12294;
pub const REUSE_UNICASTPORT = 12295;
pub const REUSE_MULTICASTPORT = 12296;
pub const ORIGINAL_DST = 12303;
pub const PROTOCOL_INFOA = 8196;
pub const PROTOCOL_INFOW = 8197;
pub const CONNDATA = 28672;
pub const CONNOPT = 28673;
pub const DISCDATA = 28674;
pub const DISCOPT = 28675;
pub const CONNDATALEN = 28676;
pub const CONNOPTLEN = 28677;
pub const DISCDATALEN = 28678;
pub const DISCOPTLEN = 28679;
pub const OPENTYPE = 28680;
pub const SYNCHRONOUS_ALERT = 16;
pub const SYNCHRONOUS_NONALERT = 32;
pub const MAXDG = 28681;
pub const MAXPATHDG = 28682;
pub const UPDATE_ACCEPT_CONTEXT = 28683;
pub const CONNECT_TIME = 28684;
pub const UPDATE_CONNECT_CONTEXT = 28688;
};
pub const WSK_SO_BASE = 16384;
pub const IOC_UNIX = 0;
pub const IOC_WS2 = 134217728;
pub const IOC_PROTOCOL = 268435456;
pub const IOC_VENDOR = 402653184;
pub const SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_OUT | IOC_IN | IOC_WS2 | 6;
pub const SIO_BSP_HANDLE = IOC_OUT | IOC_WS2 | 27;
pub const SIO_BSP_HANDLE_SELECT = IOC_OUT | IOC_WS2 | 28;
pub const SIO_BSP_HANDLE_POLL = IOC_OUT | IOC_WS2 | 29;
pub const SIO_BASE_HANDLE = IOC_OUT | IOC_WS2 | 34;
pub const IPPORT_TCPMUX = 1;
pub const IPPORT_ECHO = 7;
pub const IPPORT_DISCARD = 9;
pub const IPPORT_SYSTAT = 11;
pub const IPPORT_DAYTIME = 13;
pub const IPPORT_NETSTAT = 15;
pub const IPPORT_QOTD = 17;
pub const IPPORT_MSP = 18;
pub const IPPORT_CHARGEN = 19;
pub const IPPORT_FTP_DATA = 20;
pub const IPPORT_FTP = 21;
pub const IPPORT_TELNET = 23;
pub const IPPORT_SMTP = 25;
pub const IPPORT_TIMESERVER = 37;
pub const IPPORT_NAMESERVER = 42;
pub const IPPORT_WHOIS = 43;
pub const IPPORT_MTP = 57;
pub const IPPORT_TFTP = 69;
pub const IPPORT_RJE = 77;
pub const IPPORT_FINGER = 79;
pub const IPPORT_TTYLINK = 87;
pub const IPPORT_SUPDUP = 95;
pub const IPPORT_POP3 = 110;
pub const IPPORT_NTP = 123;
pub const IPPORT_EPMAP = 135;
pub const IPPORT_NETBIOS_NS = 137;
pub const IPPORT_NETBIOS_DGM = 138;
pub const IPPORT_NETBIOS_SSN = 139;
pub const IPPORT_IMAP = 143;
pub const IPPORT_SNMP = 161;
pub const IPPORT_SNMP_TRAP = 162;
pub const IPPORT_IMAP3 = 220;
pub const IPPORT_LDAP = 389;
pub const IPPORT_HTTPS = 443;
pub const IPPORT_MICROSOFT_DS = 445;
pub const IPPORT_EXECSERVER = 512;
pub const IPPORT_LOGINSERVER = 513;
pub const IPPORT_CMDSERVER = 514;
pub const IPPORT_EFSSERVER = 520;
pub const IPPORT_BIFFUDP = 512;
pub const IPPORT_WHOSERVER = 513;
pub const IPPORT_ROUTESERVER = 520;
pub const IPPORT_RESERVED = 1024;
pub const IPPORT_REGISTERED_MAX = 49151;
pub const IPPORT_DYNAMIC_MIN = 49152;
pub const IPPORT_DYNAMIC_MAX = 65535;
pub const IN_CLASSA_NET = 4278190080;
pub const IN_CLASSA_NSHIFT = 24;
pub const IN_CLASSA_HOST = 16777215;
pub const IN_CLASSA_MAX = 128;
pub const IN_CLASSB_NET = 4294901760;
pub const IN_CLASSB_NSHIFT = 16;
pub const IN_CLASSB_HOST = 65535;
pub const IN_CLASSB_MAX = 65536;
pub const IN_CLASSC_NET = 4294967040;
pub const IN_CLASSC_NSHIFT = 8;
pub const IN_CLASSC_HOST = 255;
pub const IN_CLASSD_NET = 4026531840;
pub const IN_CLASSD_NSHIFT = 28;
pub const IN_CLASSD_HOST = 268435455;
pub const INADDR_LOOPBACK = 2130706433;
pub const INADDR_NONE = 4294967295;
pub const IOCPARM_MASK = 127;
pub const IOC_VOID = 536870912;
pub const IOC_OUT = 1073741824;
pub const IOC_IN = 2147483648;
pub const MSG = struct {
pub const TRUNC = 256;
pub const CTRUNC = 512;
pub const BCAST = 1024;
pub const MCAST = 2048;
pub const ERRQUEUE = 4096;
pub const PEEK = 2;
pub const WAITALL = 8;
pub const PUSH_IMMEDIATE = 32;
pub const PARTIAL = 32768;
pub const INTERRUPT = 16;
pub const MAXIOVLEN = 16;
};
pub const AI = struct {
pub const PASSIVE = 1;
pub const CANONNAME = 2;
pub const NUMERICHOST = 4;
pub const NUMERICSERV = 8;
pub const DNS_ONLY = 16;
pub const ALL = 256;
pub const ADDRCONFIG = 1024;
pub const V4MAPPED = 2048;
pub const NON_AUTHORITATIVE = 16384;
pub const SECURE = 32768;
pub const RETURN_PREFERRED_NAMES = 65536;
pub const FQDN = 131072;
pub const FILESERVER = 262144;
pub const DISABLE_IDN_ENCODING = 524288;
pub const EXTENDED = 2147483648;
pub const RESOLUTION_HANDLE = 1073741824;
};
pub const FIONBIO = -2147195266;
pub const ADDRINFOEX_VERSION_2 = 2;
pub const ADDRINFOEX_VERSION_3 = 3;
pub const ADDRINFOEX_VERSION_4 = 4;
pub const NS_ALL = 0;
pub const NS_SAP = 1;
pub const NS_NDS = 2;
pub const NS_PEER_BROWSE = 3;
pub const NS_SLP = 5;
pub const NS_DHCP = 6;
pub const NS_TCPIP_LOCAL = 10;
pub const NS_TCPIP_HOSTS = 11;
pub const NS_DNS = 12;
pub const NS_NETBT = 13;
pub const NS_WINS = 14;
pub const NS_NLA = 15;
pub const NS_NBP = 20;
pub const NS_MS = 30;
pub const NS_STDA = 31;
pub const NS_NTDS = 32;
pub const NS_EMAIL = 37;
pub const NS_X500 = 40;
pub const NS_NIS = 41;
pub const NS_NISPLUS = 42;
pub const NS_WRQ = 50;
pub const NS_NETDES = 60;
pub const NI_NOFQDN = 1;
pub const NI_NUMERICHOST = 2;
pub const NI_NAMEREQD = 4;
pub const NI_NUMERICSERV = 8;
pub const NI_DGRAM = 16;
pub const NI_MAXHOST = 1025;
pub const NI_MAXSERV = 32;
pub const INCL_WINSOCK_API_PROTOTYPES = 1;
pub const INCL_WINSOCK_API_TYPEDEFS = 0;
pub const FD_SETSIZE = 64;
pub const IMPLINK_IP = 155;
pub const IMPLINK_LOWEXPER = 156;
pub const IMPLINK_HIGHEXPER = 158;
pub const WSADESCRIPTION_LEN = 256;
pub const WSASYS_STATUS_LEN = 128;
pub const SOCKET_ERROR = -1;
pub const FROM_PROTOCOL_INFO = -1;
pub const PVD_CONFIG = 12289;
pub const SOMAXCONN = 2147483647;
pub const MAXGETHOSTSTRUCT = 1024;
pub const FD_READ_BIT = 0;
pub const FD_WRITE_BIT = 1;
pub const FD_OOB_BIT = 2;
pub const FD_ACCEPT_BIT = 3;
pub const FD_CONNECT_BIT = 4;
pub const FD_CLOSE_BIT = 5;
pub const FD_QOS_BIT = 6;
pub const FD_GROUP_QOS_BIT = 7;
pub const FD_ROUTING_INTERFACE_CHANGE_BIT = 8;
pub const FD_ADDRESS_LIST_CHANGE_BIT = 9;
pub const FD_MAX_EVENTS = 10;
pub const CF_ACCEPT = 0;
pub const CF_REJECT = 1;
pub const CF_DEFER = 2;
pub const SD_RECEIVE = 0;
pub const SD_SEND = 1;
pub const SD_BOTH = 2;
pub const SG_UNCONSTRAINED_GROUP = 1;
pub const SG_CONSTRAINED_GROUP = 2;
pub const MAX_PROTOCOL_CHAIN = 7;
pub const BASE_PROTOCOL = 1;
pub const LAYERED_PROTOCOL = 0;
pub const WSAPROTOCOL_LEN = 255;
pub const PFL_MULTIPLE_PROTO_ENTRIES = 1;
pub const PFL_RECOMMENDED_PROTO_ENTRY = 2;
pub const PFL_HIDDEN = 4;
pub const PFL_MATCHES_PROTOCOL_ZERO = 8;
pub const PFL_NETWORKDIRECT_PROVIDER = 16;
pub const XP1_CONNECTIONLESS = 1;
pub const XP1_GUARANTEED_DELIVERY = 2;
pub const XP1_GUARANTEED_ORDER = 4;
pub const XP1_MESSAGE_ORIENTED = 8;
pub const XP1_PSEUDO_STREAM = 16;
pub const XP1_GRACEFUL_CLOSE = 32;
pub const XP1_EXPEDITED_DATA = 64;
pub const XP1_CONNECT_DATA = 128;
pub const XP1_DISCONNECT_DATA = 256;
pub const XP1_SUPPORT_BROADCAST = 512;
pub const XP1_SUPPORT_MULTIPOINT = 1024;
pub const XP1_MULTIPOINT_CONTROL_PLANE = 2048;
pub const XP1_MULTIPOINT_DATA_PLANE = 4096;
pub const XP1_QOS_SUPPORTED = 8192;
pub const XP1_INTERRUPT = 16384;
pub const XP1_UNI_SEND = 32768;
pub const XP1_UNI_RECV = 65536;
pub const XP1_IFS_HANDLES = 131072;
pub const XP1_PARTIAL_MESSAGE = 262144;
pub const XP1_SAN_SUPPORT_SDP = 524288;
pub const BIGENDIAN = 0;
pub const LITTLEENDIAN = 1;
pub const SECURITY_PROTOCOL_NONE = 0;
pub const JL_SENDER_ONLY = 1;
pub const JL_RECEIVER_ONLY = 2;
pub const JL_BOTH = 4;
pub const WSA_FLAG_OVERLAPPED = 1;
pub const WSA_FLAG_MULTIPOINT_C_ROOT = 2;
pub const WSA_FLAG_MULTIPOINT_C_LEAF = 4;
pub const WSA_FLAG_MULTIPOINT_D_ROOT = 8;
pub const WSA_FLAG_MULTIPOINT_D_LEAF = 16;
pub const WSA_FLAG_ACCESS_SYSTEM_SECURITY = 64;
pub const WSA_FLAG_NO_HANDLE_INHERIT = 128;
pub const WSA_FLAG_REGISTERED_IO = 256;
pub const TH_NETDEV = 1;
pub const TH_TAPI = 2;
pub const SERVICE_MULTIPLE = 1;
pub const NS_LOCALNAME = 19;
pub const RES_UNUSED_1 = 1;
pub const RES_FLUSH_CACHE = 2;
pub const RES_SERVICE = 4;
pub const LUP_DEEP = 1;
pub const LUP_CONTAINERS = 2;
pub const LUP_NOCONTAINERS = 4;
pub const LUP_NEAREST = 8;
pub const LUP_RETURN_NAME = 16;
pub const LUP_RETURN_TYPE = 32;
pub const LUP_RETURN_VERSION = 64;
pub const LUP_RETURN_COMMENT = 128;
pub const LUP_RETURN_ADDR = 256;
pub const LUP_RETURN_BLOB = 512;
pub const LUP_RETURN_ALIASES = 1024;
pub const LUP_RETURN_QUERY_STRING = 2048;
pub const LUP_RETURN_ALL = 4080;
pub const LUP_RES_SERVICE = 32768;
pub const LUP_FLUSHCACHE = 4096;
pub const LUP_FLUSHPREVIOUS = 8192;
pub const LUP_NON_AUTHORITATIVE = 16384;
pub const LUP_SECURE = 32768;
pub const LUP_RETURN_PREFERRED_NAMES = 65536;
pub const LUP_DNS_ONLY = 131072;
pub const LUP_ADDRCONFIG = 1048576;
pub const LUP_DUAL_ADDR = 2097152;
pub const LUP_FILESERVER = 4194304;
pub const LUP_DISABLE_IDN_ENCODING = 8388608;
pub const LUP_API_ANSI = 16777216;
pub const LUP_RESOLUTION_HANDLE = 2147483648;
pub const RESULT_IS_ALIAS = 1;
pub const RESULT_IS_ADDED = 16;
pub const RESULT_IS_CHANGED = 32;
pub const RESULT_IS_DELETED = 64;
pub const POLL = struct {
pub const RDNORM = 256;
pub const RDBAND = 512;
pub const PRI = 1024;
pub const WRNORM = 16;
pub const WRBAND = 32;
pub const ERR = 1;
pub const HUP = 2;
pub const NVAL = 4;
};
pub const TF_DISCONNECT = 1;
pub const TF_REUSE_SOCKET = 2;
pub const TF_WRITE_BEHIND = 4;
pub const TF_USE_DEFAULT_WORKER = 0;
pub const TF_USE_SYSTEM_THREAD = 16;
pub const TF_USE_KERNEL_APC = 32;
pub const TP_ELEMENT_MEMORY = 1;
pub const TP_ELEMENT_FILE = 2;
pub const TP_ELEMENT_EOP = 4;
pub const NLA_ALLUSERS_NETWORK = 1;
pub const NLA_FRIENDLY_NAME = 2;
pub const WSPDESCRIPTION_LEN = 255;
pub const WSS_OPERATION_IN_PROGRESS = 259;
pub const LSP_SYSTEM = 2147483648;
pub const LSP_INSPECTOR = 1;
pub const LSP_REDIRECTOR = 2;
pub const LSP_PROXY = 4;
pub const LSP_FIREWALL = 8;
pub const LSP_INBOUND_MODIFY = 16;
pub const LSP_OUTBOUND_MODIFY = 32;
pub const LSP_CRYPTO_COMPRESS = 64;
pub const LSP_LOCAL_CACHE = 128;
pub const IPPROTO = struct {
pub const IP = 0;
pub const ICMP = 1;
pub const IGMP = 2;
pub const GGP = 3;
pub const TCP = 6;
pub const PUP = 12;
pub const UDP = 17;
pub const IDP = 22;
pub const ND = 77;
pub const RM = 113;
pub const RAW = 255;
pub const MAX = 256;
};
pub const IP_DEFAULT_MULTICAST_TTL = 1;
pub const IP_DEFAULT_MULTICAST_LOOP = 1;
pub const IP_MAX_MEMBERSHIPS = 20;
pub const FD_READ = 1;
pub const FD_WRITE = 2;
pub const FD_OOB = 4;
pub const FD_ACCEPT = 8;
pub const FD_CONNECT = 16;
pub const FD_CLOSE = 32;
pub const SERVICE_RESOURCE = 1;
pub const SERVICE_SERVICE = 2;
pub const SERVICE_LOCAL = 4;
pub const SERVICE_FLAG_DEFER = 1;
pub const SERVICE_FLAG_HARD = 2;
pub const PROP_COMMENT = 1;
pub const PROP_LOCALE = 2;
pub const PROP_DISPLAY_HINT = 4;
pub const PROP_VERSION = 8;
pub const PROP_START_TIME = 16;
pub const PROP_MACHINE = 32;
pub const PROP_ADDRESSES = 256;
pub const PROP_SD = 512;
pub const PROP_ALL = 2147483648;
pub const SERVICE_ADDRESS_FLAG_RPC_CN = 1;
pub const SERVICE_ADDRESS_FLAG_RPC_DG = 2;
pub const SERVICE_ADDRESS_FLAG_RPC_NB = 4;
pub const NS_DEFAULT = 0;
pub const NS_VNS = 50;
pub const NSTYPE_HIERARCHICAL = 1;
pub const NSTYPE_DYNAMIC = 2;
pub const NSTYPE_ENUMERABLE = 4;
pub const NSTYPE_WORKGROUP = 8;
pub const XP_CONNECTIONLESS = 1;
pub const XP_GUARANTEED_DELIVERY = 2;
pub const XP_GUARANTEED_ORDER = 4;
pub const XP_MESSAGE_ORIENTED = 8;
pub const XP_PSEUDO_STREAM = 16;
pub const XP_GRACEFUL_CLOSE = 32;
pub const XP_EXPEDITED_DATA = 64;
pub const XP_CONNECT_DATA = 128;
pub const XP_DISCONNECT_DATA = 256;
pub const XP_SUPPORTS_BROADCAST = 512;
pub const XP_SUPPORTS_MULTICAST = 1024;
pub const XP_BANDWIDTH_ALLOCATION = 2048;
pub const XP_FRAGMENTATION = 4096;
pub const XP_ENCRYPTS = 8192;
pub const RES_SOFT_SEARCH = 1;
pub const RES_FIND_MULTIPLE = 2;
pub const SET_SERVICE_PARTIAL_SUCCESS = 1;
pub const UDP_NOCHECKSUM = 1;
pub const UDP_CHECKSUM_COVERAGE = 20;
pub const GAI_STRERROR_BUFFER_SIZE = 1024;
pub const LPCONDITIONPROC = fn (
lpCallerId: *WSABUF,
lpCallerData: *WSABUF,
lpSQOS: *QOS,
lpGQOS: *QOS,
lpCalleeId: *WSABUF,
lpCalleeData: *WSABUF,
g: *u32,
dwCallbackData: usize,
) callconv(WINAPI) i32;
pub const LPWSAOVERLAPPED_COMPLETION_ROUTINE = fn (
dwError: u32,
cbTransferred: u32,
lpOverlapped: *OVERLAPPED,
dwFlags: u32,
) callconv(WINAPI) void;
pub const FLOWSPEC = extern struct {
TokenRate: u32,
TokenBucketSize: u32,
PeakBandwidth: u32,
Latency: u32,
DelayVariation: u32,
ServiceType: u32,
MaxSduSize: u32,
MinimumPolicedSize: u32,
};
pub const QOS = extern struct {
SendingFlowspec: FLOWSPEC,
ReceivingFlowspec: FLOWSPEC,
ProviderSpecific: WSABUF,
};
pub const SOCKET_ADDRESS = extern struct {
lpSockaddr: *sockaddr,
iSockaddrLength: i32,
};
pub const SOCKET_ADDRESS_LIST = extern struct {
iAddressCount: i32,
Address: [1]SOCKET_ADDRESS,
};
pub const WSADATA = if (@sizeOf(usize) == @sizeOf(u64))
extern struct {
wVersion: WORD,
wHighVersion: WORD,
iMaxSockets: u16,
iMaxUdpDg: u16,
lpVendorInfo: *u8,
szDescription: [WSADESCRIPTION_LEN + 1]u8,
szSystemStatus: [WSASYS_STATUS_LEN + 1]u8,
}
else
extern struct {
wVersion: WORD,
wHighVersion: WORD,
szDescription: [WSADESCRIPTION_LEN + 1]u8,
szSystemStatus: [WSASYS_STATUS_LEN + 1]u8,
iMaxSockets: u16,
iMaxUdpDg: u16,
lpVendorInfo: *u8,
};
pub const WSAPROTOCOLCHAIN = extern struct {
ChainLen: c_int,
ChainEntries: [MAX_PROTOCOL_CHAIN]DWORD,
};
pub const WSAPROTOCOL_INFOA = extern struct {
dwServiceFlags1: DWORD,
dwServiceFlags2: DWORD,
dwServiceFlags3: DWORD,
dwServiceFlags4: DWORD,
dwProviderFlags: DWORD,
ProviderId: GUID,
dwCatalogEntryId: DWORD,
ProtocolChain: WSAPROTOCOLCHAIN,
iVersion: c_int,
iAddressFamily: c_int,
iMaxSockAddr: c_int,
iMinSockAddr: c_int,
iSocketType: c_int,
iProtocol: c_int,
iProtocolMaxOffset: c_int,
iNetworkByteOrder: c_int,
iSecurityScheme: c_int,
dwMessageSize: DWORD,
dwProviderReserved: DWORD,
szProtocol: [WSAPROTOCOL_LEN + 1]CHAR,
};
pub const WSAPROTOCOL_INFOW = extern struct {
dwServiceFlags1: DWORD,
dwServiceFlags2: DWORD,
dwServiceFlags3: DWORD,
dwServiceFlags4: DWORD,
dwProviderFlags: DWORD,
ProviderId: GUID,
dwCatalogEntryId: DWORD,
ProtocolChain: WSAPROTOCOLCHAIN,
iVersion: c_int,
iAddressFamily: c_int,
iMaxSockAddr: c_int,
iMinSockAddr: c_int,
iSocketType: c_int,
iProtocol: c_int,
iProtocolMaxOffset: c_int,
iNetworkByteOrder: c_int,
iSecurityScheme: c_int,
dwMessageSize: DWORD,
dwProviderReserved: DWORD,
szProtocol: [WSAPROTOCOL_LEN + 1]WCHAR,
};
pub const sockproto = extern struct {
sp_family: u16,
sp_protocol: u16,
};
pub const linger = extern struct {
l_onoff: u16,
l_linger: u16,
};
pub const WSANETWORKEVENTS = extern struct {
lNetworkEvents: i32,
iErrorCode: [10]i32,
};
pub const addrinfo = addrinfoa;
pub const addrinfoa = extern struct {
flags: i32,
family: i32,
socktype: i32,
protocol: i32,
addrlen: usize,
canonname: ?[*:0]u8,
addr: ?*sockaddr,
next: ?*addrinfo,
};
pub const addrinfoexA = extern struct {
ai_flags: i32,
ai_family: i32,
ai_socktype: i32,
ai_protocol: i32,
ai_addrlen: usize,
ai_canonname: [*:0]u8,
ai_addr: *sockaddr,
ai_blob: *anyopaque,
ai_bloblen: usize,
ai_provider: *GUID,
ai_next: *addrinfoexA,
};
pub const sockaddr = extern struct {
family: ADDRESS_FAMILY,
data: [14]u8,
pub const SS_MAXSIZE = 128;
pub const storage = std.x.os.Socket.Address.Native.Storage;
/// IPv4 socket address
pub const in = extern struct {
family: ADDRESS_FAMILY = AF.INET,
port: USHORT,
addr: u32,
zero: [8]u8 = [8]u8{ 0, 0, 0, 0, 0, 0, 0, 0 },
};
/// IPv6 socket address
pub const in6 = extern struct {
family: ADDRESS_FAMILY = AF.INET6,
port: USHORT,
flowinfo: u32,
addr: [16]u8,
scope_id: u32,
};
/// UNIX domain socket address
pub const un = extern struct {
family: ADDRESS_FAMILY = AF.UNIX,
path: [108]u8,
};
};
pub const WSABUF = extern struct {
len: ULONG,
buf: [*]u8,
};
pub const msghdr = WSAMSG;
pub const msghdr_const = WSAMSG_const;
pub const WSAMSG_const = extern struct {
name: *const sockaddr,
namelen: INT,
lpBuffers: [*]WSABUF,
dwBufferCount: DWORD,
Control: WSABUF,
dwFlags: DWORD,
};
pub const WSAMSG = extern struct {
name: *sockaddr,
namelen: INT,
lpBuffers: [*]WSABUF,
dwBufferCount: DWORD,
Control: WSABUF,
dwFlags: DWORD,
};
pub const WSAPOLLFD = pollfd;
pub const pollfd = extern struct {
fd: SOCKET,
events: SHORT,
revents: SHORT,
};
pub const TRANSMIT_FILE_BUFFERS = extern struct {
Head: *anyopaque,
HeadLength: u32,
Tail: *anyopaque,
TailLength: u32,
};
pub const LPFN_TRANSMITFILE = fn (
hSocket: SOCKET,
hFile: HANDLE,
nNumberOfBytesToWrite: u32,
nNumberOfBytesPerSend: u32,
lpOverlapped: ?*OVERLAPPED,
lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
dwReserved: u32,
) callconv(WINAPI) BOOL;
pub const LPFN_ACCEPTEX = fn (
sListenSocket: SOCKET,
sAcceptSocket: SOCKET,
lpOutputBuffer: *anyopaque,
dwReceiveDataLength: u32,
dwLocalAddressLength: u32,
dwRemoteAddressLength: u32,
lpdwBytesReceived: *u32,
lpOverlapped: *OVERLAPPED,
) callconv(WINAPI) BOOL;
pub const LPFN_GETACCEPTEXSOCKADDRS = fn (
lpOutputBuffer: *anyopaque,
dwReceiveDataLength: u32,
dwLocalAddressLength: u32,
dwRemoteAddressLength: u32,
LocalSockaddr: **sockaddr,
LocalSockaddrLength: *i32,
RemoteSockaddr: **sockaddr,
RemoteSockaddrLength: *i32,
) callconv(WINAPI) void;
pub const LPFN_WSASENDMSG = fn (
s: SOCKET,
lpMsg: *const std.x.os.Socket.Message,
dwFlags: u32,
lpNumberOfBytesSent: ?*u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub const LPFN_WSARECVMSG = fn (
s: SOCKET,
lpMsg: *std.x.os.Socket.Message,
lpdwNumberOfBytesRecv: ?*u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub const LPSERVICE_CALLBACK_PROC = fn (
lParam: LPARAM,
hAsyncTaskHandle: HANDLE,
) callconv(WINAPI) void;
pub const SERVICE_ASYNC_INFO = extern struct {
lpServiceCallbackProc: LPSERVICE_CALLBACK_PROC,
lParam: LPARAM,
hAsyncTaskHandle: HANDLE,
};
pub const LPLOOKUPSERVICE_COMPLETION_ROUTINE = fn (
dwError: u32,
dwBytes: u32,
lpOverlapped: *OVERLAPPED,
) callconv(WINAPI) void;
pub const fd_set = extern struct {
fd_count: u32,
fd_array: [64]SOCKET,
};
pub const hostent = extern struct {
h_name: [*]u8,
h_aliases: **i8,
h_addrtype: i16,
h_length: i16,
h_addr_list: **i8,
};
// https://docs.microsoft.com/en-au/windows/win32/winsock/windows-sockets-error-codes-2
pub const WinsockError = enum(u16) {
/// Specified event object handle is invalid.
/// An application attempts to use an event object, but the specified handle is not valid.
WSA_INVALID_HANDLE = 6,
/// Insufficient memory available.
/// An application used a Windows Sockets function that directly maps to a Windows function.
/// The Windows function is indicating a lack of required memory resources.
WSA_NOT_ENOUGH_MEMORY = 8,
/// One or more parameters are invalid.
/// An application used a Windows Sockets function which directly maps to a Windows function.
/// The Windows function is indicating a problem with one or more parameters.
WSA_INVALID_PARAMETER = 87,
/// Overlapped operation aborted.
/// An overlapped operation was canceled due to the closure of the socket, or the execution of the SIO_FLUSH command in WSAIoctl.
WSA_OPERATION_ABORTED = 995,
/// Overlapped I/O event object not in signaled state.
/// The application has tried to determine the status of an overlapped operation which is not yet completed.
/// Applications that use WSAGetOverlappedResult (with the fWait flag set to FALSE) in a polling mode to determine when an overlapped operation has completed, get this error code until the operation is complete.
WSA_IO_INCOMPLETE = 996,
/// The application has initiated an overlapped operation that cannot be completed immediately.
/// A completion indication will be given later when the operation has been completed.
WSA_IO_PENDING = 997,
/// Interrupted function call.
/// A blocking operation was interrupted by a call to WSACancelBlockingCall.
WSAEINTR = 10004,
/// File handle is not valid.
/// The file handle supplied is not valid.
WSAEBADF = 10009,
/// Permission denied.
/// An attempt was made to access a socket in a way forbidden by its access permissions.
/// An example is using a broadcast address for sendto without broadcast permission being set using setsockopt(SO.BROADCAST).
/// Another possible reason for the WSAEACCES error is that when the bind function is called (on Windows NT 4.0 with SP4 and later), another application, service, or kernel mode driver is bound to the same address with exclusive access.
/// Such exclusive access is a new feature of Windows NT 4.0 with SP4 and later, and is implemented by using the SO.EXCLUSIVEADDRUSE option.
WSAEACCES = 10013,
/// Bad address.
/// The system detected an invalid pointer address in attempting to use a pointer argument of a call.
/// This error occurs if an application passes an invalid pointer value, or if the length of the buffer is too small.
/// For instance, if the length of an argument, which is a sockaddr structure, is smaller than the sizeof(sockaddr).
WSAEFAULT = 10014,
/// Invalid argument.
/// Some invalid argument was supplied (for example, specifying an invalid level to the setsockopt function).
/// In some instances, it also refers to the current state of the socket—for instance, calling accept on a socket that is not listening.
WSAEINVAL = 10022,
/// Too many open files.
/// Too many open sockets. Each implementation may have a maximum number of socket handles available, either globally, per process, or per thread.
WSAEMFILE = 10024,
/// Resource temporarily unavailable.
/// This error is returned from operations on nonblocking sockets that cannot be completed immediately, for example recv when no data is queued to be read from the socket.
/// It is a nonfatal error, and the operation should be retried later.
/// It is normal for WSAEWOULDBLOCK to be reported as the result from calling connect on a nonblocking SOCK.STREAM socket, since some time must elapse for the connection to be established.
WSAEWOULDBLOCK = 10035,
/// Operation now in progress.
/// A blocking operation is currently executing.
/// Windows Sockets only allows a single blocking operation—per- task or thread—to be outstanding, and if any other function call is made (whether or not it references that or any other socket) the function fails with the WSAEINPROGRESS error.
WSAEINPROGRESS = 10036,
/// Operation already in progress.
/// An operation was attempted on a nonblocking socket with an operation already in progress—that is, calling connect a second time on a nonblocking socket that is already connecting, or canceling an asynchronous request (WSAAsyncGetXbyY) that has already been canceled or completed.
WSAEALREADY = 10037,
/// Socket operation on nonsocket.
/// An operation was attempted on something that is not a socket.
/// Either the socket handle parameter did not reference a valid socket, or for select, a member of an fd_set was not valid.
WSAENOTSOCK = 10038,
/// Destination address required.
/// A required address was omitted from an operation on a socket.
/// For example, this error is returned if sendto is called with the remote address of ADDR_ANY.
WSAEDESTADDRREQ = 10039,
/// Message too long.
/// A message sent on a datagram socket was larger than the internal message buffer or some other network limit, or the buffer used to receive a datagram was smaller than the datagram itself.
WSAEMSGSIZE = 10040,
/// Protocol wrong type for socket.
/// A protocol was specified in the socket function call that does not support the semantics of the socket type requested.
/// For example, the ARPA Internet UDP protocol cannot be specified with a socket type of SOCK.STREAM.
WSAEPROTOTYPE = 10041,
/// Bad protocol option.
/// An unknown, invalid or unsupported option or level was specified in a getsockopt or setsockopt call.
WSAENOPROTOOPT = 10042,
/// Protocol not supported.
/// The requested protocol has not been configured into the system, or no implementation for it exists.
/// For example, a socket call requests a SOCK.DGRAM socket, but specifies a stream protocol.
WSAEPROTONOSUPPORT = 10043,
/// Socket type not supported.
/// The support for the specified socket type does not exist in this address family.
/// For example, the optional type SOCK.RAW might be selected in a socket call, and the implementation does not support SOCK.RAW sockets at all.
WSAESOCKTNOSUPPORT = 10044,
/// Operation not supported.
/// The attempted operation is not supported for the type of object referenced.
/// Usually this occurs when a socket descriptor to a socket that cannot support this operation is trying to accept a connection on a datagram socket.
WSAEOPNOTSUPP = 10045,
/// Protocol family not supported.
/// The protocol family has not been configured into the system or no implementation for it exists.
/// This message has a slightly different meaning from WSAEAFNOSUPPORT.
/// However, it is interchangeable in most cases, and all Windows Sockets functions that return one of these messages also specify WSAEAFNOSUPPORT.
WSAEPFNOSUPPORT = 10046,
/// Address family not supported by protocol family.
/// An address incompatible with the requested protocol was used.
/// All sockets are created with an associated address family (that is, AF.INET for Internet Protocols) and a generic protocol type (that is, SOCK.STREAM).
/// This error is returned if an incorrect protocol is explicitly requested in the socket call, or if an address of the wrong family is used for a socket, for example, in sendto.
WSAEAFNOSUPPORT = 10047,
/// Address already in use.
/// Typically, only one usage of each socket address (protocol/IP address/port) is permitted.
/// This error occurs if an application attempts to bind a socket to an IP address/port that has already been used for an existing socket, or a socket that was not closed properly, or one that is still in the process of closing.
/// For server applications that need to bind multiple sockets to the same port number, consider using setsockopt (SO.REUSEADDR).
/// Client applications usually need not call bind at all—connect chooses an unused port automatically.
/// When bind is called with a wildcard address (involving ADDR_ANY), a WSAEADDRINUSE error could be delayed until the specific address is committed.
/// This could happen with a call to another function later, including connect, listen, WSAConnect, or WSAJoinLeaf.
WSAEADDRINUSE = 10048,
/// Cannot assign requested address.
/// The requested address is not valid in its context.
/// This normally results from an attempt to bind to an address that is not valid for the local computer.
/// This can also result from connect, sendto, WSAConnect, WSAJoinLeaf, or WSASendTo when the remote address or port is not valid for a remote computer (for example, address or port 0).
WSAEADDRNOTAVAIL = 10049,
/// Network is down.
/// A socket operation encountered a dead network.
/// This could indicate a serious failure of the network system (that is, the protocol stack that the Windows Sockets DLL runs over), the network interface, or the local network itself.
WSAENETDOWN = 10050,
/// Network is unreachable.
/// A socket operation was attempted to an unreachable network.
/// This usually means the local software knows no route to reach the remote host.
WSAENETUNREACH = 10051,
/// Network dropped connection on reset.
/// The connection has been broken due to keep-alive activity detecting a failure while the operation was in progress.
/// It can also be returned by setsockopt if an attempt is made to set SO.KEEPALIVE on a connection that has already failed.
WSAENETRESET = 10052,
/// Software caused connection abort.
/// An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error.
WSAECONNABORTED = 10053,
/// Connection reset by peer.
/// An existing connection was forcibly closed by the remote host.
/// This normally results if the peer application on the remote host is suddenly stopped, the host is rebooted, the host or remote network interface is disabled, or the remote host uses a hard close (see setsockopt for more information on the SO.LINGER option on the remote socket).
/// This error may also result if a connection was broken due to keep-alive activity detecting a failure while one or more operations are in progress.
/// Operations that were in progress fail with WSAENETRESET. Subsequent operations fail with WSAECONNRESET.
WSAECONNRESET = 10054,
/// No buffer space available.
/// An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.
WSAENOBUFS = 10055,
/// Socket is already connected.
/// A connect request was made on an already-connected socket.
/// Some implementations also return this error if sendto is called on a connected SOCK.DGRAM socket (for SOCK.STREAM sockets, the to parameter in sendto is ignored) although other implementations treat this as a legal occurrence.
WSAEISCONN = 10056,
/// Socket is not connected.
/// A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using sendto) no address was supplied.
/// Any other type of operation might also return this error—for example, setsockopt setting SO.KEEPALIVE if the connection has been reset.
WSAENOTCONN = 10057,
/// Cannot send after socket shutdown.
/// A request to send or receive data was disallowed because the socket had already been shut down in that direction with a previous shutdown call.
/// By calling shutdown a partial close of a socket is requested, which is a signal that sending or receiving, or both have been discontinued.
WSAESHUTDOWN = 10058,
/// Too many references.
/// Too many references to some kernel object.
WSAETOOMANYREFS = 10059,
/// Connection timed out.
/// A connection attempt failed because the connected party did not properly respond after a period of time, or the established connection failed because the connected host has failed to respond.
WSAETIMEDOUT = 10060,
/// Connection refused.
/// No connection could be made because the target computer actively refused it.
/// This usually results from trying to connect to a service that is inactive on the foreign host—that is, one with no server application running.
WSAECONNREFUSED = 10061,
/// Cannot translate name.
/// Cannot translate a name.
WSAELOOP = 10062,
/// Name too long.
/// A name component or a name was too long.
WSAENAMETOOLONG = 10063,
/// Host is down.
/// A socket operation failed because the destination host is down. A socket operation encountered a dead host.
/// Networking activity on the local host has not been initiated.
/// These conditions are more likely to be indicated by the error WSAETIMEDOUT.
WSAEHOSTDOWN = 10064,
/// No route to host.
/// A socket operation was attempted to an unreachable host. See WSAENETUNREACH.
WSAEHOSTUNREACH = 10065,
/// Directory not empty.
/// Cannot remove a directory that is not empty.
WSAENOTEMPTY = 10066,
/// Too many processes.
/// A Windows Sockets implementation may have a limit on the number of applications that can use it simultaneously.
/// WSAStartup may fail with this error if the limit has been reached.
WSAEPROCLIM = 10067,
/// User quota exceeded.
/// Ran out of user quota.
WSAEUSERS = 10068,
/// Disk quota exceeded.
/// Ran out of disk quota.
WSAEDQUOT = 10069,
/// Stale file handle reference.
/// The file handle reference is no longer available.
WSAESTALE = 10070,
/// Item is remote.
/// The item is not available locally.
WSAEREMOTE = 10071,
/// Network subsystem is unavailable.
/// This error is returned by WSAStartup if the Windows Sockets implementation cannot function at this time because the underlying system it uses to provide network services is currently unavailable.
/// Users should check:
/// - That the appropriate Windows Sockets DLL file is in the current path.
/// - That they are not trying to use more than one Windows Sockets implementation simultaneously.
/// - If there is more than one Winsock DLL on your system, be sure the first one in the path is appropriate for the network subsystem currently loaded.
/// - The Windows Sockets implementation documentation to be sure all necessary components are currently installed and configured correctly.
WSASYSNOTREADY = 10091,
/// Winsock.dll version out of range.
/// The current Windows Sockets implementation does not support the Windows Sockets specification version requested by the application.
/// Check that no old Windows Sockets DLL files are being accessed.
WSAVERNOTSUPPORTED = 10092,
/// Successful WSAStartup not yet performed.
/// Either the application has not called WSAStartup or WSAStartup failed.
/// The application may be accessing a socket that the current active task does not own (that is, trying to share a socket between tasks), or WSACleanup has been called too many times.
WSANOTINITIALISED = 10093,
/// Graceful shutdown in progress.
/// Returned by WSARecv and WSARecvFrom to indicate that the remote party has initiated a graceful shutdown sequence.
WSAEDISCON = 10101,
/// No more results.
/// No more results can be returned by the WSALookupServiceNext function.
WSAENOMORE = 10102,
/// Call has been canceled.
/// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled.
WSAECANCELLED = 10103,
/// Procedure call table is invalid.
/// The service provider procedure call table is invalid.
/// A service provider returned a bogus procedure table to Ws2_32.dll.
/// This is usually caused by one or more of the function pointers being NULL.
WSAEINVALIDPROCTABLE = 10104,
/// Service provider is invalid.
/// The requested service provider is invalid.
/// This error is returned by the WSCGetProviderInfo and WSCGetProviderInfo32 functions if the protocol entry specified could not be found.
/// This error is also returned if the service provider returned a version number other than 2.0.
WSAEINVALIDPROVIDER = 10105,
/// Service provider failed to initialize.
/// The requested service provider could not be loaded or initialized.
/// This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.
WSAEPROVIDERFAILEDINIT = 10106,
/// System call failure.
/// A system call that should never fail has failed.
/// This is a generic error code, returned under various conditions.
/// Returned when a system call that should never fail does fail.
/// For example, if a call to WaitForMultipleEvents fails or one of the registry functions fails trying to manipulate the protocol/namespace catalogs.
/// Returned when a provider does not return SUCCESS and does not provide an extended error code.
/// Can indicate a service provider implementation error.
WSASYSCALLFAILURE = 10107,
/// Service not found.
/// No such service is known. The service cannot be found in the specified name space.
WSASERVICE_NOT_FOUND = 10108,
/// Class type not found.
/// The specified class was not found.
WSATYPE_NOT_FOUND = 10109,
/// No more results.
/// No more results can be returned by the WSALookupServiceNext function.
WSA_E_NO_MORE = 10110,
/// Call was canceled.
/// A call to the WSALookupServiceEnd function was made while this call was still processing. The call has been canceled.
WSA_E_CANCELLED = 10111,
/// Database query was refused.
/// A database query failed because it was actively refused.
WSAEREFUSED = 10112,
/// Host not found.
/// No such host is known. The name is not an official host name or alias, or it cannot be found in the database(s) being queried.
/// This error may also be returned for protocol and service queries, and means that the specified name could not be found in the relevant database.
WSAHOST_NOT_FOUND = 11001,
/// Nonauthoritative host not found.
/// This is usually a temporary error during host name resolution and means that the local server did not receive a response from an authoritative server. A retry at some time later may be successful.
WSATRY_AGAIN = 11002,
/// This is a nonrecoverable error.
/// This indicates that some sort of nonrecoverable error occurred during a database lookup.
/// This may be because the database files (for example, BSD-compatible HOSTS, SERVICES, or PROTOCOLS files) could not be found, or a DNS request was returned by the server with a severe error.
WSANO_RECOVERY = 11003,
/// Valid name, no data record of requested type.
/// The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for.
/// The usual example for this is a host name-to-address translation attempt (using gethostbyname or WSAAsyncGetHostByName) which uses the DNS (Domain Name Server).
/// An MX record is returned but no A record—indicating the host itself exists, but is not directly reachable.
WSANO_DATA = 11004,
/// QoS receivers.
/// At least one QoS reserve has arrived.
WSA_QOS_RECEIVERS = 11005,
/// QoS senders.
/// At least one QoS send path has arrived.
WSA_QOS_SENDERS = 11006,
/// No QoS senders.
/// There are no QoS senders.
WSA_QOS_NO_SENDERS = 11007,
/// QoS no receivers.
/// There are no QoS receivers.
WSA_QOS_NO_RECEIVERS = 11008,
/// QoS request confirmed.
/// The QoS reserve request has been confirmed.
WSA_QOS_REQUEST_CONFIRMED = 11009,
/// QoS admission error.
/// A QoS error occurred due to lack of resources.
WSA_QOS_ADMISSION_FAILURE = 11010,
/// QoS policy failure.
/// The QoS request was rejected because the policy system couldn't allocate the requested resource within the existing policy.
WSA_QOS_POLICY_FAILURE = 11011,
/// QoS bad style.
/// An unknown or conflicting QoS style was encountered.
WSA_QOS_BAD_STYLE = 11012,
/// QoS bad object.
/// A problem was encountered with some part of the filterspec or the provider-specific buffer in general.
WSA_QOS_BAD_OBJECT = 11013,
/// QoS traffic control error.
/// An error with the underlying traffic control (TC) API as the generic QoS request was converted for local enforcement by the TC API.
/// This could be due to an out of memory error or to an internal QoS provider error.
WSA_QOS_TRAFFIC_CTRL_ERROR = 11014,
/// QoS generic error.
/// A general QoS error.
WSA_QOS_GENERIC_ERROR = 11015,
/// QoS service type error.
/// An invalid or unrecognized service type was found in the QoS flowspec.
WSA_QOS_ESERVICETYPE = 11016,
/// QoS flowspec error.
/// An invalid or inconsistent flowspec was found in the QOS structure.
WSA_QOS_EFLOWSPEC = 11017,
/// Invalid QoS provider buffer.
/// An invalid QoS provider-specific buffer.
WSA_QOS_EPROVSPECBUF = 11018,
/// Invalid QoS filter style.
/// An invalid QoS filter style was used.
WSA_QOS_EFILTERSTYLE = 11019,
/// Invalid QoS filter type.
/// An invalid QoS filter type was used.
WSA_QOS_EFILTERTYPE = 11020,
/// Incorrect QoS filter count.
/// An incorrect number of QoS FILTERSPECs were specified in the FLOWDESCRIPTOR.
WSA_QOS_EFILTERCOUNT = 11021,
/// Invalid QoS object length.
/// An object with an invalid ObjectLength field was specified in the QoS provider-specific buffer.
WSA_QOS_EOBJLENGTH = 11022,
/// Incorrect QoS flow count.
/// An incorrect number of flow descriptors was specified in the QoS structure.
WSA_QOS_EFLOWCOUNT = 11023,
/// Unrecognized QoS object.
/// An unrecognized object was found in the QoS provider-specific buffer.
WSA_QOS_EUNKOWNPSOBJ = 11024,
/// Invalid QoS policy object.
/// An invalid policy object was found in the QoS provider-specific buffer.
WSA_QOS_EPOLICYOBJ = 11025,
/// Invalid QoS flow descriptor.
/// An invalid QoS flow descriptor was found in the flow descriptor list.
WSA_QOS_EFLOWDESC = 11026,
/// Invalid QoS provider-specific flowspec.
/// An invalid or inconsistent flowspec was found in the QoS provider-specific buffer.
WSA_QOS_EPSFLOWSPEC = 11027,
/// Invalid QoS provider-specific filterspec.
/// An invalid FILTERSPEC was found in the QoS provider-specific buffer.
WSA_QOS_EPSFILTERSPEC = 11028,
/// Invalid QoS shape discard mode object.
/// An invalid shape discard mode object was found in the QoS provider-specific buffer.
WSA_QOS_ESDMODEOBJ = 11029,
/// Invalid QoS shaping rate object.
/// An invalid shaping rate object was found in the QoS provider-specific buffer.
WSA_QOS_ESHAPERATEOBJ = 11030,
/// Reserved policy QoS element type.
/// A reserved policy element was found in the QoS provider-specific buffer.
WSA_QOS_RESERVED_PETYPE = 11031,
_,
};
pub extern "ws2_32" fn accept(
s: SOCKET,
addr: ?*sockaddr,
addrlen: ?*i32,
) callconv(WINAPI) SOCKET;
pub extern "ws2_32" fn bind(
s: SOCKET,
name: *const sockaddr,
namelen: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn closesocket(
s: SOCKET,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn connect(
s: SOCKET,
name: *const sockaddr,
namelen: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn ioctlsocket(
s: SOCKET,
cmd: i32,
argp: *u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn getpeername(
s: SOCKET,
name: *sockaddr,
namelen: *i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn getsockname(
s: SOCKET,
name: *sockaddr,
namelen: *i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn getsockopt(
s: SOCKET,
level: i32,
optname: i32,
optval: [*]u8,
optlen: *i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn htonl(
hostlong: u32,
) callconv(WINAPI) u32;
pub extern "ws2_32" fn htons(
hostshort: u16,
) callconv(WINAPI) u16;
pub extern "ws2_32" fn inet_addr(
cp: ?[*]const u8,
) callconv(WINAPI) u32;
pub extern "ws2_32" fn listen(
s: SOCKET,
backlog: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn ntohl(
netlong: u32,
) callconv(WINAPI) u32;
pub extern "ws2_32" fn ntohs(
netshort: u16,
) callconv(WINAPI) u16;
pub extern "ws2_32" fn recv(
s: SOCKET,
buf: [*]u8,
len: i32,
flags: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn recvfrom(
s: SOCKET,
buf: [*]u8,
len: i32,
flags: i32,
from: ?*sockaddr,
fromlen: ?*i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn select(
nfds: i32,
readfds: ?*fd_set,
writefds: ?*fd_set,
exceptfds: ?*fd_set,
timeout: ?*const timeval,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn send(
s: SOCKET,
buf: [*]const u8,
len: i32,
flags: u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn sendto(
s: SOCKET,
buf: [*]const u8,
len: i32,
flags: i32,
to: *const sockaddr,
tolen: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn setsockopt(
s: SOCKET,
level: i32,
optname: i32,
optval: ?[*]const u8,
optlen: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn shutdown(
s: SOCKET,
how: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn socket(
af: i32,
@"type": i32,
protocol: i32,
) callconv(WINAPI) SOCKET;
pub extern "ws2_32" fn WSAStartup(
wVersionRequired: WORD,
lpWSAData: *WSADATA,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSACleanup() callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASetLastError(iError: i32) callconv(WINAPI) void;
pub extern "ws2_32" fn WSAGetLastError() callconv(WINAPI) WinsockError;
pub extern "ws2_32" fn WSAIsBlocking() callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSAUnhookBlockingHook() callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASetBlockingHook(lpBlockFunc: FARPROC) callconv(WINAPI) FARPROC;
pub extern "ws2_32" fn WSACancelBlockingCall() callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAAsyncGetServByName(
hWnd: HWND,
wMsg: u32,
name: [*:0]const u8,
proto: ?[*:0]const u8,
buf: [*]u8,
buflen: i32,
) callconv(WINAPI) HANDLE;
pub extern "ws2_32" fn WSAAsyncGetServByPort(
hWnd: HWND,
wMsg: u32,
port: i32,
proto: ?[*:0]const u8,
buf: [*]u8,
buflen: i32,
) callconv(WINAPI) HANDLE;
pub extern "ws2_32" fn WSAAsyncGetProtoByName(
hWnd: HWND,
wMsg: u32,
name: [*:0]const u8,
buf: [*]u8,
buflen: i32,
) callconv(WINAPI) HANDLE;
pub extern "ws2_32" fn WSAAsyncGetProtoByNumber(
hWnd: HWND,
wMsg: u32,
number: i32,
buf: [*]u8,
buflen: i32,
) callconv(WINAPI) HANDLE;
pub extern "ws2_32" fn WSACancelAsyncRequest(hAsyncTaskHandle: HANDLE) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAAsyncSelect(
s: SOCKET,
hWnd: HWND,
wMsg: u32,
lEvent: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAAccept(
s: SOCKET,
addr: ?*sockaddr,
addrlen: ?*i32,
lpfnCondition: ?LPCONDITIONPROC,
dwCallbackData: usize,
) callconv(WINAPI) SOCKET;
pub extern "ws2_32" fn WSACloseEvent(hEvent: HANDLE) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSAConnect(
s: SOCKET,
name: *const sockaddr,
namelen: i32,
lpCallerData: ?*WSABUF,
lpCalleeData: ?*WSABUF,
lpSQOS: ?*QOS,
lpGQOS: ?*QOS,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAConnectByNameW(
s: SOCKET,
nodename: [*:0]const u16,
servicename: [*:0]const u16,
LocalAddressLength: ?*u32,
LocalAddress: ?*sockaddr,
RemoteAddressLength: ?*u32,
RemoteAddress: ?*sockaddr,
timeout: ?*const timeval,
Reserved: *OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSAConnectByNameA(
s: SOCKET,
nodename: [*:0]const u8,
servicename: [*:0]const u8,
LocalAddressLength: ?*u32,
LocalAddress: ?*sockaddr,
RemoteAddressLength: ?*u32,
RemoteAddress: ?*sockaddr,
timeout: ?*const timeval,
Reserved: *OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSAConnectByList(
s: SOCKET,
SocketAddress: *SOCKET_ADDRESS_LIST,
LocalAddressLength: ?*u32,
LocalAddress: ?*sockaddr,
RemoteAddressLength: ?*u32,
RemoteAddress: ?*sockaddr,
timeout: ?*const timeval,
Reserved: *OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSACreateEvent() callconv(WINAPI) HANDLE;
pub extern "ws2_32" fn WSADuplicateSocketA(
s: SOCKET,
dwProcessId: u32,
lpProtocolInfo: *WSAPROTOCOL_INFOA,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSADuplicateSocketW(
s: SOCKET,
dwProcessId: u32,
lpProtocolInfo: *WSAPROTOCOL_INFOW,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAEnumNetworkEvents(
s: SOCKET,
hEventObject: HANDLE,
lpNetworkEvents: *WSANETWORKEVENTS,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAEnumProtocolsA(
lpiProtocols: ?*i32,
lpProtocolBuffer: ?*WSAPROTOCOL_INFOA,
lpdwBufferLength: *u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAEnumProtocolsW(
lpiProtocols: ?*i32,
lpProtocolBuffer: ?*WSAPROTOCOL_INFOW,
lpdwBufferLength: *u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAEventSelect(
s: SOCKET,
hEventObject: HANDLE,
lNetworkEvents: i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAGetOverlappedResult(
s: SOCKET,
lpOverlapped: *OVERLAPPED,
lpcbTransfer: *u32,
fWait: BOOL,
lpdwFlags: *u32,
) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSAGetQOSByName(
s: SOCKET,
lpQOSName: *WSABUF,
lpQOS: *QOS,
) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSAHtonl(
s: SOCKET,
hostlong: u32,
lpnetlong: *u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAHtons(
s: SOCKET,
hostshort: u16,
lpnetshort: *u16,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAIoctl(
s: SOCKET,
dwIoControlCode: u32,
lpvInBuffer: ?*const anyopaque,
cbInBuffer: u32,
lpvOutbuffer: ?*anyopaque,
cbOutbuffer: u32,
lpcbBytesReturned: *u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAJoinLeaf(
s: SOCKET,
name: *const sockaddr,
namelen: i32,
lpCallerdata: ?*WSABUF,
lpCalleeData: ?*WSABUF,
lpSQOS: ?*QOS,
lpGQOS: ?*QOS,
dwFlags: u32,
) callconv(WINAPI) SOCKET;
pub extern "ws2_32" fn WSANtohl(
s: SOCKET,
netlong: u32,
lphostlong: *u32,
) callconv(WINAPI) u32;
pub extern "ws2_32" fn WSANtohs(
s: SOCKET,
netshort: u16,
lphostshort: *u16,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSARecv(
s: SOCKET,
lpBuffers: [*]WSABUF,
dwBufferCouynt: u32,
lpNumberOfBytesRecv: ?*u32,
lpFlags: *u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSARecvDisconnect(
s: SOCKET,
lpInboundDisconnectData: ?*WSABUF,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSARecvFrom(
s: SOCKET,
lpBuffers: [*]WSABUF,
dwBuffercount: u32,
lpNumberOfBytesRecvd: ?*u32,
lpFlags: *u32,
lpFrom: ?*sockaddr,
lpFromlen: ?*i32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAResetEvent(hEvent: HANDLE) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASend(
s: SOCKET,
lpBuffers: [*]WSABUF,
dwBufferCount: u32,
lpNumberOfBytesSent: ?*u32,
dwFlags: u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASendMsg(
s: SOCKET,
lpMsg: *const std.x.os.Socket.Message,
dwFlags: u32,
lpNumberOfBytesSent: ?*u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSARecvMsg(
s: SOCKET,
lpMsg: *std.x.os.Socket.Message,
lpdwNumberOfBytesRecv: ?*u32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASendDisconnect(
s: SOCKET,
lpOutboundDisconnectData: ?*WSABUF,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASendTo(
s: SOCKET,
lpBuffers: [*]WSABUF,
dwBufferCount: u32,
lpNumberOfBytesSent: ?*u32,
dwFlags: u32,
lpTo: ?*const sockaddr,
iToLen: i32,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRounte: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSASetEvent(
hEvent: HANDLE,
) callconv(WINAPI) BOOL;
pub extern "ws2_32" fn WSASocketA(
af: i32,
@"type": i32,
protocol: i32,
lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
g: u32,
dwFlags: u32,
) callconv(WINAPI) SOCKET;
pub extern "ws2_32" fn WSASocketW(
af: i32,
@"type": i32,
protocol: i32,
lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
g: u32,
dwFlags: u32,
) callconv(WINAPI) SOCKET;
pub extern "ws2_32" fn WSAWaitForMultipleEvents(
cEvents: u32,
lphEvents: [*]const HANDLE,
fWaitAll: BOOL,
dwTimeout: u32,
fAlertable: BOOL,
) callconv(WINAPI) u32;
pub extern "ws2_32" fn WSAAddressToStringA(
lpsaAddress: *sockaddr,
dwAddressLength: u32,
lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
lpszAddressString: [*]u8,
lpdwAddressStringLength: *u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAAddressToStringW(
lpsaAddress: *sockaddr,
dwAddressLength: u32,
lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
lpszAddressString: [*]u16,
lpdwAddressStringLength: *u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAStringToAddressA(
AddressString: [*:0]const u8,
AddressFamily: i32,
lpProtocolInfo: ?*WSAPROTOCOL_INFOA,
lpAddress: *sockaddr,
lpAddressLength: *i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAStringToAddressW(
AddressString: [*:0]const u16,
AddressFamily: i32,
lpProtocolInfo: ?*WSAPROTOCOL_INFOW,
lpAddrses: *sockaddr,
lpAddressLength: *i32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAProviderConfigChange(
lpNotificationHandle: *HANDLE,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPWSAOVERLAPPED_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn WSAPoll(
fdArray: [*]WSAPOLLFD,
fds: u32,
timeout: i32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn WSARecvEx(
s: SOCKET,
buf: [*]u8,
len: i32,
flags: *i32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn TransmitFile(
hSocket: SOCKET,
hFile: HANDLE,
nNumberOfBytesToWrite: u32,
nNumberOfBytesPerSend: u32,
lpOverlapped: ?*OVERLAPPED,
lpTransmitBuffers: ?*TRANSMIT_FILE_BUFFERS,
dwReserved: u32,
) callconv(WINAPI) BOOL;
pub extern "mswsock" fn AcceptEx(
sListenSocket: SOCKET,
sAcceptSocket: SOCKET,
lpOutputBuffer: *anyopaque,
dwReceiveDataLength: u32,
dwLocalAddressLength: u32,
dwRemoteAddressLength: u32,
lpdwBytesReceived: *u32,
lpOverlapped: *OVERLAPPED,
) callconv(WINAPI) BOOL;
pub extern "mswsock" fn GetAcceptExSockaddrs(
lpOutputBuffer: *anyopaque,
dwReceiveDataLength: u32,
dwLocalAddressLength: u32,
dwRemoteAddressLength: u32,
LocalSockaddr: **sockaddr,
LocalSockaddrLength: *i32,
RemoteSockaddr: **sockaddr,
RemoteSockaddrLength: *i32,
) callconv(WINAPI) void;
pub extern "ws2_32" fn WSAProviderCompleteAsyncCall(
hAsyncCall: HANDLE,
iRetCode: i32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn EnumProtocolsA(
lpiProtocols: ?*i32,
lpProtocolBuffer: *anyopaque,
lpdwBufferLength: *u32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn EnumProtocolsW(
lpiProtocols: ?*i32,
lpProtocolBuffer: *anyopaque,
lpdwBufferLength: *u32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn GetAddressByNameA(
dwNameSpace: u32,
lpServiceType: *GUID,
lpServiceName: ?[*:0]u8,
lpiProtocols: ?*i32,
dwResolution: u32,
lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO,
lpCsaddrBuffer: *anyopaque,
lpAliasBuffer: ?[*:0]const u8,
lpdwAliasBufferLength: *u32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn GetAddressByNameW(
dwNameSpace: u32,
lpServiceType: *GUID,
lpServiceName: ?[*:0]u16,
lpiProtocols: ?*i32,
dwResolution: u32,
lpServiceAsyncInfo: ?*SERVICE_ASYNC_INFO,
lpCsaddrBuffer: *anyopaque,
ldwBufferLEngth: *u32,
lpAliasBuffer: ?[*:0]u16,
lpdwAliasBufferLength: *u32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn GetTypeByNameA(
lpServiceName: [*:0]u8,
lpServiceType: *GUID,
) callconv(WINAPI) i32;
pub extern "mswsock" fn GetTypeByNameW(
lpServiceName: [*:0]u16,
lpServiceType: *GUID,
) callconv(WINAPI) i32;
pub extern "mswsock" fn GetNameByTypeA(
lpServiceType: *GUID,
lpServiceName: [*:0]u8,
dwNameLength: u32,
) callconv(WINAPI) i32;
pub extern "mswsock" fn GetNameByTypeW(
lpServiceType: *GUID,
lpServiceName: [*:0]u16,
dwNameLength: u32,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn getaddrinfo(
pNodeName: ?[*:0]const u8,
pServiceName: ?[*:0]const u8,
pHints: ?*const addrinfoa,
ppResult: **addrinfoa,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn GetAddrInfoExA(
pName: ?[*:0]const u8,
pServiceName: ?[*:0]const u8,
dwNameSapce: u32,
lpNspId: ?*GUID,
hints: ?*const addrinfoexA,
ppResult: **addrinfoexA,
timeout: ?*timeval,
lpOverlapped: ?*OVERLAPPED,
lpCompletionRoutine: ?LPLOOKUPSERVICE_COMPLETION_ROUTINE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn GetAddrInfoExCancel(
lpHandle: *HANDLE,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn GetAddrInfoExOverlappedResult(
lpOverlapped: *OVERLAPPED,
) callconv(WINAPI) i32;
pub extern "ws2_32" fn freeaddrinfo(
pAddrInfo: ?*addrinfoa,
) callconv(WINAPI) void;
pub extern "ws2_32" fn FreeAddrInfoEx(
pAddrInfoEx: ?*addrinfoexA,
) callconv(WINAPI) void;
pub extern "ws2_32" fn getnameinfo(
pSockaddr: *const sockaddr,
SockaddrLength: i32,
pNodeBuffer: ?[*]u8,
NodeBufferSize: u32,
pServiceBuffer: ?[*]u8,
ServiceBufferName: u32,
Flags: i32,
) callconv(WINAPI) i32;
pub extern "IPHLPAPI" fn if_nametoindex(
InterfaceName: [*:0]const u8,
) callconv(WINAPI) u32;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/windows/ole32.zig | const std = @import("../../std.zig");
const windows = std.os.windows;
const WINAPI = windows.WINAPI;
const LPVOID = windows.LPVOID;
const DWORD = windows.DWORD;
const HRESULT = windows.HRESULT;
pub extern "ole32" fn CoTaskMemFree(pv: LPVOID) callconv(WINAPI) void;
pub extern "ole32" fn CoUninitialize() callconv(WINAPI) void;
pub extern "ole32" fn CoGetCurrentProcess() callconv(WINAPI) DWORD;
pub extern "ole32" fn CoInitializeEx(pvReserved: ?LPVOID, dwCoInit: DWORD) callconv(WINAPI) HRESULT;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols.zig | pub const LoadedImageProtocol = @import("protocols/loaded_image_protocol.zig").LoadedImageProtocol;
pub const loaded_image_device_path_protocol_guid = @import("protocols/loaded_image_protocol.zig").loaded_image_device_path_protocol_guid;
pub const AcpiDevicePath = @import("protocols/device_path_protocol.zig").AcpiDevicePath;
pub const BiosBootSpecificationDevicePath = @import("protocols/device_path_protocol.zig").BiosBootSpecificationDevicePath;
pub const DevicePath = @import("protocols/device_path_protocol.zig").DevicePath;
pub const DevicePathProtocol = @import("protocols/device_path_protocol.zig").DevicePathProtocol;
pub const DevicePathType = @import("protocols/device_path_protocol.zig").DevicePathType;
pub const EndDevicePath = @import("protocols/device_path_protocol.zig").EndDevicePath;
pub const HardwareDevicePath = @import("protocols/device_path_protocol.zig").HardwareDevicePath;
pub const MediaDevicePath = @import("protocols/device_path_protocol.zig").MediaDevicePath;
pub const MessagingDevicePath = @import("protocols/device_path_protocol.zig").MessagingDevicePath;
pub const SimpleFileSystemProtocol = @import("protocols/simple_file_system_protocol.zig").SimpleFileSystemProtocol;
pub const FileProtocol = @import("protocols/file_protocol.zig").FileProtocol;
pub const FileInfo = @import("protocols/file_protocol.zig").FileInfo;
pub const InputKey = @import("protocols/simple_text_input_ex_protocol.zig").InputKey;
pub const KeyData = @import("protocols/simple_text_input_ex_protocol.zig").KeyData;
pub const KeyState = @import("protocols/simple_text_input_ex_protocol.zig").KeyState;
pub const SimpleTextInputProtocol = @import("protocols/simple_text_input_protocol.zig").SimpleTextInputProtocol;
pub const SimpleTextInputExProtocol = @import("protocols/simple_text_input_ex_protocol.zig").SimpleTextInputExProtocol;
pub const SimpleTextOutputMode = @import("protocols/simple_text_output_protocol.zig").SimpleTextOutputMode;
pub const SimpleTextOutputProtocol = @import("protocols/simple_text_output_protocol.zig").SimpleTextOutputProtocol;
pub const SimplePointerMode = @import("protocols/simple_pointer_protocol.zig").SimplePointerMode;
pub const SimplePointerProtocol = @import("protocols/simple_pointer_protocol.zig").SimplePointerProtocol;
pub const SimplePointerState = @import("protocols/simple_pointer_protocol.zig").SimplePointerState;
pub const AbsolutePointerMode = @import("protocols/absolute_pointer_protocol.zig").AbsolutePointerMode;
pub const AbsolutePointerProtocol = @import("protocols/absolute_pointer_protocol.zig").AbsolutePointerProtocol;
pub const AbsolutePointerState = @import("protocols/absolute_pointer_protocol.zig").AbsolutePointerState;
pub const GraphicsOutputBltPixel = @import("protocols/graphics_output_protocol.zig").GraphicsOutputBltPixel;
pub const GraphicsOutputBltOperation = @import("protocols/graphics_output_protocol.zig").GraphicsOutputBltOperation;
pub const GraphicsOutputModeInformation = @import("protocols/graphics_output_protocol.zig").GraphicsOutputModeInformation;
pub const GraphicsOutputProtocol = @import("protocols/graphics_output_protocol.zig").GraphicsOutputProtocol;
pub const GraphicsOutputProtocolMode = @import("protocols/graphics_output_protocol.zig").GraphicsOutputProtocolMode;
pub const GraphicsPixelFormat = @import("protocols/graphics_output_protocol.zig").GraphicsPixelFormat;
pub const PixelBitmask = @import("protocols/graphics_output_protocol.zig").PixelBitmask;
pub const EdidDiscoveredProtocol = @import("protocols/edid_discovered_protocol.zig").EdidDiscoveredProtocol;
pub const EdidActiveProtocol = @import("protocols/edid_active_protocol.zig").EdidActiveProtocol;
pub const EdidOverrideProtocol = @import("protocols/edid_override_protocol.zig").EdidOverrideProtocol;
pub const EdidOverrideProtocolAttributes = @import("protocols/edid_override_protocol.zig").EdidOverrideProtocolAttributes;
pub const SimpleNetworkProtocol = @import("protocols/simple_network_protocol.zig").SimpleNetworkProtocol;
pub const MacAddress = @import("protocols/simple_network_protocol.zig").MacAddress;
pub const SimpleNetworkMode = @import("protocols/simple_network_protocol.zig").SimpleNetworkMode;
pub const SimpleNetworkReceiveFilter = @import("protocols/simple_network_protocol.zig").SimpleNetworkReceiveFilter;
pub const SimpleNetworkState = @import("protocols/simple_network_protocol.zig").SimpleNetworkState;
pub const NetworkStatistics = @import("protocols/simple_network_protocol.zig").NetworkStatistics;
pub const SimpleNetworkInterruptStatus = @import("protocols/simple_network_protocol.zig").SimpleNetworkInterruptStatus;
pub const ManagedNetworkServiceBindingProtocol = @import("protocols/managed_network_service_binding_protocol.zig").ManagedNetworkServiceBindingProtocol;
pub const ManagedNetworkProtocol = @import("protocols/managed_network_protocol.zig").ManagedNetworkProtocol;
pub const ManagedNetworkConfigData = @import("protocols/managed_network_protocol.zig").ManagedNetworkConfigData;
pub const ManagedNetworkCompletionToken = @import("protocols/managed_network_protocol.zig").ManagedNetworkCompletionToken;
pub const ManagedNetworkReceiveData = @import("protocols/managed_network_protocol.zig").ManagedNetworkReceiveData;
pub const ManagedNetworkTransmitData = @import("protocols/managed_network_protocol.zig").ManagedNetworkTransmitData;
pub const ManagedNetworkFragmentData = @import("protocols/managed_network_protocol.zig").ManagedNetworkFragmentData;
pub const Ip6ServiceBindingProtocol = @import("protocols/ip6_service_binding_protocol.zig").Ip6ServiceBindingProtocol;
pub const Ip6Protocol = @import("protocols/ip6_protocol.zig").Ip6Protocol;
pub const Ip6ModeData = @import("protocols/ip6_protocol.zig").Ip6ModeData;
pub const Ip6ConfigData = @import("protocols/ip6_protocol.zig").Ip6ConfigData;
pub const Ip6Address = @import("protocols/ip6_protocol.zig").Ip6Address;
pub const Ip6AddressInfo = @import("protocols/ip6_protocol.zig").Ip6AddressInfo;
pub const Ip6RouteTable = @import("protocols/ip6_protocol.zig").Ip6RouteTable;
pub const Ip6NeighborState = @import("protocols/ip6_protocol.zig").Ip6NeighborState;
pub const Ip6NeighborCache = @import("protocols/ip6_protocol.zig").Ip6NeighborCache;
pub const Ip6IcmpType = @import("protocols/ip6_protocol.zig").Ip6IcmpType;
pub const Ip6CompletionToken = @import("protocols/ip6_protocol.zig").Ip6CompletionToken;
pub const Ip6ConfigProtocol = @import("protocols/ip6_config_protocol.zig").Ip6ConfigProtocol;
pub const Ip6ConfigDataType = @import("protocols/ip6_config_protocol.zig").Ip6ConfigDataType;
pub const Udp6ServiceBindingProtocol = @import("protocols/udp6_service_binding_protocol.zig").Udp6ServiceBindingProtocol;
pub const Udp6Protocol = @import("protocols/udp6_protocol.zig").Udp6Protocol;
pub const Udp6ConfigData = @import("protocols/udp6_protocol.zig").Udp6ConfigData;
pub const Udp6CompletionToken = @import("protocols/udp6_protocol.zig").Udp6CompletionToken;
pub const Udp6ReceiveData = @import("protocols/udp6_protocol.zig").Udp6ReceiveData;
pub const Udp6TransmitData = @import("protocols/udp6_protocol.zig").Udp6TransmitData;
pub const Udp6SessionData = @import("protocols/udp6_protocol.zig").Udp6SessionData;
pub const Udp6FragmentData = @import("protocols/udp6_protocol.zig").Udp6FragmentData;
pub const hii = @import("protocols/hii.zig");
pub const HIIDatabaseProtocol = @import("protocols/hii_database_protocol.zig").HIIDatabaseProtocol;
pub const HIIPopupProtocol = @import("protocols/hii_popup_protocol.zig").HIIPopupProtocol;
pub const HIIPopupStyle = @import("protocols/hii_popup_protocol.zig").HIIPopupStyle;
pub const HIIPopupType = @import("protocols/hii_popup_protocol.zig").HIIPopupType;
pub const HIIPopupSelection = @import("protocols/hii_popup_protocol.zig").HIIPopupSelection;
pub const RNGProtocol = @import("protocols/rng_protocol.zig").RNGProtocol;
pub const ShellParametersProtocol = @import("protocols/shell_parameters_protocol.zig").ShellParametersProtocol;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/tables.zig | pub const AllocateType = @import("tables/boot_services.zig").AllocateType;
pub const BootServices = @import("tables/boot_services.zig").BootServices;
pub const ConfigurationTable = @import("tables/configuration_table.zig").ConfigurationTable;
pub const global_variable align(8) = @import("tables/runtime_services.zig").global_variable;
pub const LocateSearchType = @import("tables/boot_services.zig").LocateSearchType;
pub const MemoryDescriptor = @import("tables/boot_services.zig").MemoryDescriptor;
pub const MemoryType = @import("tables/boot_services.zig").MemoryType;
pub const OpenProtocolAttributes = @import("tables/boot_services.zig").OpenProtocolAttributes;
pub const ProtocolInformationEntry = @import("tables/boot_services.zig").ProtocolInformationEntry;
pub const ResetType = @import("tables/runtime_services.zig").ResetType;
pub const RuntimeServices = @import("tables/runtime_services.zig").RuntimeServices;
pub const SystemTable = @import("tables/system_table.zig").SystemTable;
pub const TableHeader = @import("tables/table_header.zig").TableHeader;
pub const TimerDelay = @import("tables/boot_services.zig").TimerDelay;
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/status.zig | const high_bit = 1 << @typeInfo(usize).Int.bits - 1;
pub const Status = enum(usize) {
/// The operation completed successfully.
Success = 0,
/// The image failed to load.
LoadError = high_bit | 1,
/// A parameter was incorrect.
InvalidParameter = high_bit | 2,
/// The operation is not supported.
Unsupported = high_bit | 3,
/// The buffer was not the proper size for the request.
BadBufferSize = high_bit | 4,
/// The buffer is not large enough to hold the requested data. The required buffer size is returned in the appropriate parameter when this error occurs.
BufferTooSmall = high_bit | 5,
/// There is no data pending upon return.
NotReady = high_bit | 6,
/// The physical device reported an error while attempting the operation.
DeviceError = high_bit | 7,
/// The device cannot be written to.
WriteProtected = high_bit | 8,
/// A resource has run out.
OutOfResources = high_bit | 9,
/// An inconstancy was detected on the file system causing the operating to fail.
VolumeCorrupted = high_bit | 10,
/// There is no more space on the file system.
VolumeFull = high_bit | 11,
/// The device does not contain any medium to perform the operation.
NoMedia = high_bit | 12,
/// The medium in the device has changed since the last access.
MediaChanged = high_bit | 13,
/// The item was not found.
NotFound = high_bit | 14,
/// Access was denied.
AccessDenied = high_bit | 15,
/// The server was not found or did not respond to the request.
NoResponse = high_bit | 16,
/// A mapping to a device does not exist.
NoMapping = high_bit | 17,
/// The timeout time expired.
Timeout = high_bit | 18,
/// The protocol has not been started.
NotStarted = high_bit | 19,
/// The protocol has already been started.
AlreadyStarted = high_bit | 20,
/// The operation was aborted.
Aborted = high_bit | 21,
/// An ICMP error occurred during the network operation.
IcmpError = high_bit | 22,
/// A TFTP error occurred during the network operation.
TftpError = high_bit | 23,
/// A protocol error occurred during the network operation.
ProtocolError = high_bit | 24,
/// The function encountered an internal version that was incompatible with a version requested by the caller.
IncompatibleVersion = high_bit | 25,
/// The function was not performed due to a security violation.
SecurityViolation = high_bit | 26,
/// A CRC error was detected.
CrcError = high_bit | 27,
/// Beginning or end of media was reached
EndOfMedia = high_bit | 28,
/// The end of the file was reached.
EndOfFile = high_bit | 31,
/// The language specified was invalid.
InvalidLanguage = high_bit | 32,
/// The security status of the data is unknown or compromised and the data must be updated or replaced to restore a valid security status.
CompromisedData = high_bit | 33,
/// There is an address conflict address allocation
IpAddressConflict = high_bit | 34,
/// A HTTP error occurred during the network operation.
HttpError = high_bit | 35,
NetworkUnreachable = high_bit | 100,
HostUnreachable = high_bit | 101,
ProtocolUnreachable = high_bit | 102,
PortUnreachable = high_bit | 103,
ConnectionFin = high_bit | 104,
ConnectionReset = high_bit | 105,
ConnectionRefused = high_bit | 106,
/// The string contained one or more characters that the device could not render and were skipped.
WarnUnknownGlyph = 1,
/// The handle was closed, but the file was not deleted.
WarnDeleteFailure = 2,
/// The handle was closed, but the data to the file was not flushed properly.
WarnWriteFailure = 3,
/// The resulting buffer was too small, and the data was truncated to the buffer size.
WarnBufferTooSmall = 4,
/// The data has not been updated within the timeframe set by localpolicy for this type of data.
WarnStaleData = 5,
/// The resulting buffer contains UEFI-compliant file system.
WarnFileSystem = 6,
/// The operation will be processed across a system reset.
WarnResetRequired = 7,
_,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/tables/table_header.zig | pub const TableHeader = extern struct {
signature: u64,
revision: u32,
/// The size, in bytes, of the entire table including the TableHeader
header_size: u32,
crc32: u32,
reserved: u32,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/tables/configuration_table.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
pub const ConfigurationTable = extern struct {
vendor_guid: Guid,
vendor_table: *anyopaque,
pub const acpi_20_table_guid align(8) = Guid{
.time_low = 0x8868e871,
.time_mid = 0xe4f1,
.time_high_and_version = 0x11d3,
.clock_seq_high_and_reserved = 0xbc,
.clock_seq_low = 0x22,
.node = [_]u8{ 0x00, 0x80, 0xc7, 0x3c, 0x88, 0x81 },
};
pub const acpi_10_table_guid align(8) = Guid{
.time_low = 0xeb9d2d30,
.time_mid = 0x2d88,
.time_high_and_version = 0x11d3,
.clock_seq_high_and_reserved = 0x9a,
.clock_seq_low = 0x16,
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
};
pub const sal_system_table_guid align(8) = Guid{
.time_low = 0xeb9d2d32,
.time_mid = 0x2d88,
.time_high_and_version = 0x113d,
.clock_seq_high_and_reserved = 0x9a,
.clock_seq_low = 0x16,
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
};
pub const smbios_table_guid align(8) = Guid{
.time_low = 0xeb9d2d31,
.time_mid = 0x2d88,
.time_high_and_version = 0x11d3,
.clock_seq_high_and_reserved = 0x9a,
.clock_seq_low = 0x16,
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
};
pub const smbios3_table_guid align(8) = Guid{
.time_low = 0xf2fd1544,
.time_mid = 0x9794,
.time_high_and_version = 0x4a2c,
.clock_seq_high_and_reserved = 0x99,
.clock_seq_low = 0x2e,
.node = [_]u8{ 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94 },
};
pub const mps_table_guid align(8) = Guid{
.time_low = 0xeb9d2d2f,
.time_mid = 0x2d88,
.time_high_and_version = 0x11d3,
.clock_seq_high_and_reserved = 0x9a,
.clock_seq_low = 0x16,
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
};
pub const json_config_data_table_guid align(8) = Guid{
.time_low = 0x87367f87,
.time_mid = 0x1119,
.time_high_and_version = 0x41ce,
.clock_seq_high_and_reserved = 0xaa,
.clock_seq_low = 0xec,
.node = [_]u8{ 0x8b, 0xe0, 0x11, 0x1f, 0x55, 0x8a },
};
pub const json_capsule_data_table_guid align(8) = Guid{
.time_low = 0x35e7a725,
.time_mid = 0x8dd2,
.time_high_and_version = 0x4cac,
.clock_seq_high_and_reserved = 0x80,
.clock_seq_low = 0x11,
.node = [_]u8{ 0x33, 0xcd, 0xa8, 0x10, 0x90, 0x56 },
};
pub const json_capsule_result_table_guid align(8) = Guid{
.time_low = 0xdbc461c3,
.time_mid = 0xb3de,
.time_high_and_version = 0x422a,
.clock_seq_high_and_reserved = 0xb9,
.clock_seq_low = 0xb4,
.node = [_]u8{ 0x98, 0x86, 0xfd, 0x49, 0xa1, 0xe5 },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/tables/boot_services.zig | const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
const Handle = uefi.Handle;
const Status = uefi.Status;
const TableHeader = uefi.tables.TableHeader;
const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
/// Boot services are services provided by the system's firmware until the operating system takes
/// over control over the hardware by calling exitBootServices.
///
/// Boot Services must not be used after exitBootServices has been called. The only exception is
/// getMemoryMap, which may be used after the first unsuccessful call to exitBootServices.
/// After successfully calling exitBootServices, system_table.console_in_handle, system_table.con_in,
/// system_table.console_out_handle, system_table.con_out, system_table.standard_error_handle,
/// system_table.std_err, and system_table.boot_services should be set to null. After setting these
/// attributes to null, system_table.hdr.crc32 must be recomputed.
///
/// As the boot_services table may grow with new UEFI versions, it is important to check hdr.header_size.
pub const BootServices = extern struct {
hdr: TableHeader,
/// Raises a task's priority level and returns its previous level.
raiseTpl: fn (usize) callconv(.C) usize,
/// Restores a task's priority level to its previous value.
restoreTpl: fn (usize) callconv(.C) void,
/// Allocates memory pages from the system.
allocatePages: fn (AllocateType, MemoryType, usize, *[*]align(4096) u8) callconv(.C) Status,
/// Frees memory pages.
freePages: fn ([*]align(4096) u8, usize) callconv(.C) Status,
/// Returns the current memory map.
getMemoryMap: fn (*usize, [*]MemoryDescriptor, *usize, *usize, *u32) callconv(.C) Status,
/// Allocates pool memory.
allocatePool: fn (MemoryType, usize, *[*]align(8) u8) callconv(.C) Status,
/// Returns pool memory to the system.
freePool: fn ([*]align(8) u8) callconv(.C) Status,
/// Creates an event.
createEvent: fn (u32, usize, ?fn (Event, ?*anyopaque) callconv(.C) void, ?*const anyopaque, *Event) callconv(.C) Status,
/// Sets the type of timer and the trigger time for a timer event.
setTimer: fn (Event, TimerDelay, u64) callconv(.C) Status,
/// Stops execution until an event is signaled.
waitForEvent: fn (usize, [*]const Event, *usize) callconv(.C) Status,
/// Signals an event.
signalEvent: fn (Event) callconv(.C) Status,
/// Closes an event.
closeEvent: fn (Event) callconv(.C) Status,
/// Checks whether an event is in the signaled state.
checkEvent: fn (Event) callconv(.C) Status,
installProtocolInterface: Status, // TODO
reinstallProtocolInterface: Status, // TODO
uninstallProtocolInterface: Status, // TODO
/// Queries a handle to determine if it supports a specified protocol.
handleProtocol: fn (Handle, *align(8) const Guid, *?*anyopaque) callconv(.C) Status,
reserved: *anyopaque,
registerProtocolNotify: Status, // TODO
/// Returns an array of handles that support a specified protocol.
locateHandle: fn (LocateSearchType, ?*align(8) const Guid, ?*const anyopaque, *usize, [*]Handle) callconv(.C) Status,
/// Locates the handle to a device on the device path that supports the specified protocol
locateDevicePath: fn (*align(8) const Guid, **const DevicePathProtocol, *?Handle) callconv(.C) Status,
installConfigurationTable: Status, // TODO
/// Loads an EFI image into memory.
loadImage: fn (bool, Handle, ?*const DevicePathProtocol, ?[*]const u8, usize, *?Handle) callconv(.C) Status,
/// Transfers control to a loaded image's entry point.
startImage: fn (Handle, ?*usize, ?*[*]u16) callconv(.C) Status,
/// Terminates a loaded EFI image and returns control to boot services.
exit: fn (Handle, Status, usize, ?*const anyopaque) callconv(.C) Status,
/// Unloads an image.
unloadImage: fn (Handle) callconv(.C) Status,
/// Terminates all boot services.
exitBootServices: fn (Handle, usize) callconv(.C) Status,
/// Returns a monotonically increasing count for the platform.
getNextMonotonicCount: fn (*u64) callconv(.C) Status,
/// Induces a fine-grained stall.
stall: fn (usize) callconv(.C) Status,
/// Sets the system's watchdog timer.
setWatchdogTimer: fn (usize, u64, usize, ?[*]const u16) callconv(.C) Status,
connectController: Status, // TODO
disconnectController: Status, // TODO
/// Queries a handle to determine if it supports a specified protocol.
openProtocol: fn (Handle, *align(8) const Guid, *?*anyopaque, ?Handle, ?Handle, OpenProtocolAttributes) callconv(.C) Status,
/// Closes a protocol on a handle that was opened using openProtocol().
closeProtocol: fn (Handle, *align(8) const Guid, Handle, ?Handle) callconv(.C) Status,
/// Retrieves the list of agents that currently have a protocol interface opened.
openProtocolInformation: fn (Handle, *align(8) const Guid, *[*]ProtocolInformationEntry, *usize) callconv(.C) Status,
/// Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.
protocolsPerHandle: fn (Handle, *[*]*align(8) const Guid, *usize) callconv(.C) Status,
/// Returns an array of handles that support the requested protocol in a buffer allocated from pool.
locateHandleBuffer: fn (LocateSearchType, ?*align(8) const Guid, ?*const anyopaque, *usize, *[*]Handle) callconv(.C) Status,
/// Returns the first protocol instance that matches the given protocol.
locateProtocol: fn (*align(8) const Guid, ?*const anyopaque, *?*anyopaque) callconv(.C) Status,
installMultipleProtocolInterfaces: Status, // TODO
uninstallMultipleProtocolInterfaces: Status, // TODO
/// Computes and returns a 32-bit CRC for a data buffer.
calculateCrc32: fn ([*]const u8, usize, *u32) callconv(.C) Status,
/// Copies the contents of one buffer to another buffer
copyMem: fn ([*]u8, [*]const u8, usize) callconv(.C) void,
/// Fills a buffer with a specified value
setMem: fn ([*]u8, usize, u8) callconv(.C) void,
createEventEx: Status, // TODO
pub const signature: u64 = 0x56524553544f4f42;
pub const event_timer: u32 = 0x80000000;
pub const event_runtime: u32 = 0x40000000;
pub const event_notify_wait: u32 = 0x00000100;
pub const event_notify_signal: u32 = 0x00000200;
pub const event_signal_exit_boot_services: u32 = 0x00000201;
pub const event_signal_virtual_address_change: u32 = 0x00000202;
pub const tpl_application: usize = 4;
pub const tpl_callback: usize = 8;
pub const tpl_notify: usize = 16;
pub const tpl_high_level: usize = 31;
};
pub const TimerDelay = enum(u32) {
TimerCancel,
TimerPeriodic,
TimerRelative,
};
pub const MemoryType = enum(u32) {
ReservedMemoryType,
LoaderCode,
LoaderData,
BootServicesCode,
BootServicesData,
RuntimeServicesCode,
RuntimeServicesData,
ConventionalMemory,
UnusableMemory,
ACPIReclaimMemory,
ACPIMemoryNVS,
MemoryMappedIO,
MemoryMappedIOPortSpace,
PalCode,
PersistentMemory,
MaxMemoryType,
_,
};
pub const MemoryDescriptor = extern struct {
type: MemoryType,
padding: u32,
physical_start: u64,
virtual_start: u64,
number_of_pages: usize,
attribute: packed struct {
uc: bool,
wc: bool,
wt: bool,
wb: bool,
uce: bool,
_pad1: u3,
_pad2: u4,
wp: bool,
rp: bool,
xp: bool,
nv: bool,
more_reliable: bool,
ro: bool,
sp: bool,
cpu_crypto: bool,
_pad3: u4,
_pad4: u32,
_pad5: u7,
memory_runtime: bool,
},
};
pub const LocateSearchType = enum(u32) {
AllHandles,
ByRegisterNotify,
ByProtocol,
};
pub const OpenProtocolAttributes = packed struct {
by_handle_protocol: bool = false,
get_protocol: bool = false,
test_protocol: bool = false,
by_child_controller: bool = false,
by_driver: bool = false,
exclusive: bool = false,
_pad1: u2 = undefined,
_pad2: u8 = undefined,
_pad3: u16 = undefined,
};
pub const ProtocolInformationEntry = extern struct {
agent_handle: ?Handle,
controller_handle: ?Handle,
attributes: OpenProtocolAttributes,
open_count: u32,
};
pub const AllocateType = enum(u32) {
AllocateAnyPages,
AllocateMaxAddress,
AllocateAddress,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/tables/runtime_services.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const TableHeader = uefi.tables.TableHeader;
const Time = uefi.Time;
const TimeCapabilities = uefi.TimeCapabilities;
const Status = uefi.Status;
/// Runtime services are provided by the firmware before and after exitBootServices has been called.
///
/// As the runtime_services table may grow with new UEFI versions, it is important to check hdr.header_size.
///
/// Some functions may not be supported. Check the RuntimeServicesSupported variable using getVariable.
/// getVariable is one of the functions that may not be supported.
///
/// Some functions may not be called while other functions are running.
pub const RuntimeServices = extern struct {
hdr: TableHeader,
/// Returns the current time and date information, and the time-keeping capabilities of the hardware platform.
getTime: fn (*uefi.Time, ?*TimeCapabilities) callconv(.C) Status,
setTime: Status, // TODO
getWakeupTime: Status, // TODO
setWakeupTime: Status, // TODO
setVirtualAddressMap: Status, // TODO
convertPointer: Status, // TODO
/// Returns the value of a variable.
getVariable: fn ([*:0]const u16, *align(8) const Guid, ?*u32, *usize, ?*anyopaque) callconv(.C) Status,
/// Enumerates the current variable names.
getNextVariableName: fn (*usize, [*:0]u16, *align(8) Guid) callconv(.C) Status,
/// Sets the value of a variable.
setVariable: fn ([*:0]const u16, *align(8) const Guid, u32, usize, *anyopaque) callconv(.C) Status,
getNextHighMonotonicCount: Status, // TODO
/// Resets the entire platform.
resetSystem: fn (ResetType, Status, usize, ?*const anyopaque) callconv(.C) noreturn,
updateCapsule: Status, // TODO
queryCapsuleCapabilities: Status, // TODO
queryVariableInfo: Status, // TODO
pub const signature: u64 = 0x56524553544e5552;
};
pub const ResetType = enum(u32) {
ResetCold,
ResetWarm,
ResetShutdown,
ResetPlatformSpecific,
};
pub const global_variable align(8) = Guid{
.time_low = 0x8be4df61,
.time_mid = 0x93ca,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0xaa,
.clock_seq_low = 0x0d,
.node = [_]u8{ 0x00, 0xe0, 0x98, 0x03, 0x2b, 0x8c },
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/tables/system_table.zig | const uefi = @import("std").os.uefi;
const BootServices = uefi.tables.BootServices;
const ConfigurationTable = uefi.tables.ConfigurationTable;
const Handle = uefi.Handle;
const RuntimeServices = uefi.tables.RuntimeServices;
const SimpleTextInputProtocol = uefi.protocols.SimpleTextInputProtocol;
const SimpleTextOutputProtocol = uefi.protocols.SimpleTextOutputProtocol;
const TableHeader = uefi.tables.TableHeader;
/// The EFI System Table contains pointers to the runtime and boot services tables.
///
/// As the system_table may grow with new UEFI versions, it is important to check hdr.header_size.
///
/// After successfully calling boot_services.exitBootServices, console_in_handle,
/// con_in, console_out_handle, con_out, standard_error_handle, std_err, and
/// boot_services should be set to null. After setting these attributes to null,
/// hdr.crc32 must be recomputed.
pub const SystemTable = extern struct {
hdr: TableHeader,
/// A null-terminated string that identifies the vendor that produces the system firmware of the platform.
firmware_vendor: [*:0]u16,
firmware_revision: u32,
console_in_handle: ?Handle,
con_in: ?*SimpleTextInputProtocol,
console_out_handle: ?Handle,
con_out: ?*SimpleTextOutputProtocol,
standard_error_handle: ?Handle,
std_err: ?*SimpleTextOutputProtocol,
runtime_services: *RuntimeServices,
boot_services: ?*BootServices,
number_of_table_entries: usize,
configuration_table: [*]ConfigurationTable,
pub const signature: u64 = 0x5453595320494249;
pub const revision_1_02: u32 = (1 << 16) | 2;
pub const revision_1_10: u32 = (1 << 16) | 10;
pub const revision_2_00: u32 = (2 << 16);
pub const revision_2_10: u32 = (2 << 16) | 10;
pub const revision_2_20: u32 = (2 << 16) | 20;
pub const revision_2_30: u32 = (2 << 16) | 30;
pub const revision_2_31: u32 = (2 << 16) | 31;
pub const revision_2_40: u32 = (2 << 16) | 40;
pub const revision_2_50: u32 = (2 << 16) | 50;
pub const revision_2_60: u32 = (2 << 16) | 60;
pub const revision_2_70: u32 = (2 << 16) | 70;
pub const revision_2_80: u32 = (2 << 16) | 80;
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/hii.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
pub const HIIHandle = *opaque {};
/// The header found at the start of each package.
pub const HIIPackageHeader = packed struct {
length: u24,
type: u8,
pub const type_all: u8 = 0x0;
pub const type_guid: u8 = 0x1;
pub const forms: u8 = 0x2;
pub const strings: u8 = 0x4;
pub const fonts: u8 = 0x5;
pub const images: u8 = 0x6;
pub const simple_fonsts: u8 = 0x7;
pub const device_path: u8 = 0x8;
pub const keyboard_layout: u8 = 0x9;
pub const animations: u8 = 0xa;
pub const end: u8 = 0xdf;
pub const type_system_begin: u8 = 0xe0;
pub const type_system_end: u8 = 0xff;
};
/// The header found at the start of each package list.
pub const HIIPackageList = extern struct {
package_list_guid: Guid,
/// The size of the package list (in bytes), including the header.
package_list_length: u32,
// TODO implement iterator
};
pub const HIISimplifiedFontPackage = extern struct {
header: HIIPackageHeader,
number_of_narrow_glyphs: u16,
number_of_wide_glyphs: u16,
pub fn getNarrowGlyphs(self: *HIISimplifiedFontPackage) []NarrowGlyph {
return @as([*]NarrowGlyph, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(HIISimplifiedFontPackage)))[0..self.number_of_narrow_glyphs];
}
};
pub const NarrowGlyph = extern struct {
unicode_weight: u16,
attributes: packed struct {
non_spacing: bool,
wide: bool,
_pad: u6,
},
glyph_col_1: [19]u8,
};
pub const WideGlyph = extern struct {
unicode_weight: u16,
attributes: packed struct {
non_spacing: bool,
wide: bool,
_pad: u6,
},
glyph_col_1: [19]u8,
glyph_col_2: [19]u8,
_pad: [3]u8,
};
pub const HIIStringPackage = extern struct {
header: HIIPackageHeader,
hdr_size: u32,
string_info_offset: u32,
language_window: [16]u16,
language_name: u16,
language: [3]u8,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/edid_override_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Handle = uefi.Handle;
const Status = uefi.Status;
/// Override EDID information
pub const EdidOverrideProtocol = extern struct {
_get_edid: fn (*const EdidOverrideProtocol, Handle, *u32, *usize, *?[*]u8) callconv(.C) Status,
/// Returns policy information and potentially a replacement EDID for the specified video output device.
/// attributes must be align(4)
pub fn getEdid(self: *const EdidOverrideProtocol, handle: Handle, attributes: *EdidOverrideProtocolAttributes, edid_size: *usize, edid: *?[*]u8) Status {
return self._get_edid(self, handle, attributes, edid_size, edid);
}
pub const guid align(8) = Guid{
.time_low = 0x48ecb431,
.time_mid = 0xfb72,
.time_high_and_version = 0x45c0,
.clock_seq_high_and_reserved = 0xa9,
.clock_seq_low = 0x22,
.node = [_]u8{ 0xf4, 0x58, 0xfe, 0x04, 0x0b, 0xd5 },
};
};
pub const EdidOverrideProtocolAttributes = packed struct {
dont_override: bool,
enable_hot_plug: bool,
_pad1: u6,
_pad2: u8,
_pad3: u16,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/managed_network_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Event = uefi.Event;
const Status = uefi.Status;
const Time = uefi.Time;
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
const MacAddress = uefi.protocols.MacAddress;
pub const ManagedNetworkProtocol = extern struct {
_get_mode_data: fn (*const ManagedNetworkProtocol, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
_configure: fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkConfigData) callconv(.C) Status,
_mcast_ip_to_mac: fn (*const ManagedNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
_groups: fn (*const ManagedNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
_transmit: fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
_receive: fn (*const ManagedNetworkProtocol, *const ManagedNetworkCompletionToken) callconv(.C) Status,
_cancel: fn (*const ManagedNetworkProtocol, ?*const ManagedNetworkCompletionToken) callconv(.C) Status,
_poll: fn (*const ManagedNetworkProtocol) callconv(.C) usize,
/// Returns the operational parameters for the current MNP child driver.
/// May also support returning the underlying SNP driver mode data.
pub fn getModeData(self: *const ManagedNetworkProtocol, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
return self._get_mode_data(self, mnp_config_data, snp_mode_data);
}
/// Sets or clears the operational parameters for the MNP child driver.
pub fn configure(self: *const ManagedNetworkProtocol, mnp_config_data: ?*const ManagedNetworkConfigData) Status {
return self._configure(self, mnp_config_data);
}
/// Translates an IP multicast address to a hardware (MAC) multicast address.
/// This function may be unsupported in some MNP implementations.
pub fn mcastIpToMac(self: *const ManagedNetworkProtocol, ipv6flag: bool, ipaddress: *const anyopaque, mac_address: *MacAddress) Status {
_ = mac_address;
return self._mcast_ip_to_mac(self, ipv6flag, ipaddress);
}
/// Enables and disables receive filters for multicast address.
/// This function may be unsupported in some MNP implementations.
pub fn groups(self: *const ManagedNetworkProtocol, join_flag: bool, mac_address: ?*const MacAddress) Status {
return self._groups(self, join_flag, mac_address);
}
/// Places asynchronous outgoing data packets into the transmit queue.
pub fn transmit(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status {
return self._transmit(self, token);
}
/// Places an asynchronous receiving request into the receiving queue.
pub fn receive(self: *const ManagedNetworkProtocol, token: *const ManagedNetworkCompletionToken) Status {
return self._receive(self, token);
}
/// Aborts an asynchronous transmit or receive request.
pub fn cancel(self: *const ManagedNetworkProtocol, token: ?*const ManagedNetworkCompletionToken) Status {
return self._cancel(self, token);
}
/// Polls for incoming data packets and processes outgoing data packets.
pub fn poll(self: *const ManagedNetworkProtocol) Status {
return self._poll(self);
}
pub const guid align(8) = Guid{
.time_low = 0x7ab33a91,
.time_mid = 0xace5,
.time_high_and_version = 0x4326,
.clock_seq_high_and_reserved = 0xb5,
.clock_seq_low = 0x72,
.node = [_]u8{ 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16 },
};
};
pub const ManagedNetworkConfigData = extern struct {
received_queue_timeout_value: u32,
transmit_queue_timeout_value: u32,
protocol_type_filter: u16,
enable_unicast_receive: bool,
enable_multicast_receive: bool,
enable_broadcast_receive: bool,
enable_promiscuous_receive: bool,
flush_queues_on_reset: bool,
enable_receive_timestamps: bool,
disable_background_polling: bool,
};
pub const ManagedNetworkCompletionToken = extern struct {
event: Event,
status: Status,
packet: extern union {
RxData: *ManagedNetworkReceiveData,
TxData: *ManagedNetworkTransmitData,
},
};
pub const ManagedNetworkReceiveData = extern struct {
timestamp: Time,
recycle_event: Event,
packet_length: u32,
header_length: u32,
address_length: u32,
data_length: u32,
broadcast_flag: bool,
multicast_flag: bool,
promiscuous_flag: bool,
protocol_type: u16,
destination_address: [*]u8,
source_address: [*]u8,
media_header: [*]u8,
packet_data: [*]u8,
};
pub const ManagedNetworkTransmitData = extern struct {
destination_address: ?*MacAddress,
source_address: ?*MacAddress,
protocol_type: u16,
data_length: u32,
header_length: u16,
fragment_count: u16,
pub fn getFragments(self: *ManagedNetworkTransmitData) []ManagedNetworkFragmentData {
return @as([*]ManagedNetworkFragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(ManagedNetworkTransmitData)))[0..self.fragment_count];
}
};
pub const ManagedNetworkFragmentData = extern struct {
fragment_length: u32,
fragment_buffer: [*]u8,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/ip6_config_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Event = uefi.Event;
const Status = uefi.Status;
pub const Ip6ConfigProtocol = extern struct {
_set_data: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, usize, *const anyopaque) callconv(.C) Status,
_get_data: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, *usize, ?*const anyopaque) callconv(.C) Status,
_register_data_notify: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
_unregister_data_notify: fn (*const Ip6ConfigProtocol, Ip6ConfigDataType, Event) callconv(.C) Status,
pub fn setData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: usize, data: *const anyopaque) Status {
return self._set_data(self, data_type, data_size, data);
}
pub fn getData(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, data_size: *usize, data: ?*const anyopaque) Status {
return self._get_data(self, data_type, data_size, data);
}
pub fn registerDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) Status {
return self._register_data_notify(self, data_type, event);
}
pub fn unregisterDataNotify(self: *const Ip6ConfigProtocol, data_type: Ip6ConfigDataType, event: Event) Status {
return self._unregister_data_notify(self, data_type, event);
}
pub const guid align(8) = Guid{
.time_low = 0x937fe521,
.time_mid = 0x95ae,
.time_high_and_version = 0x4d1a,
.clock_seq_high_and_reserved = 0x89,
.clock_seq_low = 0x29,
.node = [_]u8{ 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a },
};
};
pub const Ip6ConfigDataType = enum(u32) {
InterfaceInfo,
AltInterfaceId,
Policy,
DupAddrDetectTransmits,
ManualAddress,
Gateway,
DnsServer,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/rng_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Status = uefi.Status;
/// Random Number Generator protocol
pub const RNGProtocol = extern struct {
_get_info: fn (*const RNGProtocol, *usize, [*]align(8) Guid) callconv(.C) Status,
_get_rng: fn (*const RNGProtocol, ?*align(8) const Guid, usize, [*]u8) callconv(.C) Status,
/// Returns information about the random number generation implementation.
pub fn getInfo(self: *const RNGProtocol, list_size: *usize, list: [*]align(8) Guid) Status {
return self._get_info(self, list_size, list);
}
/// Produces and returns an RNG value using either the default or specified RNG algorithm.
pub fn getRNG(self: *const RNGProtocol, algo: ?*align(8) const Guid, value_length: usize, value: [*]u8) Status {
return self._get_rng(self, algo, value_length, value);
}
pub const guid align(8) = Guid{
.time_low = 0x3152bca5,
.time_mid = 0xeade,
.time_high_and_version = 0x433d,
.clock_seq_high_and_reserved = 0x86,
.clock_seq_low = 0x2e,
.node = [_]u8{ 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44 },
};
pub const algorithm_sp800_90_hash_256 align(8) = Guid{
.time_low = 0xa7af67cb,
.time_mid = 0x603b,
.time_high_and_version = 0x4d42,
.clock_seq_high_and_reserved = 0xba,
.clock_seq_low = 0x21,
.node = [_]u8{ 0x70, 0xbf, 0xb6, 0x29, 0x3f, 0x96 },
};
pub const algorithm_sp800_90_hmac_256 align(8) = Guid{
.time_low = 0xc5149b43,
.time_mid = 0xae85,
.time_high_and_version = 0x4f53,
.clock_seq_high_and_reserved = 0x99,
.clock_seq_low = 0x82,
.node = [_]u8{ 0xb9, 0x43, 0x35, 0xd3, 0xa9, 0xe7 },
};
pub const algorithm_sp800_90_ctr_256 align(8) = Guid{
.time_low = 0x44f0de6e,
.time_mid = 0x4d8c,
.time_high_and_version = 0x4045,
.clock_seq_high_and_reserved = 0xa8,
.clock_seq_low = 0xc7,
.node = [_]u8{ 0x4d, 0xd1, 0x68, 0x85, 0x6b, 0x9e },
};
pub const algorithm_x9_31_3des align(8) = Guid{
.time_low = 0x63c4785a,
.time_mid = 0xca34,
.time_high_and_version = 0x4012,
.clock_seq_high_and_reserved = 0xa3,
.clock_seq_low = 0xc8,
.node = [_]u8{ 0x0b, 0x6a, 0x32, 0x4f, 0x55, 0x46 },
};
pub const algorithm_x9_31_aes align(8) = Guid{
.time_low = 0xacd03321,
.time_mid = 0x777e,
.time_high_and_version = 0x4d3d,
.clock_seq_high_and_reserved = 0xb1,
.clock_seq_low = 0xc8,
.node = [_]u8{ 0x20, 0xcf, 0xd8, 0x88, 0x20, 0xc9 },
};
pub const algorithm_raw align(8) = Guid{
.time_low = 0xe43176d7,
.time_mid = 0xb6e8,
.time_high_and_version = 0x4827,
.clock_seq_high_and_reserved = 0xb7,
.clock_seq_low = 0x84,
.node = [_]u8{ 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61 },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/hii_database_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Status = uefi.Status;
const hii = uefi.protocols.hii;
/// Database manager for HII-related data structures.
pub const HIIDatabaseProtocol = extern struct {
_new_package_list: Status, // TODO
_remove_package_list: fn (*const HIIDatabaseProtocol, hii.HIIHandle) callconv(.C) Status,
_update_package_list: fn (*const HIIDatabaseProtocol, hii.HIIHandle, *const hii.HIIPackageList) callconv(.C) Status,
_list_package_lists: fn (*const HIIDatabaseProtocol, u8, ?*const Guid, *usize, [*]hii.HIIHandle) callconv(.C) Status,
_export_package_lists: fn (*const HIIDatabaseProtocol, ?hii.HIIHandle, *usize, *hii.HIIPackageList) callconv(.C) Status,
_register_package_notify: Status, // TODO
_unregister_package_notify: Status, // TODO
_find_keyboard_layouts: Status, // TODO
_get_keyboard_layout: Status, // TODO
_set_keyboard_layout: Status, // TODO
_get_package_list_handle: Status, // TODO
/// Removes a package list from the HII database.
pub fn removePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle) Status {
return self._remove_package_list(self, handle);
}
/// Update a package list in the HII database.
pub fn updatePackageList(self: *const HIIDatabaseProtocol, handle: hii.HIIHandle, buffer: *const hii.HIIPackageList) Status {
return self._update_package_list(self, handle, buffer);
}
/// Determines the handles that are currently active in the database.
pub fn listPackageLists(self: *const HIIDatabaseProtocol, package_type: u8, package_guid: ?*const Guid, buffer_length: *usize, handles: [*]hii.HIIHandle) Status {
return self._list_package_lists(self, package_type, package_guid, buffer_length, handles);
}
/// Exports the contents of one or all package lists in the HII database into a buffer.
pub fn exportPackageLists(self: *const HIIDatabaseProtocol, handle: ?hii.HIIHandle, buffer_size: *usize, buffer: *hii.HIIPackageList) Status {
return self._export_package_lists(self, handle, buffer_size, buffer);
}
pub const guid align(8) = Guid{
.time_low = 0xef9fc172,
.time_mid = 0xa1b2,
.time_high_and_version = 0x4693,
.clock_seq_high_and_reserved = 0xb3,
.clock_seq_low = 0x27,
.node = [_]u8{ 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/graphics_output_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Status = uefi.Status;
/// Graphics output
pub const GraphicsOutputProtocol = extern struct {
_query_mode: fn (*const GraphicsOutputProtocol, u32, *usize, **GraphicsOutputModeInformation) callconv(.C) Status,
_set_mode: fn (*const GraphicsOutputProtocol, u32) callconv(.C) Status,
_blt: fn (*const GraphicsOutputProtocol, ?[*]GraphicsOutputBltPixel, GraphicsOutputBltOperation, usize, usize, usize, usize, usize, usize, usize) callconv(.C) Status,
mode: *GraphicsOutputProtocolMode,
/// Returns information for an available graphics mode that the graphics device and the set of active video output devices supports.
pub fn queryMode(self: *const GraphicsOutputProtocol, mode: u32, size_of_info: *usize, info: **GraphicsOutputModeInformation) Status {
return self._query_mode(self, mode, size_of_info, info);
}
/// Set the video device into the specified mode and clears the visible portions of the output display to black.
pub fn setMode(self: *const GraphicsOutputProtocol, mode: u32) Status {
return self._set_mode(self, mode);
}
/// Blt a rectangle of pixels on the graphics screen. Blt stands for BLock Transfer.
pub fn blt(self: *const GraphicsOutputProtocol, blt_buffer: ?[*]GraphicsOutputBltPixel, blt_operation: GraphicsOutputBltOperation, source_x: usize, source_y: usize, destination_x: usize, destination_y: usize, width: usize, height: usize, delta: usize) Status {
return self._blt(self, blt_buffer, blt_operation, source_x, source_y, destination_x, destination_y, width, height, delta);
}
pub const guid align(8) = Guid{
.time_low = 0x9042a9de,
.time_mid = 0x23dc,
.time_high_and_version = 0x4a38,
.clock_seq_high_and_reserved = 0x96,
.clock_seq_low = 0xfb,
.node = [_]u8{ 0x7a, 0xde, 0xd0, 0x80, 0x51, 0x6a },
};
};
pub const GraphicsOutputProtocolMode = extern struct {
max_mode: u32,
mode: u32,
info: *GraphicsOutputModeInformation,
size_of_info: usize,
frame_buffer_base: u64,
frame_buffer_size: usize,
};
pub const GraphicsOutputModeInformation = extern struct {
version: u32 = undefined,
horizontal_resolution: u32 = undefined,
vertical_resolution: u32 = undefined,
pixel_format: GraphicsPixelFormat = undefined,
pixel_information: PixelBitmask = undefined,
pixels_per_scan_line: u32 = undefined,
};
pub const GraphicsPixelFormat = enum(u32) {
PixelRedGreenBlueReserved8BitPerColor,
PixelBlueGreenRedReserved8BitPerColor,
PixelBitMask,
PixelBltOnly,
PixelFormatMax,
};
pub const PixelBitmask = extern struct {
red_mask: u32,
green_mask: u32,
blue_mask: u32,
reserved_mask: u32,
};
pub const GraphicsOutputBltPixel = extern struct {
blue: u8,
green: u8,
red: u8,
reserved: u8 = undefined,
};
pub const GraphicsOutputBltOperation = enum(u32) {
BltVideoFill,
BltVideoToBltBuffer,
BltBufferToVideo,
BltVideoToVideo,
GraphicsOutputBltOperationMax,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/simple_network_protocol.zig | const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
const Status = uefi.Status;
pub const SimpleNetworkProtocol = extern struct {
revision: u64,
_start: fn (*const SimpleNetworkProtocol) callconv(.C) Status,
_stop: fn (*const SimpleNetworkProtocol) callconv(.C) Status,
_initialize: fn (*const SimpleNetworkProtocol, usize, usize) callconv(.C) Status,
_reset: fn (*const SimpleNetworkProtocol, bool) callconv(.C) Status,
_shutdown: fn (*const SimpleNetworkProtocol) callconv(.C) Status,
_receive_filters: fn (*const SimpleNetworkProtocol, SimpleNetworkReceiveFilter, SimpleNetworkReceiveFilter, bool, usize, ?[*]const MacAddress) callconv(.C) Status,
_station_address: fn (*const SimpleNetworkProtocol, bool, ?*const MacAddress) callconv(.C) Status,
_statistics: fn (*const SimpleNetworkProtocol, bool, ?*usize, ?*NetworkStatistics) callconv(.C) Status,
_mcast_ip_to_mac: fn (*const SimpleNetworkProtocol, bool, *const anyopaque, *MacAddress) callconv(.C) Status,
_nvdata: fn (*const SimpleNetworkProtocol, bool, usize, usize, [*]u8) callconv(.C) Status,
_get_status: fn (*const SimpleNetworkProtocol, *SimpleNetworkInterruptStatus, ?*?[*]u8) callconv(.C) Status,
_transmit: fn (*const SimpleNetworkProtocol, usize, usize, [*]const u8, ?*const MacAddress, ?*const MacAddress, ?*const u16) callconv(.C) Status,
_receive: fn (*const SimpleNetworkProtocol, ?*usize, *usize, [*]u8, ?*MacAddress, ?*MacAddress, ?*u16) callconv(.C) Status,
wait_for_packet: Event,
mode: *SimpleNetworkMode,
/// Changes the state of a network interface from "stopped" to "started".
pub fn start(self: *const SimpleNetworkProtocol) Status {
return self._start(self);
}
/// Changes the state of a network interface from "started" to "stopped".
pub fn stop(self: *const SimpleNetworkProtocol) Status {
return self._stop(self);
}
/// Resets a network adapter and allocates the transmit and receive buffers required by the network interface.
pub fn initialize(self: *const SimpleNetworkProtocol, extra_rx_buffer_size: usize, extra_tx_buffer_size: usize) Status {
return self._initialize(self, extra_rx_buffer_size, extra_tx_buffer_size);
}
/// Resets a network adapter and reinitializes it with the parameters that were provided in the previous call to initialize().
pub fn reset(self: *const SimpleNetworkProtocol, extended_verification: bool) Status {
return self._reset(self, extended_verification);
}
/// Resets a network adapter and leaves it in a state that is safe for another driver to initialize.
pub fn shutdown(self: *const SimpleNetworkProtocol) Status {
return self._shutdown(self);
}
/// Manages the multicast receive filters of a network interface.
pub fn receiveFilters(self: *const SimpleNetworkProtocol, enable: SimpleNetworkReceiveFilter, disable: SimpleNetworkReceiveFilter, reset_mcast_filter: bool, mcast_filter_cnt: usize, mcast_filter: ?[*]const MacAddress) Status {
return self._receive_filters(self, enable, disable, reset_mcast_filter, mcast_filter_cnt, mcast_filter);
}
/// Modifies or resets the current station address, if supported.
pub fn stationAddress(self: *const SimpleNetworkProtocol, reset_flag: bool, new: ?*const MacAddress) Status {
return self._station_address(self, reset_flag, new);
}
/// Resets or collects the statistics on a network interface.
pub fn statistics(self: *const SimpleNetworkProtocol, reset_flag: bool, statistics_size: ?*usize, statistics_table: ?*NetworkStatistics) Status {
return self._statistics(self, reset_flag, statistics_size, statistics_table);
}
/// Converts a multicast IP address to a multicast HW MAC address.
pub fn mcastIpToMac(self: *const SimpleNetworkProtocol, ipv6: bool, ip: *const anyopaque, mac: *MacAddress) Status {
return self._mcast_ip_to_mac(self, ipv6, ip, mac);
}
/// Performs read and write operations on the NVRAM device attached to a network interface.
pub fn nvdata(self: *const SimpleNetworkProtocol, read_write: bool, offset: usize, buffer_size: usize, buffer: [*]u8) Status {
return self._nvdata(self, read_write, offset, buffer_size, buffer);
}
/// Reads the current interrupt status and recycled transmit buffer status from a network interface.
pub fn getStatus(self: *const SimpleNetworkProtocol, interrupt_status: *SimpleNetworkInterruptStatus, tx_buf: ?*?[*]u8) Status {
return self._get_status(self, interrupt_status, tx_buf);
}
/// Places a packet in the transmit queue of a network interface.
pub fn transmit(self: *const SimpleNetworkProtocol, header_size: usize, buffer_size: usize, buffer: [*]const u8, src_addr: ?*const MacAddress, dest_addr: ?*const MacAddress, protocol: ?*const u16) Status {
return self._transmit(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol);
}
/// Receives a packet from a network interface.
pub fn receive(self: *const SimpleNetworkProtocol, header_size: ?*usize, buffer_size: *usize, buffer: [*]u8, src_addr: ?*MacAddress, dest_addr: ?*MacAddress, protocol: ?*u16) Status {
return self._receive(self, header_size, buffer_size, buffer, src_addr, dest_addr, protocol);
}
pub const guid align(8) = Guid{
.time_low = 0xa19832b9,
.time_mid = 0xac25,
.time_high_and_version = 0x11d3,
.clock_seq_high_and_reserved = 0x9a,
.clock_seq_low = 0x2d,
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
};
};
pub const MacAddress = [32]u8;
pub const SimpleNetworkMode = extern struct {
state: SimpleNetworkState,
hw_address_size: u32,
media_header_size: u32,
max_packet_size: u32,
nvram_size: u32,
nvram_access_size: u32,
receive_filter_mask: SimpleNetworkReceiveFilter,
receive_filter_setting: SimpleNetworkReceiveFilter,
max_mcast_filter_count: u32,
mcast_filter_count: u32,
mcast_filter: [16]MacAddress,
current_address: MacAddress,
broadcast_address: MacAddress,
permanent_address: MacAddress,
if_type: u8,
mac_address_changeable: bool,
multiple_tx_supported: bool,
media_present_supported: bool,
media_present: bool,
};
pub const SimpleNetworkReceiveFilter = packed struct {
receive_unicast: bool,
receive_multicast: bool,
receive_broadcast: bool,
receive_promiscuous: bool,
receive_promiscuous_multicast: bool,
_pad1: u3 = undefined,
_pad2: u8 = undefined,
_pad3: u16 = undefined,
};
pub const SimpleNetworkState = enum(u32) {
Stopped,
Started,
Initialized,
};
pub const NetworkStatistics = extern struct {
rx_total_frames: u64,
rx_good_frames: u64,
rx_undersize_frames: u64,
rx_oversize_frames: u64,
rx_dropped_frames: u64,
rx_unicast_frames: u64,
rx_broadcast_frames: u64,
rx_multicast_frames: u64,
rx_crc_error_frames: u64,
rx_total_bytes: u64,
tx_total_frames: u64,
tx_good_frames: u64,
tx_undersize_frames: u64,
tx_oversize_frames: u64,
tx_dropped_frames: u64,
tx_unicast_frames: u64,
tx_broadcast_frames: u64,
tx_multicast_frames: u64,
tx_crc_error_frames: u64,
tx_total_bytes: u64,
collisions: u64,
unsupported_protocol: u64,
rx_duplicated_frames: u64,
rx_decryptError_frames: u64,
tx_error_frames: u64,
tx_retry_frames: u64,
};
pub const SimpleNetworkInterruptStatus = packed struct {
receive_interrupt: bool,
transmit_interrupt: bool,
command_interrupt: bool,
software_interrupt: bool,
_pad1: u4,
_pad2: u8,
_pad3: u16,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/hii_popup_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Status = uefi.Status;
const hii = uefi.protocols.hii;
/// Display a popup window
pub const HIIPopupProtocol = extern struct {
revision: u64,
_create_popup: fn (*const HIIPopupProtocol, HIIPopupStyle, HIIPopupType, hii.HIIHandle, u16, ?*HIIPopupSelection) callconv(.C) Status,
/// Displays a popup window.
pub fn createPopup(self: *const HIIPopupProtocol, style: HIIPopupStyle, popup_type: HIIPopupType, handle: hii.HIIHandle, msg: u16, user_selection: ?*HIIPopupSelection) Status {
return self._create_popup(self, style, popup_type, handle, msg, user_selection);
}
pub const guid align(8) = Guid{
.time_low = 0x4311edc0,
.time_mid = 0x6054,
.time_high_and_version = 0x46d4,
.clock_seq_high_and_reserved = 0x9e,
.clock_seq_low = 0x40,
.node = [_]u8{ 0x89, 0x3e, 0xa9, 0x52, 0xfc, 0xcc },
};
};
pub const HIIPopupStyle = enum(u32) {
Info,
Warning,
Error,
};
pub const HIIPopupType = enum(u32) {
Ok,
Cancel,
YesNo,
YesNoCancel,
};
pub const HIIPopupSelection = enum(u32) {
Ok,
Cancel,
Yes,
No,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/ip6_service_binding_protocol.zig | const uefi = @import("std").os.uefi;
const Handle = uefi.Handle;
const Guid = uefi.Guid;
const Status = uefi.Status;
pub const Ip6ServiceBindingProtocol = extern struct {
_create_child: fn (*const Ip6ServiceBindingProtocol, *?Handle) callconv(.C) Status,
_destroy_child: fn (*const Ip6ServiceBindingProtocol, Handle) callconv(.C) Status,
pub fn createChild(self: *const Ip6ServiceBindingProtocol, handle: *?Handle) Status {
return self._create_child(self, handle);
}
pub fn destroyChild(self: *const Ip6ServiceBindingProtocol, handle: Handle) Status {
return self._destroy_child(self, handle);
}
pub const guid align(8) = Guid{
.time_low = 0xec835dd3,
.time_mid = 0xfe0f,
.time_high_and_version = 0x617b,
.clock_seq_high_and_reserved = 0xa6,
.clock_seq_low = 0x21,
.node = [_]u8{ 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/shell_parameters_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const FileHandle = uefi.FileHandle;
pub const ShellParametersProtocol = extern struct {
argv: [*][*:0]const u16,
argc: usize,
stdin: FileHandle,
stdout: FileHandle,
stderr: FileHandle,
pub const guid align(8) = Guid{
.time_low = 0x752f3136,
.time_mid = 0x4e16,
.time_high_and_version = 0x4fdc,
.clock_seq_high_and_reserved = 0xa2,
.clock_seq_low = 0x2a,
.node = [_]u8{ 0xe5, 0xf4, 0x68, 0x12, 0xf4, 0xca },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/edid_discovered_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
/// EDID information for a video output device
pub const EdidDiscoveredProtocol = extern struct {
size_of_edid: u32,
edid: ?[*]u8,
pub const guid align(8) = Guid{
.time_low = 0x1c0c34f6,
.time_mid = 0xd380,
.time_high_and_version = 0x41fa,
.clock_seq_high_and_reserved = 0xa0,
.clock_seq_low = 0x49,
.node = [_]u8{ 0x8a, 0xd0, 0x6c, 0x1a, 0x66, 0xaa },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/simple_text_output_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Status = uefi.Status;
/// Character output devices
pub const SimpleTextOutputProtocol = extern struct {
_reset: fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
_output_string: fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,
_test_string: fn (*const SimpleTextOutputProtocol, [*:0]const u16) callconv(.C) Status,
_query_mode: fn (*const SimpleTextOutputProtocol, usize, *usize, *usize) callconv(.C) Status,
_set_mode: fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
_set_attribute: fn (*const SimpleTextOutputProtocol, usize) callconv(.C) Status,
_clear_screen: fn (*const SimpleTextOutputProtocol) callconv(.C) Status,
_set_cursor_position: fn (*const SimpleTextOutputProtocol, usize, usize) callconv(.C) Status,
_enable_cursor: fn (*const SimpleTextOutputProtocol, bool) callconv(.C) Status,
mode: *SimpleTextOutputMode,
/// Resets the text output device hardware.
pub fn reset(self: *const SimpleTextOutputProtocol, verify: bool) Status {
return self._reset(self, verify);
}
/// Writes a string to the output device.
pub fn outputString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) Status {
return self._output_string(self, msg);
}
/// Verifies that all characters in a string can be output to the target device.
pub fn testString(self: *const SimpleTextOutputProtocol, msg: [*:0]const u16) Status {
return self._test_string(self, msg);
}
/// Returns information for an available text mode that the output device(s) supports.
pub fn queryMode(self: *const SimpleTextOutputProtocol, mode_number: usize, columns: *usize, rows: *usize) Status {
return self._query_mode(self, mode_number, columns, rows);
}
/// Sets the output device(s) to a specified mode.
pub fn setMode(self: *const SimpleTextOutputProtocol, mode_number: usize) Status {
return self._set_mode(self, mode_number);
}
/// Sets the background and foreground colors for the outputString() and clearScreen() functions.
pub fn setAttribute(self: *const SimpleTextOutputProtocol, attribute: usize) Status {
return self._set_attribute(self, attribute);
}
/// Clears the output device(s) display to the currently selected background color.
pub fn clearScreen(self: *const SimpleTextOutputProtocol) Status {
return self._clear_screen(self);
}
/// Sets the current coordinates of the cursor position.
pub fn setCursorPosition(self: *const SimpleTextOutputProtocol, column: usize, row: usize) Status {
return self._set_cursor_position(self, column, row);
}
/// Makes the cursor visible or invisible.
pub fn enableCursor(self: *const SimpleTextOutputProtocol, visible: bool) Status {
return self._enable_cursor(self, visible);
}
pub const guid align(8) = Guid{
.time_low = 0x387477c2,
.time_mid = 0x69c7,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x39,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
pub const boxdraw_horizontal: u16 = 0x2500;
pub const boxdraw_vertical: u16 = 0x2502;
pub const boxdraw_down_right: u16 = 0x250c;
pub const boxdraw_down_left: u16 = 0x2510;
pub const boxdraw_up_right: u16 = 0x2514;
pub const boxdraw_up_left: u16 = 0x2518;
pub const boxdraw_vertical_right: u16 = 0x251c;
pub const boxdraw_vertical_left: u16 = 0x2524;
pub const boxdraw_down_horizontal: u16 = 0x252c;
pub const boxdraw_up_horizontal: u16 = 0x2534;
pub const boxdraw_vertical_horizontal: u16 = 0x253c;
pub const boxdraw_double_horizontal: u16 = 0x2550;
pub const boxdraw_double_vertical: u16 = 0x2551;
pub const boxdraw_down_right_double: u16 = 0x2552;
pub const boxdraw_down_double_right: u16 = 0x2553;
pub const boxdraw_double_down_right: u16 = 0x2554;
pub const boxdraw_down_left_double: u16 = 0x2555;
pub const boxdraw_down_double_left: u16 = 0x2556;
pub const boxdraw_double_down_left: u16 = 0x2557;
pub const boxdraw_up_right_double: u16 = 0x2558;
pub const boxdraw_up_double_right: u16 = 0x2559;
pub const boxdraw_double_up_right: u16 = 0x255a;
pub const boxdraw_up_left_double: u16 = 0x255b;
pub const boxdraw_up_double_left: u16 = 0x255c;
pub const boxdraw_double_up_left: u16 = 0x255d;
pub const boxdraw_vertical_right_double: u16 = 0x255e;
pub const boxdraw_vertical_double_right: u16 = 0x255f;
pub const boxdraw_double_vertical_right: u16 = 0x2560;
pub const boxdraw_vertical_left_double: u16 = 0x2561;
pub const boxdraw_vertical_double_left: u16 = 0x2562;
pub const boxdraw_double_vertical_left: u16 = 0x2563;
pub const boxdraw_down_horizontal_double: u16 = 0x2564;
pub const boxdraw_down_double_horizontal: u16 = 0x2565;
pub const boxdraw_double_down_horizontal: u16 = 0x2566;
pub const boxdraw_up_horizontal_double: u16 = 0x2567;
pub const boxdraw_up_double_horizontal: u16 = 0x2568;
pub const boxdraw_double_up_horizontal: u16 = 0x2569;
pub const boxdraw_vertical_horizontal_double: u16 = 0x256a;
pub const boxdraw_vertical_double_horizontal: u16 = 0x256b;
pub const boxdraw_double_vertical_horizontal: u16 = 0x256c;
pub const blockelement_full_block: u16 = 0x2588;
pub const blockelement_light_shade: u16 = 0x2591;
pub const geometricshape_up_triangle: u16 = 0x25b2;
pub const geometricshape_right_triangle: u16 = 0x25ba;
pub const geometricshape_down_triangle: u16 = 0x25bc;
pub const geometricshape_left_triangle: u16 = 0x25c4;
pub const arrow_up: u16 = 0x2591;
pub const arrow_down: u16 = 0x2593;
pub const black: u8 = 0x00;
pub const blue: u8 = 0x01;
pub const green: u8 = 0x02;
pub const cyan: u8 = 0x03;
pub const red: u8 = 0x04;
pub const magenta: u8 = 0x05;
pub const brown: u8 = 0x06;
pub const lightgray: u8 = 0x07;
pub const bright: u8 = 0x08;
pub const darkgray: u8 = 0x08;
pub const lightblue: u8 = 0x09;
pub const lightgreen: u8 = 0x0a;
pub const lightcyan: u8 = 0x0b;
pub const lightred: u8 = 0x0c;
pub const lightmagenta: u8 = 0x0d;
pub const yellow: u8 = 0x0e;
pub const white: u8 = 0x0f;
pub const background_black: u8 = 0x00;
pub const background_blue: u8 = 0x10;
pub const background_green: u8 = 0x20;
pub const background_cyan: u8 = 0x30;
pub const background_red: u8 = 0x40;
pub const background_magenta: u8 = 0x50;
pub const background_brown: u8 = 0x60;
pub const background_lightgray: u8 = 0x70;
};
pub const SimpleTextOutputMode = extern struct {
max_mode: u32, // specified as signed
mode: u32, // specified as signed
attribute: i32,
cursor_column: i32,
cursor_row: i32,
cursor_visible: bool,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/file_protocol.zig | const std = @import("std");
const uefi = std.os.uefi;
const io = std.io;
const Guid = uefi.Guid;
const Time = uefi.Time;
const Status = uefi.Status;
pub const FileProtocol = extern struct {
revision: u64,
_open: fn (*const FileProtocol, **const FileProtocol, [*:0]const u16, u64, u64) callconv(.C) Status,
_close: fn (*const FileProtocol) callconv(.C) Status,
_delete: fn (*const FileProtocol) callconv(.C) Status,
_read: fn (*const FileProtocol, *usize, [*]u8) callconv(.C) Status,
_write: fn (*const FileProtocol, *usize, [*]const u8) callconv(.C) Status,
_get_position: fn (*const FileProtocol, *u64) callconv(.C) Status,
_set_position: fn (*const FileProtocol, u64) callconv(.C) Status,
_get_info: fn (*const FileProtocol, *align(8) const Guid, *const usize, [*]u8) callconv(.C) Status,
_set_info: fn (*const FileProtocol, *align(8) const Guid, usize, [*]const u8) callconv(.C) Status,
_flush: fn (*const FileProtocol) callconv(.C) Status,
pub const SeekError = error{SeekError};
pub const GetSeekPosError = error{GetSeekPosError};
pub const ReadError = error{ReadError};
pub const WriteError = error{WriteError};
pub const SeekableStream = io.SeekableStream(*const FileProtocol, SeekError, GetSeekPosError, seekTo, seekBy, getPos, getEndPos);
pub const Reader = io.Reader(*const FileProtocol, ReadError, readFn);
pub const Writer = io.Writer(*const FileProtocol, WriteError, writeFn);
pub fn seekableStream(self: *FileProtocol) SeekableStream {
return .{ .context = self };
}
pub fn reader(self: *FileProtocol) Reader {
return .{ .context = self };
}
pub fn writer(self: *FileProtocol) Writer {
return .{ .context = self };
}
pub fn open(self: *const FileProtocol, new_handle: **const FileProtocol, file_name: [*:0]const u16, open_mode: u64, attributes: u64) Status {
return self._open(self, new_handle, file_name, open_mode, attributes);
}
pub fn close(self: *const FileProtocol) Status {
return self._close(self);
}
pub fn delete(self: *const FileProtocol) Status {
return self._delete(self);
}
pub fn read(self: *const FileProtocol, buffer_size: *usize, buffer: [*]u8) Status {
return self._read(self, buffer_size, buffer);
}
fn readFn(self: *const FileProtocol, buffer: []u8) ReadError!usize {
var size: usize = buffer.len;
if (.Success != self.read(&size, buffer.ptr)) return ReadError.ReadError;
return size;
}
pub fn write(self: *const FileProtocol, buffer_size: *usize, buffer: [*]const u8) Status {
return self._write(self, buffer_size, buffer);
}
fn writeFn(self: *const FileProtocol, bytes: []const u8) WriteError!usize {
var size: usize = bytes.len;
if (.Success != self.write(&size, bytes.ptr)) return WriteError.WriteError;
return size;
}
pub fn getPosition(self: *const FileProtocol, position: *u64) Status {
return self._get_position(self, position);
}
fn getPos(self: *const FileProtocol) GetSeekPosError!u64 {
var pos: u64 = undefined;
if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError;
return pos;
}
fn getEndPos(self: *const FileProtocol) GetSeekPosError!u64 {
// preserve the old file position
var pos: u64 = undefined;
if (.Success != self.getPosition(&pos)) return GetSeekPosError.GetSeekPosError;
// seek to end of file to get position = file size
if (.Success != self.setPosition(efi_file_position_end_of_file)) return GetSeekPosError.GetSeekPosError;
// restore the old position
if (.Success != self.setPosition(pos)) return GetSeekPosError.GetSeekPosError;
// return the file size = position
return pos;
}
pub fn setPosition(self: *const FileProtocol, position: u64) Status {
return self._set_position(self, position);
}
fn seekTo(self: *const FileProtocol, pos: u64) SeekError!void {
if (.Success != self.setPosition(pos)) return SeekError.SeekError;
}
fn seekBy(self: *const FileProtocol, offset: i64) SeekError!void {
// save the old position and calculate the delta
var pos: u64 = undefined;
if (.Success != self.getPosition(&pos)) return SeekError.SeekError;
const seek_back = offset < 0;
const amt = std.math.absCast(offset);
if (seek_back) {
pos += amt;
} else {
pos -= amt;
}
if (.Success != self.setPosition(pos)) return SeekError.SeekError;
}
pub fn getInfo(self: *const FileProtocol, information_type: *align(8) const Guid, buffer_size: *usize, buffer: [*]u8) Status {
return self._get_info(self, information_type, buffer_size, buffer);
}
pub fn setInfo(self: *const FileProtocol, information_type: *align(8) const Guid, buffer_size: usize, buffer: [*]const u8) Status {
return self._set_info(self, information_type, buffer_size, buffer);
}
pub fn flush(self: *const FileProtocol) Status {
return self._flush(self);
}
pub const guid align(8) = Guid{
.time_low = 0x09576e92,
.time_mid = 0x6d3f,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x39,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
pub const efi_file_mode_read: u64 = 0x0000000000000001;
pub const efi_file_mode_write: u64 = 0x0000000000000002;
pub const efi_file_mode_create: u64 = 0x8000000000000000;
pub const efi_file_read_only: u64 = 0x0000000000000001;
pub const efi_file_hidden: u64 = 0x0000000000000002;
pub const efi_file_system: u64 = 0x0000000000000004;
pub const efi_file_reserved: u64 = 0x0000000000000008;
pub const efi_file_directory: u64 = 0x0000000000000010;
pub const efi_file_archive: u64 = 0x0000000000000020;
pub const efi_file_valid_attr: u64 = 0x0000000000000037;
pub const efi_file_position_end_of_file: u64 = 0xffffffffffffffff;
};
pub const FileInfo = extern struct {
size: u64,
file_size: u64,
physical_size: u64,
create_time: Time,
last_access_time: Time,
modification_time: Time,
attribute: u64,
pub fn getFileName(self: *const FileInfo) [*:0]const u16 {
return @as([*:0]const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FileInfo)));
}
pub const efi_file_read_only: u64 = 0x0000000000000001;
pub const efi_file_hidden: u64 = 0x0000000000000002;
pub const efi_file_system: u64 = 0x0000000000000004;
pub const efi_file_reserved: u64 = 0x0000000000000008;
pub const efi_file_directory: u64 = 0x0000000000000010;
pub const efi_file_archive: u64 = 0x0000000000000020;
pub const efi_file_valid_attr: u64 = 0x0000000000000037;
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/simple_file_system_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const FileProtocol = uefi.protocols.FileProtocol;
const Status = uefi.Status;
pub const SimpleFileSystemProtocol = extern struct {
revision: u64,
_open_volume: fn (*const SimpleFileSystemProtocol, **const FileProtocol) callconv(.C) Status,
pub fn openVolume(self: *const SimpleFileSystemProtocol, root: **const FileProtocol) Status {
return self._open_volume(self, root);
}
pub const guid align(8) = Guid{
.time_low = 0x0964e5b22,
.time_mid = 0x6459,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x39,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/ip6_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Event = uefi.Event;
const Status = uefi.Status;
const MacAddress = uefi.protocols.MacAddress;
const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
pub const Ip6Protocol = extern struct {
_get_mode_data: fn (*const Ip6Protocol, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
_configure: fn (*const Ip6Protocol, ?*const Ip6ConfigData) callconv(.C) Status,
_groups: fn (*const Ip6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
_routes: fn (*const Ip6Protocol, bool, ?*const Ip6Address, u8, ?*const Ip6Address) callconv(.C) Status,
_neighbors: fn (*const Ip6Protocol, bool, *const Ip6Address, ?*const MacAddress, u32, bool) callconv(.C) Status,
_transmit: fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
_receive: fn (*const Ip6Protocol, *Ip6CompletionToken) callconv(.C) Status,
_cancel: fn (*const Ip6Protocol, ?*Ip6CompletionToken) callconv(.C) Status,
_poll: fn (*const Ip6Protocol) callconv(.C) Status,
/// Gets the current operational settings for this instance of the EFI IPv6 Protocol driver.
pub fn getModeData(self: *const Ip6Protocol, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
return self._get_mode_data(self, ip6_mode_data, mnp_config_data, snp_mode_data);
}
/// Assign IPv6 address and other configuration parameter to this EFI IPv6 Protocol driver instance.
pub fn configure(self: *const Ip6Protocol, ip6_config_data: ?*const Ip6ConfigData) Status {
return self._configure(self, ip6_config_data);
}
/// Joins and leaves multicast groups.
pub fn groups(self: *const Ip6Protocol, join_flag: bool, group_address: ?*const Ip6Address) Status {
return self._groups(self, join_flag, group_address);
}
/// Adds and deletes routing table entries.
pub fn routes(self: *const Ip6Protocol, delete_route: bool, destination: ?*const Ip6Address, prefix_length: u8, gateway_address: ?*const Ip6Address) Status {
return self._routes(self, delete_route, destination, prefix_length, gateway_address);
}
/// Add or delete Neighbor cache entries.
pub fn neighbors(self: *const Ip6Protocol, delete_flag: bool, target_ip6_address: *const Ip6Address, target_link_address: ?*const MacAddress, timeout: u32, override: bool) Status {
return self._neighbors(self, delete_flag, target_ip6_address, target_link_address, timeout, override);
}
/// Places outgoing data packets into the transmit queue.
pub fn transmit(self: *const Ip6Protocol, token: *Ip6CompletionToken) Status {
return self._transmit(self, token);
}
/// Places a receiving request into the receiving queue.
pub fn receive(self: *const Ip6Protocol, token: *Ip6CompletionToken) Status {
return self._receive(self, token);
}
/// Abort an asynchronous transmits or receive request.
pub fn cancel(self: *const Ip6Protocol, token: ?*Ip6CompletionToken) Status {
return self._cancel(self, token);
}
/// Polls for incoming data packets and processes outgoing data packets.
pub fn poll(self: *const Ip6Protocol) Status {
return self._poll(self);
}
pub const guid align(8) = Guid{
.time_low = 0x2c8759d5,
.time_mid = 0x5c2d,
.time_high_and_version = 0x66ef,
.clock_seq_high_and_reserved = 0x92,
.clock_seq_low = 0x5f,
.node = [_]u8{ 0xb6, 0x6c, 0x10, 0x19, 0x57, 0xe2 },
};
};
pub const Ip6ModeData = extern struct {
is_started: bool,
max_packet_size: u32,
config_data: Ip6ConfigData,
is_configured: bool,
address_count: u32,
address_list: [*]Ip6AddressInfo,
group_count: u32,
group_table: [*]Ip6Address,
route_count: u32,
route_table: [*]Ip6RouteTable,
neighbor_count: u32,
neighbor_cache: [*]Ip6NeighborCache,
prefix_count: u32,
prefix_table: [*]Ip6AddressInfo,
icmp_type_count: u32,
icmp_type_list: [*]Ip6IcmpType,
};
pub const Ip6ConfigData = extern struct {
default_protocol: u8,
accept_any_protocol: bool,
accept_icmp_errors: bool,
accept_promiscuous: bool,
destination_address: Ip6Address,
station_address: Ip6Address,
traffic_class: u8,
hop_limit: u8,
flow_label: u32,
receive_timeout: u32,
transmit_timeout: u32,
};
pub const Ip6Address = [16]u8;
pub const Ip6AddressInfo = extern struct {
address: Ip6Address,
prefix_length: u8,
};
pub const Ip6RouteTable = extern struct {
gateway: Ip6Address,
destination: Ip6Address,
prefix_length: u8,
};
pub const Ip6NeighborState = enum(u32) {
Incomplete,
Reachable,
Stale,
Delay,
Probe,
};
pub const Ip6NeighborCache = extern struct {
neighbor: Ip6Address,
link_address: MacAddress,
state: Ip6NeighborState,
};
pub const Ip6IcmpType = extern struct {
type: u8,
code: u8,
};
pub const Ip6CompletionToken = extern struct {
event: Event,
status: Status,
packet: *anyopaque, // union TODO
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/device_path_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
pub const DevicePathProtocol = packed struct {
type: DevicePathType,
subtype: u8,
length: u16,
pub const guid align(8) = Guid{
.time_low = 0x09576e91,
.time_mid = 0x6d3f,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x39,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
pub fn getDevicePath(self: *const DevicePathProtocol) ?DevicePath {
return switch (self.type) {
.Hardware => blk: {
const hardware: ?HardwareDevicePath = switch (@as(HardwareDevicePath.Subtype, @enumFromInt(self.subtype))) {
.Pci => .{ .Pci = @as(*const HardwareDevicePath.PciDevicePath, @ptrCast(self)) },
.PcCard => .{ .PcCard = @as(*const HardwareDevicePath.PcCardDevicePath, @ptrCast(self)) },
.MemoryMapped => .{ .MemoryMapped = @as(*const HardwareDevicePath.MemoryMappedDevicePath, @ptrCast(self)) },
.Vendor => .{ .Vendor = @as(*const HardwareDevicePath.VendorDevicePath, @ptrCast(self)) },
.Controller => .{ .Controller = @as(*const HardwareDevicePath.ControllerDevicePath, @ptrCast(self)) },
.Bmc => .{ .Bmc = @as(*const HardwareDevicePath.BmcDevicePath, @ptrCast(self)) },
_ => null,
};
break :blk if (hardware) |h| .{ .Hardware = h } else null;
},
.Acpi => blk: {
const acpi: ?AcpiDevicePath = switch (@as(AcpiDevicePath.Subtype, @enumFromInt(self.subtype))) {
else => null, // TODO
};
break :blk if (acpi) |a| .{ .Acpi = a } else null;
},
.Messaging => blk: {
const messaging: ?MessagingDevicePath = switch (@as(MessagingDevicePath.Subtype, @enumFromInt(self.subtype))) {
else => null, // TODO
};
break :blk if (messaging) |m| .{ .Messaging = m } else null;
},
.Media => blk: {
const media: ?MediaDevicePath = switch (@as(MediaDevicePath.Subtype, @enumFromInt(self.subtype))) {
.HardDrive => .{ .HardDrive = @as(*const MediaDevicePath.HardDriveDevicePath, @ptrCast(self)) },
.Cdrom => .{ .Cdrom = @as(*const MediaDevicePath.CdromDevicePath, @ptrCast(self)) },
.Vendor => .{ .Vendor = @as(*const MediaDevicePath.VendorDevicePath, @ptrCast(self)) },
.FilePath => .{ .FilePath = @as(*const MediaDevicePath.FilePathDevicePath, @ptrCast(self)) },
.MediaProtocol => .{ .MediaProtocol = @as(*const MediaDevicePath.MediaProtocolDevicePath, @ptrCast(self)) },
.PiwgFirmwareFile => .{ .PiwgFirmwareFile = @as(*const MediaDevicePath.PiwgFirmwareFileDevicePath, @ptrCast(self)) },
.PiwgFirmwareVolume => .{ .PiwgFirmwareVolume = @as(*const MediaDevicePath.PiwgFirmwareVolumeDevicePath, @ptrCast(self)) },
.RelativeOffsetRange => .{ .RelativeOffsetRange = @as(*const MediaDevicePath.RelativeOffsetRangeDevicePath, @ptrCast(self)) },
.RamDisk => .{ .RamDisk = @as(*const MediaDevicePath.RamDiskDevicePath, @ptrCast(self)) },
_ => null,
};
break :blk if (media) |m| .{ .Media = m } else null;
},
.BiosBootSpecification => blk: {
const bbs: ?BiosBootSpecificationDevicePath = switch (@as(BiosBootSpecificationDevicePath.Subtype, @enumFromInt(self.subtype))) {
.BBS101 => .{ .BBS101 = @as(*const BiosBootSpecificationDevicePath.BBS101DevicePath, @ptrCast(self)) },
_ => null,
};
break :blk if (bbs) |b| .{ .BiosBootSpecification = b } else null;
},
.End => blk: {
const end: ?EndDevicePath = switch (@as(EndDevicePath.Subtype, @enumFromInt(self.subtype))) {
.EndEntire => .{ .EndEntire = @as(*const EndDevicePath.EndEntireDevicePath, @ptrCast(self)) },
.EndThisInstance => .{ .EndThisInstance = @as(*const EndDevicePath.EndThisInstanceDevicePath, @ptrCast(self)) },
_ => null,
};
break :blk if (end) |e| .{ .End = e } else null;
},
_ => null,
};
}
};
pub const DevicePath = union(DevicePathType) {
Hardware: HardwareDevicePath,
Acpi: AcpiDevicePath,
Messaging: MessagingDevicePath,
Media: MediaDevicePath,
BiosBootSpecification: BiosBootSpecificationDevicePath,
End: EndDevicePath,
};
pub const DevicePathType = enum(u8) {
Hardware = 0x01,
Acpi = 0x02,
Messaging = 0x03,
Media = 0x04,
BiosBootSpecification = 0x05,
End = 0x7f,
_,
};
pub const HardwareDevicePath = union(Subtype) {
Pci: *const PciDevicePath,
PcCard: *const PcCardDevicePath,
MemoryMapped: *const MemoryMappedDevicePath,
Vendor: *const VendorDevicePath,
Controller: *const ControllerDevicePath,
Bmc: *const BmcDevicePath,
pub const Subtype = enum(u8) {
Pci = 1,
PcCard = 2,
MemoryMapped = 3,
Vendor = 4,
Controller = 5,
Bmc = 6,
_,
};
pub const PciDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const PcCardDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const MemoryMappedDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const VendorDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const ControllerDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const BmcDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
};
pub const AcpiDevicePath = union(Subtype) {
Acpi: void, // TODO
ExpandedAcpi: void, // TODO
Adr: void, // TODO
Nvdimm: void, // TODO
pub const Subtype = enum(u8) {
Acpi = 1,
ExpandedAcpi = 2,
Adr = 3,
Nvdimm = 4,
_,
};
};
pub const MessagingDevicePath = union(Subtype) {
Atapi: void, // TODO
Scsi: void, // TODO
FibreChannel: void, // TODO
FibreChannelEx: void, // TODO
@"1394": void, // TODO
Usb: void, // TODO
Sata: void, // TODO
UsbWwid: void, // TODO
Lun: void, // TODO
UsbClass: void, // TODO
I2o: void, // TODO
MacAddress: void, // TODO
Ipv4: void, // TODO
Ipv6: void, // TODO
Vlan: void, // TODO
InfiniBand: void, // TODO
Uart: void, // TODO
Vendor: void, // TODO
pub const Subtype = enum(u8) {
Atapi = 1,
Scsi = 2,
FibreChannel = 3,
FibreChannelEx = 21,
@"1394" = 4,
Usb = 5,
Sata = 18,
UsbWwid = 16,
Lun = 17,
UsbClass = 15,
I2o = 6,
MacAddress = 11,
Ipv4 = 12,
Ipv6 = 13,
Vlan = 20,
InfiniBand = 9,
Uart = 14,
Vendor = 10,
_,
};
};
pub const MediaDevicePath = union(Subtype) {
HardDrive: *const HardDriveDevicePath,
Cdrom: *const CdromDevicePath,
Vendor: *const VendorDevicePath,
FilePath: *const FilePathDevicePath,
MediaProtocol: *const MediaProtocolDevicePath,
PiwgFirmwareFile: *const PiwgFirmwareFileDevicePath,
PiwgFirmwareVolume: *const PiwgFirmwareVolumeDevicePath,
RelativeOffsetRange: *const RelativeOffsetRangeDevicePath,
RamDisk: *const RamDiskDevicePath,
pub const Subtype = enum(u8) {
HardDrive = 1,
Cdrom = 2,
Vendor = 3,
FilePath = 4,
MediaProtocol = 5,
PiwgFirmwareFile = 6,
PiwgFirmwareVolume = 7,
RelativeOffsetRange = 8,
RamDisk = 9,
_,
};
pub const HardDriveDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const CdromDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const VendorDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const FilePathDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
pub fn getPath(self: *const FilePathDevicePath) [*:0]const u16 {
return @as([*:0]align(1) const u16, @ptrCast(@as([*]const u8, @ptrCast(self)) + @sizeOf(FilePathDevicePath)));
}
};
pub const MediaProtocolDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
// TODO
};
pub const PiwgFirmwareFileDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
};
pub const PiwgFirmwareVolumeDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
};
pub const RelativeOffsetRangeDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
reserved: u32,
start: u64,
end: u64,
};
pub const RamDiskDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
start: u64,
end: u64,
disk_type: uefi.Guid,
instance: u16,
};
};
pub const BiosBootSpecificationDevicePath = union(Subtype) {
BBS101: *const BBS101DevicePath,
pub const Subtype = enum(u8) {
BBS101 = 1,
_,
};
pub const BBS101DevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
device_type: u16,
status_flag: u16,
pub fn getDescription(self: *const BBS101DevicePath) [*:0]const u8 {
return @as([*:0]const u8, @ptrCast(self)) + @sizeOf(BBS101DevicePath);
}
};
};
pub const EndDevicePath = union(Subtype) {
EndEntire: *const EndEntireDevicePath,
EndThisInstance: *const EndThisInstanceDevicePath,
pub const Subtype = enum(u8) {
EndEntire = 0xff,
EndThisInstance = 0x01,
_,
};
pub const EndEntireDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
};
pub const EndThisInstanceDevicePath = packed struct {
type: DevicePathType,
subtype: Subtype,
length: u16,
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/simple_text_input_ex_protocol.zig | const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
const Status = uefi.Status;
/// Character input devices, e.g. Keyboard
pub const SimpleTextInputExProtocol = extern struct {
_reset: fn (*const SimpleTextInputExProtocol, bool) callconv(.C) Status,
_read_key_stroke_ex: fn (*const SimpleTextInputExProtocol, *KeyData) callconv(.C) Status,
wait_for_key_ex: Event,
_set_state: fn (*const SimpleTextInputExProtocol, *const u8) callconv(.C) Status,
_register_key_notify: fn (*const SimpleTextInputExProtocol, *const KeyData, fn (*const KeyData) callconv(.C) usize, **anyopaque) callconv(.C) Status,
_unregister_key_notify: fn (*const SimpleTextInputExProtocol, *const anyopaque) callconv(.C) Status,
/// Resets the input device hardware.
pub fn reset(self: *const SimpleTextInputExProtocol, verify: bool) Status {
return self._reset(self, verify);
}
/// Reads the next keystroke from the input device.
pub fn readKeyStrokeEx(self: *const SimpleTextInputExProtocol, key_data: *KeyData) Status {
return self._read_key_stroke_ex(self, key_data);
}
/// Set certain state for the input device.
pub fn setState(self: *const SimpleTextInputExProtocol, state: *const u8) Status {
return self._set_state(self, state);
}
/// Register a notification function for a particular keystroke for the input device.
pub fn registerKeyNotify(self: *const SimpleTextInputExProtocol, key_data: *const KeyData, notify: fn (*const KeyData) callconv(.C) usize, handle: **anyopaque) Status {
return self._register_key_notify(self, key_data, notify, handle);
}
/// Remove the notification that was previously registered.
pub fn unregisterKeyNotify(self: *const SimpleTextInputExProtocol, handle: *const anyopaque) Status {
return self._unregister_key_notify(self, handle);
}
pub const guid align(8) = Guid{
.time_low = 0xdd9e7534,
.time_mid = 0x7762,
.time_high_and_version = 0x4698,
.clock_seq_high_and_reserved = 0x8c,
.clock_seq_low = 0x14,
.node = [_]u8{ 0xf5, 0x85, 0x17, 0xa6, 0x25, 0xaa },
};
};
pub const KeyData = extern struct {
key: InputKey = undefined,
key_state: KeyState = undefined,
};
pub const KeyState = extern struct {
key_shift_state: packed struct {
right_shift_pressed: bool,
left_shift_pressed: bool,
right_control_pressed: bool,
left_control_pressed: bool,
right_alt_pressed: bool,
left_alt_pressed: bool,
right_logo_pressed: bool,
left_logo_pressed: bool,
menu_key_pressed: bool,
sys_req_pressed: bool,
_pad1: u21,
shift_state_valid: bool,
},
key_toggle_state: packed struct {
scroll_lock_active: bool,
num_lock_active: bool,
caps_lock_active: bool,
_pad1: u3,
key_state_exposed: bool,
toggle_state_valid: bool,
},
};
pub const InputKey = extern struct {
scan_code: u16,
unicode_char: u16,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/absolute_pointer_protocol.zig | const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
const Status = uefi.Status;
/// Protocol for touchscreens
pub const AbsolutePointerProtocol = extern struct {
_reset: fn (*const AbsolutePointerProtocol, bool) callconv(.C) Status,
_get_state: fn (*const AbsolutePointerProtocol, *AbsolutePointerState) callconv(.C) Status,
wait_for_input: Event,
mode: *AbsolutePointerMode,
/// Resets the pointer device hardware.
pub fn reset(self: *const AbsolutePointerProtocol, verify: bool) Status {
return self._reset(self, verify);
}
/// Retrieves the current state of a pointer device.
pub fn getState(self: *const AbsolutePointerProtocol, state: *AbsolutePointerState) Status {
return self._get_state(self, state);
}
pub const guid align(8) = Guid{
.time_low = 0x8d59d32b,
.time_mid = 0xc655,
.time_high_and_version = 0x4ae9,
.clock_seq_high_and_reserved = 0x9b,
.clock_seq_low = 0x15,
.node = [_]u8{ 0xf2, 0x59, 0x04, 0x99, 0x2a, 0x43 },
};
};
pub const AbsolutePointerMode = extern struct {
absolute_min_x: u64,
absolute_min_y: u64,
absolute_min_z: u64,
absolute_max_x: u64,
absolute_max_y: u64,
absolute_max_z: u64,
attributes: packed struct {
supports_alt_active: bool,
supports_pressure_as_z: bool,
_pad1: u6,
_pad2: u8,
_pad3: u16,
},
};
pub const AbsolutePointerState = extern struct {
current_x: u64,
current_y: u64,
current_z: u64,
active_buttons: packed struct {
touch_active: bool,
alt_active: bool,
_pad1: u6,
_pad2: u8,
_pad3: u16,
},
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/loaded_image_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Handle = uefi.Handle;
const Status = uefi.Status;
const SystemTable = uefi.tables.SystemTable;
const MemoryType = uefi.tables.MemoryType;
const DevicePathProtocol = uefi.protocols.DevicePathProtocol;
pub const LoadedImageProtocol = extern struct {
revision: u32,
parent_handle: Handle,
system_table: *SystemTable,
device_handle: ?Handle,
file_path: *DevicePathProtocol,
reserved: *anyopaque,
load_options_size: u32,
load_options: ?*anyopaque,
image_base: [*]u8,
image_size: u64,
image_code_type: MemoryType,
image_data_type: MemoryType,
_unload: fn (*const LoadedImageProtocol, Handle) callconv(.C) Status,
/// Unloads an image from memory.
pub fn unload(self: *const LoadedImageProtocol, handle: Handle) Status {
return self._unload(self, handle);
}
pub const guid align(8) = Guid{
.time_low = 0x5b1b31a1,
.time_mid = 0x9562,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x3f,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
};
pub const loaded_image_device_path_protocol_guid align(8) = Guid{
.time_low = 0xbc62157e,
.time_mid = 0x3e33,
.time_high_and_version = 0x4fec,
.clock_seq_high_and_reserved = 0x99,
.clock_seq_low = 0x20,
.node = [_]u8{ 0x2d, 0x3b, 0x36, 0xd7, 0x50, 0xdf },
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/simple_pointer_protocol.zig | const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
const Status = uefi.Status;
/// Protocol for mice
pub const SimplePointerProtocol = struct {
_reset: fn (*const SimplePointerProtocol, bool) callconv(.C) Status,
_get_state: fn (*const SimplePointerProtocol, *SimplePointerState) callconv(.C) Status,
wait_for_input: Event,
mode: *SimplePointerMode,
/// Resets the pointer device hardware.
pub fn reset(self: *const SimplePointerProtocol, verify: bool) Status {
return self._reset(self, verify);
}
/// Retrieves the current state of a pointer device.
pub fn getState(self: *const SimplePointerProtocol, state: *SimplePointerState) Status {
return self._get_state(self, state);
}
pub const guid align(8) = Guid{
.time_low = 0x31878c87,
.time_mid = 0x0b75,
.time_high_and_version = 0x11d5,
.clock_seq_high_and_reserved = 0x9a,
.clock_seq_low = 0x4f,
.node = [_]u8{ 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d },
};
};
pub const SimplePointerMode = struct {
resolution_x: u64,
resolution_y: u64,
resolution_z: u64,
left_button: bool,
right_button: bool,
};
pub const SimplePointerState = struct {
relative_movement_x: i32 = undefined,
relative_movement_y: i32 = undefined,
relative_movement_z: i32 = undefined,
left_button: bool = undefined,
right_button: bool = undefined,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/simple_text_input_protocol.zig | const uefi = @import("std").os.uefi;
const Event = uefi.Event;
const Guid = uefi.Guid;
const InputKey = uefi.protocols.InputKey;
const Status = uefi.Status;
/// Character input devices, e.g. Keyboard
pub const SimpleTextInputProtocol = extern struct {
_reset: fn (*const SimpleTextInputProtocol, bool) callconv(.C) Status,
_read_key_stroke: fn (*const SimpleTextInputProtocol, *InputKey) callconv(.C) Status,
wait_for_key: Event,
/// Resets the input device hardware.
pub fn reset(self: *const SimpleTextInputProtocol, verify: bool) Status {
return self._reset(self, verify);
}
/// Reads the next keystroke from the input device.
pub fn readKeyStroke(self: *const SimpleTextInputProtocol, input_key: *InputKey) Status {
return self._read_key_stroke(self, input_key);
}
pub const guid align(8) = Guid{
.time_low = 0x387477c1,
.time_mid = 0x69c7,
.time_high_and_version = 0x11d2,
.clock_seq_high_and_reserved = 0x8e,
.clock_seq_low = 0x39,
.node = [_]u8{ 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/managed_network_service_binding_protocol.zig | const uefi = @import("std").os.uefi;
const Handle = uefi.Handle;
const Guid = uefi.Guid;
const Status = uefi.Status;
pub const ManagedNetworkServiceBindingProtocol = extern struct {
_create_child: fn (*const ManagedNetworkServiceBindingProtocol, *?Handle) callconv(.C) Status,
_destroy_child: fn (*const ManagedNetworkServiceBindingProtocol, Handle) callconv(.C) Status,
pub fn createChild(self: *const ManagedNetworkServiceBindingProtocol, handle: *?Handle) Status {
return self._create_child(self, handle);
}
pub fn destroyChild(self: *const ManagedNetworkServiceBindingProtocol, handle: Handle) Status {
return self._destroy_child(self, handle);
}
pub const guid align(8) = Guid{
.time_low = 0xf36ff770,
.time_mid = 0xa7e1,
.time_high_and_version = 0x42cf,
.clock_seq_high_and_reserved = 0x9e,
.clock_seq_low = 0xd2,
.node = [_]u8{ 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/udp6_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
const Event = uefi.Event;
const Status = uefi.Status;
const Time = uefi.Time;
const Ip6ModeData = uefi.protocols.Ip6ModeData;
const Ip6Address = uefi.protocols.Ip6Address;
const ManagedNetworkConfigData = uefi.protocols.ManagedNetworkConfigData;
const SimpleNetworkMode = uefi.protocols.SimpleNetworkMode;
pub const Udp6Protocol = extern struct {
_get_mode_data: fn (*const Udp6Protocol, ?*Udp6ConfigData, ?*Ip6ModeData, ?*ManagedNetworkConfigData, ?*SimpleNetworkMode) callconv(.C) Status,
_configure: fn (*const Udp6Protocol, ?*const Udp6ConfigData) callconv(.C) Status,
_groups: fn (*const Udp6Protocol, bool, ?*const Ip6Address) callconv(.C) Status,
_transmit: fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
_receive: fn (*const Udp6Protocol, *Udp6CompletionToken) callconv(.C) Status,
_cancel: fn (*const Udp6Protocol, ?*Udp6CompletionToken) callconv(.C) Status,
_poll: fn (*const Udp6Protocol) callconv(.C) Status,
pub fn getModeData(self: *const Udp6Protocol, udp6_config_data: ?*Udp6ConfigData, ip6_mode_data: ?*Ip6ModeData, mnp_config_data: ?*ManagedNetworkConfigData, snp_mode_data: ?*SimpleNetworkMode) Status {
return self._get_mode_data(self, udp6_config_data, ip6_mode_data, mnp_config_data, snp_mode_data);
}
pub fn configure(self: *const Udp6Protocol, udp6_config_data: ?*const Udp6ConfigData) Status {
return self._configure(self, udp6_config_data);
}
pub fn groups(self: *const Udp6Protocol, join_flag: bool, multicast_address: ?*const Ip6Address) Status {
return self._groups(self, join_flag, multicast_address);
}
pub fn transmit(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status {
return self._transmit(self, token);
}
pub fn receive(self: *const Udp6Protocol, token: *Udp6CompletionToken) Status {
return self._receive(self, token);
}
pub fn cancel(self: *const Udp6Protocol, token: ?*Udp6CompletionToken) Status {
return self._cancel(self, token);
}
pub fn poll(self: *const Udp6Protocol) Status {
return self._poll(self);
}
pub const guid align(8) = uefi.Guid{
.time_low = 0x4f948815,
.time_mid = 0xb4b9,
.time_high_and_version = 0x43cb,
.clock_seq_high_and_reserved = 0x8a,
.clock_seq_low = 0x33,
.node = [_]u8{ 0x90, 0xe0, 0x60, 0xb3, 0x49, 0x55 },
};
};
pub const Udp6ConfigData = extern struct {
accept_promiscuous: bool,
accept_any_port: bool,
allow_duplicate_port: bool,
traffic_class: u8,
hop_limit: u8,
receive_timeout: u32,
transmit_timeout: u32,
station_address: Ip6Address,
station_port: u16,
remote_address: Ip6Address,
remote_port: u16,
};
pub const Udp6CompletionToken = extern struct {
event: Event,
Status: usize,
packet: extern union {
RxData: *Udp6ReceiveData,
TxData: *Udp6TransmitData,
},
};
pub const Udp6ReceiveData = extern struct {
timestamp: Time,
recycle_signal: Event,
udp6_session: Udp6SessionData,
data_length: u32,
fragment_count: u32,
pub fn getFragments(self: *Udp6ReceiveData) []Udp6FragmentData {
return @as([*]Udp6FragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6ReceiveData)))[0..self.fragment_count];
}
};
pub const Udp6TransmitData = extern struct {
udp6_session_data: ?*Udp6SessionData,
data_length: u32,
fragment_count: u32,
pub fn getFragments(self: *Udp6TransmitData) []Udp6FragmentData {
return @as([*]Udp6FragmentData, @ptrCast(@as([*]u8, @ptrCast(self)) + @sizeOf(Udp6TransmitData)))[0..self.fragment_count];
}
};
pub const Udp6SessionData = extern struct {
source_address: Ip6Address,
source_port: u16,
destination_address: Ip6Address,
destination_port: u16,
};
pub const Udp6FragmentData = extern struct {
fragment_length: u32,
fragment_buffer: [*]u8,
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/udp6_service_binding_protocol.zig | const uefi = @import("std").os.uefi;
const Handle = uefi.Handle;
const Guid = uefi.Guid;
const Status = uefi.Status;
pub const Udp6ServiceBindingProtocol = extern struct {
_create_child: fn (*const Udp6ServiceBindingProtocol, *?Handle) callconv(.C) Status,
_destroy_child: fn (*const Udp6ServiceBindingProtocol, Handle) callconv(.C) Status,
pub fn createChild(self: *const Udp6ServiceBindingProtocol, handle: *?Handle) Status {
return self._create_child(self, handle);
}
pub fn destroyChild(self: *const Udp6ServiceBindingProtocol, handle: Handle) Status {
return self._destroy_child(self, handle);
}
pub const guid align(8) = Guid{
.time_low = 0x66ed4721,
.time_mid = 0x3c98,
.time_high_and_version = 0x4d3e,
.clock_seq_high_and_reserved = 0x81,
.clock_seq_low = 0xe3,
.node = [_]u8{ 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54 },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi | repos/gotta-go-fast/src/self-hosted-parser/input_dir/os/uefi/protocols/edid_active_protocol.zig | const uefi = @import("std").os.uefi;
const Guid = uefi.Guid;
/// EDID information for an active video output device
pub const EdidActiveProtocol = extern struct {
size_of_edid: u32,
edid: ?[*]u8,
pub const guid align(8) = Guid{
.time_low = 0xbd8c1056,
.time_mid = 0x9f36,
.time_high_and_version = 0x44ec,
.clock_seq_high_and_reserved = 0x92,
.clock_seq_low = 0xa8,
.node = [_]u8{ 0xa6, 0x33, 0x7f, 0x81, 0x79, 0x86 },
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/avr.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
addsubiw,
avr0,
avr1,
avr2,
avr25,
avr3,
avr31,
avr35,
avr4,
avr5,
avr51,
avr6,
avrtiny,
@"break",
des,
eijmpcall,
elpm,
elpmx,
ijmpcall,
jmpcall,
lpm,
lpmx,
memmappedregs,
movw,
mul,
rmw,
smallstack,
special,
spm,
spmx,
sram,
tinyencoding,
xmega,
xmegau,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.addsubiw)] = .{
.llvm_name = "addsubiw",
.description = "Enable 16-bit register-immediate addition and subtraction instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.avr0)] = .{
.llvm_name = "avr0",
.description = "The device is a part of the avr0 family",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.avr1)] = .{
.llvm_name = "avr1",
.description = "The device is a part of the avr1 family",
.dependencies = featureSet(&[_]Feature{
.avr0,
.lpm,
.memmappedregs,
}),
};
result[@intFromEnum(Feature.avr2)] = .{
.llvm_name = "avr2",
.description = "The device is a part of the avr2 family",
.dependencies = featureSet(&[_]Feature{
.addsubiw,
.avr1,
.ijmpcall,
.sram,
}),
};
result[@intFromEnum(Feature.avr25)] = .{
.llvm_name = "avr25",
.description = "The device is a part of the avr25 family",
.dependencies = featureSet(&[_]Feature{
.avr2,
.@"break",
.lpmx,
.movw,
.spm,
}),
};
result[@intFromEnum(Feature.avr3)] = .{
.llvm_name = "avr3",
.description = "The device is a part of the avr3 family",
.dependencies = featureSet(&[_]Feature{
.avr2,
.jmpcall,
}),
};
result[@intFromEnum(Feature.avr31)] = .{
.llvm_name = "avr31",
.description = "The device is a part of the avr31 family",
.dependencies = featureSet(&[_]Feature{
.avr3,
.elpm,
}),
};
result[@intFromEnum(Feature.avr35)] = .{
.llvm_name = "avr35",
.description = "The device is a part of the avr35 family",
.dependencies = featureSet(&[_]Feature{
.avr3,
.@"break",
.lpmx,
.movw,
.spm,
}),
};
result[@intFromEnum(Feature.avr4)] = .{
.llvm_name = "avr4",
.description = "The device is a part of the avr4 family",
.dependencies = featureSet(&[_]Feature{
.avr2,
.@"break",
.lpmx,
.movw,
.mul,
.spm,
}),
};
result[@intFromEnum(Feature.avr5)] = .{
.llvm_name = "avr5",
.description = "The device is a part of the avr5 family",
.dependencies = featureSet(&[_]Feature{
.avr3,
.@"break",
.lpmx,
.movw,
.mul,
.spm,
}),
};
result[@intFromEnum(Feature.avr51)] = .{
.llvm_name = "avr51",
.description = "The device is a part of the avr51 family",
.dependencies = featureSet(&[_]Feature{
.avr5,
.elpm,
.elpmx,
}),
};
result[@intFromEnum(Feature.avr6)] = .{
.llvm_name = "avr6",
.description = "The device is a part of the avr6 family",
.dependencies = featureSet(&[_]Feature{
.avr51,
}),
};
result[@intFromEnum(Feature.avrtiny)] = .{
.llvm_name = "avrtiny",
.description = "The device is a part of the avrtiny family",
.dependencies = featureSet(&[_]Feature{
.avr0,
.@"break",
.sram,
.tinyencoding,
}),
};
result[@intFromEnum(Feature.@"break")] = .{
.llvm_name = "break",
.description = "The device supports the `BREAK` debugging instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.des)] = .{
.llvm_name = "des",
.description = "The device supports the `DES k` encryption instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.eijmpcall)] = .{
.llvm_name = "eijmpcall",
.description = "The device supports the `EIJMP`/`EICALL` instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.elpm)] = .{
.llvm_name = "elpm",
.description = "The device supports the ELPM instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.elpmx)] = .{
.llvm_name = "elpmx",
.description = "The device supports the `ELPM Rd, Z[+]` instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ijmpcall)] = .{
.llvm_name = "ijmpcall",
.description = "The device supports `IJMP`/`ICALL`instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.jmpcall)] = .{
.llvm_name = "jmpcall",
.description = "The device supports the `JMP` and `CALL` instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lpm)] = .{
.llvm_name = "lpm",
.description = "The device supports the `LPM` instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lpmx)] = .{
.llvm_name = "lpmx",
.description = "The device supports the `LPM Rd, Z[+]` instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.memmappedregs)] = .{
.llvm_name = "memmappedregs",
.description = "The device has CPU registers mapped in data address space",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.movw)] = .{
.llvm_name = "movw",
.description = "The device supports the 16-bit MOVW instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mul)] = .{
.llvm_name = "mul",
.description = "The device supports the multiplication instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rmw)] = .{
.llvm_name = "rmw",
.description = "The device supports the read-write-modify instructions: XCH, LAS, LAC, LAT",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.smallstack)] = .{
.llvm_name = "smallstack",
.description = "The device has an 8-bit stack pointer",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.special)] = .{
.llvm_name = "special",
.description = "Enable use of the entire instruction set - used for debugging",
.dependencies = featureSet(&[_]Feature{
.addsubiw,
.@"break",
.des,
.eijmpcall,
.elpm,
.elpmx,
.ijmpcall,
.jmpcall,
.lpm,
.lpmx,
.memmappedregs,
.movw,
.mul,
.rmw,
.spm,
.spmx,
.sram,
}),
};
result[@intFromEnum(Feature.spm)] = .{
.llvm_name = "spm",
.description = "The device supports the `SPM` instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.spmx)] = .{
.llvm_name = "spmx",
.description = "The device supports the `SPM Z+` instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sram)] = .{
.llvm_name = "sram",
.description = "The device has random access memory",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tinyencoding)] = .{
.llvm_name = "tinyencoding",
.description = "The device has Tiny core specific instruction encodings",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xmega)] = .{
.llvm_name = "xmega",
.description = "The device is a part of the xmega family",
.dependencies = featureSet(&[_]Feature{
.addsubiw,
.avr0,
.@"break",
.des,
.eijmpcall,
.elpm,
.elpmx,
.ijmpcall,
.jmpcall,
.lpm,
.lpmx,
.movw,
.mul,
.spm,
.spmx,
.sram,
}),
};
result[@intFromEnum(Feature.xmegau)] = .{
.llvm_name = "xmegau",
.description = "The device is a part of the xmegau family",
.dependencies = featureSet(&[_]Feature{
.rmw,
.xmega,
}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const at43usb320 = CpuModel{
.name = "at43usb320",
.llvm_name = "at43usb320",
.features = featureSet(&[_]Feature{
.avr31,
}),
};
pub const at43usb355 = CpuModel{
.name = "at43usb355",
.llvm_name = "at43usb355",
.features = featureSet(&[_]Feature{
.avr3,
}),
};
pub const at76c711 = CpuModel{
.name = "at76c711",
.llvm_name = "at76c711",
.features = featureSet(&[_]Feature{
.avr3,
}),
};
pub const at86rf401 = CpuModel{
.name = "at86rf401",
.llvm_name = "at86rf401",
.features = featureSet(&[_]Feature{
.avr2,
.lpmx,
.movw,
}),
};
pub const at90c8534 = CpuModel{
.name = "at90c8534",
.llvm_name = "at90c8534",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90can128 = CpuModel{
.name = "at90can128",
.llvm_name = "at90can128",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const at90can32 = CpuModel{
.name = "at90can32",
.llvm_name = "at90can32",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90can64 = CpuModel{
.name = "at90can64",
.llvm_name = "at90can64",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90pwm1 = CpuModel{
.name = "at90pwm1",
.llvm_name = "at90pwm1",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const at90pwm161 = CpuModel{
.name = "at90pwm161",
.llvm_name = "at90pwm161",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90pwm2 = CpuModel{
.name = "at90pwm2",
.llvm_name = "at90pwm2",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const at90pwm216 = CpuModel{
.name = "at90pwm216",
.llvm_name = "at90pwm216",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90pwm2b = CpuModel{
.name = "at90pwm2b",
.llvm_name = "at90pwm2b",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const at90pwm3 = CpuModel{
.name = "at90pwm3",
.llvm_name = "at90pwm3",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const at90pwm316 = CpuModel{
.name = "at90pwm316",
.llvm_name = "at90pwm316",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90pwm3b = CpuModel{
.name = "at90pwm3b",
.llvm_name = "at90pwm3b",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const at90pwm81 = CpuModel{
.name = "at90pwm81",
.llvm_name = "at90pwm81",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const at90s1200 = CpuModel{
.name = "at90s1200",
.llvm_name = "at90s1200",
.features = featureSet(&[_]Feature{
.avr0,
}),
};
pub const at90s2313 = CpuModel{
.name = "at90s2313",
.llvm_name = "at90s2313",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s2323 = CpuModel{
.name = "at90s2323",
.llvm_name = "at90s2323",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s2333 = CpuModel{
.name = "at90s2333",
.llvm_name = "at90s2333",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s2343 = CpuModel{
.name = "at90s2343",
.llvm_name = "at90s2343",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s4414 = CpuModel{
.name = "at90s4414",
.llvm_name = "at90s4414",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s4433 = CpuModel{
.name = "at90s4433",
.llvm_name = "at90s4433",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s4434 = CpuModel{
.name = "at90s4434",
.llvm_name = "at90s4434",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s8515 = CpuModel{
.name = "at90s8515",
.llvm_name = "at90s8515",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90s8535 = CpuModel{
.name = "at90s8535",
.llvm_name = "at90s8535",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const at90scr100 = CpuModel{
.name = "at90scr100",
.llvm_name = "at90scr100",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90usb1286 = CpuModel{
.name = "at90usb1286",
.llvm_name = "at90usb1286",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const at90usb1287 = CpuModel{
.name = "at90usb1287",
.llvm_name = "at90usb1287",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const at90usb162 = CpuModel{
.name = "at90usb162",
.llvm_name = "at90usb162",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const at90usb646 = CpuModel{
.name = "at90usb646",
.llvm_name = "at90usb646",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90usb647 = CpuModel{
.name = "at90usb647",
.llvm_name = "at90usb647",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const at90usb82 = CpuModel{
.name = "at90usb82",
.llvm_name = "at90usb82",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const at94k = CpuModel{
.name = "at94k",
.llvm_name = "at94k",
.features = featureSet(&[_]Feature{
.avr3,
.lpmx,
.movw,
.mul,
}),
};
pub const ata5272 = CpuModel{
.name = "ata5272",
.llvm_name = "ata5272",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const ata5505 = CpuModel{
.name = "ata5505",
.llvm_name = "ata5505",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const ata5790 = CpuModel{
.name = "ata5790",
.llvm_name = "ata5790",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const ata5795 = CpuModel{
.name = "ata5795",
.llvm_name = "ata5795",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const ata6285 = CpuModel{
.name = "ata6285",
.llvm_name = "ata6285",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const ata6286 = CpuModel{
.name = "ata6286",
.llvm_name = "ata6286",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const ata6289 = CpuModel{
.name = "ata6289",
.llvm_name = "ata6289",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega103 = CpuModel{
.name = "atmega103",
.llvm_name = "atmega103",
.features = featureSet(&[_]Feature{
.avr31,
}),
};
pub const atmega128 = CpuModel{
.name = "atmega128",
.llvm_name = "atmega128",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega1280 = CpuModel{
.name = "atmega1280",
.llvm_name = "atmega1280",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega1281 = CpuModel{
.name = "atmega1281",
.llvm_name = "atmega1281",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega1284 = CpuModel{
.name = "atmega1284",
.llvm_name = "atmega1284",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega1284p = CpuModel{
.name = "atmega1284p",
.llvm_name = "atmega1284p",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega1284rfr2 = CpuModel{
.name = "atmega1284rfr2",
.llvm_name = "atmega1284rfr2",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega128a = CpuModel{
.name = "atmega128a",
.llvm_name = "atmega128a",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega128rfa1 = CpuModel{
.name = "atmega128rfa1",
.llvm_name = "atmega128rfa1",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega128rfr2 = CpuModel{
.name = "atmega128rfr2",
.llvm_name = "atmega128rfr2",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const atmega16 = CpuModel{
.name = "atmega16",
.llvm_name = "atmega16",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega161 = CpuModel{
.name = "atmega161",
.llvm_name = "atmega161",
.features = featureSet(&[_]Feature{
.avr3,
.lpmx,
.movw,
.mul,
.spm,
}),
};
pub const atmega162 = CpuModel{
.name = "atmega162",
.llvm_name = "atmega162",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega163 = CpuModel{
.name = "atmega163",
.llvm_name = "atmega163",
.features = featureSet(&[_]Feature{
.avr3,
.lpmx,
.movw,
.mul,
.spm,
}),
};
pub const atmega164a = CpuModel{
.name = "atmega164a",
.llvm_name = "atmega164a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega164p = CpuModel{
.name = "atmega164p",
.llvm_name = "atmega164p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega164pa = CpuModel{
.name = "atmega164pa",
.llvm_name = "atmega164pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega165 = CpuModel{
.name = "atmega165",
.llvm_name = "atmega165",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega165a = CpuModel{
.name = "atmega165a",
.llvm_name = "atmega165a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega165p = CpuModel{
.name = "atmega165p",
.llvm_name = "atmega165p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega165pa = CpuModel{
.name = "atmega165pa",
.llvm_name = "atmega165pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega168 = CpuModel{
.name = "atmega168",
.llvm_name = "atmega168",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega168a = CpuModel{
.name = "atmega168a",
.llvm_name = "atmega168a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega168p = CpuModel{
.name = "atmega168p",
.llvm_name = "atmega168p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega168pa = CpuModel{
.name = "atmega168pa",
.llvm_name = "atmega168pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega168pb = CpuModel{
.name = "atmega168pb",
.llvm_name = "atmega168pb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega169 = CpuModel{
.name = "atmega169",
.llvm_name = "atmega169",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega169a = CpuModel{
.name = "atmega169a",
.llvm_name = "atmega169a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega169p = CpuModel{
.name = "atmega169p",
.llvm_name = "atmega169p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega169pa = CpuModel{
.name = "atmega169pa",
.llvm_name = "atmega169pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16a = CpuModel{
.name = "atmega16a",
.llvm_name = "atmega16a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16hva = CpuModel{
.name = "atmega16hva",
.llvm_name = "atmega16hva",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16hva2 = CpuModel{
.name = "atmega16hva2",
.llvm_name = "atmega16hva2",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16hvb = CpuModel{
.name = "atmega16hvb",
.llvm_name = "atmega16hvb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16hvbrevb = CpuModel{
.name = "atmega16hvbrevb",
.llvm_name = "atmega16hvbrevb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16m1 = CpuModel{
.name = "atmega16m1",
.llvm_name = "atmega16m1",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega16u2 = CpuModel{
.name = "atmega16u2",
.llvm_name = "atmega16u2",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const atmega16u4 = CpuModel{
.name = "atmega16u4",
.llvm_name = "atmega16u4",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega2560 = CpuModel{
.name = "atmega2560",
.llvm_name = "atmega2560",
.features = featureSet(&[_]Feature{
.avr6,
}),
};
pub const atmega2561 = CpuModel{
.name = "atmega2561",
.llvm_name = "atmega2561",
.features = featureSet(&[_]Feature{
.avr6,
}),
};
pub const atmega2564rfr2 = CpuModel{
.name = "atmega2564rfr2",
.llvm_name = "atmega2564rfr2",
.features = featureSet(&[_]Feature{
.avr6,
}),
};
pub const atmega256rfr2 = CpuModel{
.name = "atmega256rfr2",
.llvm_name = "atmega256rfr2",
.features = featureSet(&[_]Feature{
.avr6,
}),
};
pub const atmega32 = CpuModel{
.name = "atmega32",
.llvm_name = "atmega32",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega323 = CpuModel{
.name = "atmega323",
.llvm_name = "atmega323",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega324a = CpuModel{
.name = "atmega324a",
.llvm_name = "atmega324a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega324p = CpuModel{
.name = "atmega324p",
.llvm_name = "atmega324p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega324pa = CpuModel{
.name = "atmega324pa",
.llvm_name = "atmega324pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega324pb = CpuModel{
.name = "atmega324pb",
.llvm_name = "atmega324pb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega325 = CpuModel{
.name = "atmega325",
.llvm_name = "atmega325",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3250 = CpuModel{
.name = "atmega3250",
.llvm_name = "atmega3250",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3250a = CpuModel{
.name = "atmega3250a",
.llvm_name = "atmega3250a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3250p = CpuModel{
.name = "atmega3250p",
.llvm_name = "atmega3250p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3250pa = CpuModel{
.name = "atmega3250pa",
.llvm_name = "atmega3250pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega325a = CpuModel{
.name = "atmega325a",
.llvm_name = "atmega325a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega325p = CpuModel{
.name = "atmega325p",
.llvm_name = "atmega325p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega325pa = CpuModel{
.name = "atmega325pa",
.llvm_name = "atmega325pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega328 = CpuModel{
.name = "atmega328",
.llvm_name = "atmega328",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega328p = CpuModel{
.name = "atmega328p",
.llvm_name = "atmega328p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega328pb = CpuModel{
.name = "atmega328pb",
.llvm_name = "atmega328pb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega329 = CpuModel{
.name = "atmega329",
.llvm_name = "atmega329",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3290 = CpuModel{
.name = "atmega3290",
.llvm_name = "atmega3290",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3290a = CpuModel{
.name = "atmega3290a",
.llvm_name = "atmega3290a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3290p = CpuModel{
.name = "atmega3290p",
.llvm_name = "atmega3290p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega3290pa = CpuModel{
.name = "atmega3290pa",
.llvm_name = "atmega3290pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega329a = CpuModel{
.name = "atmega329a",
.llvm_name = "atmega329a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega329p = CpuModel{
.name = "atmega329p",
.llvm_name = "atmega329p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega329pa = CpuModel{
.name = "atmega329pa",
.llvm_name = "atmega329pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32a = CpuModel{
.name = "atmega32a",
.llvm_name = "atmega32a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32c1 = CpuModel{
.name = "atmega32c1",
.llvm_name = "atmega32c1",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32hvb = CpuModel{
.name = "atmega32hvb",
.llvm_name = "atmega32hvb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32hvbrevb = CpuModel{
.name = "atmega32hvbrevb",
.llvm_name = "atmega32hvbrevb",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32m1 = CpuModel{
.name = "atmega32m1",
.llvm_name = "atmega32m1",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32u2 = CpuModel{
.name = "atmega32u2",
.llvm_name = "atmega32u2",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const atmega32u4 = CpuModel{
.name = "atmega32u4",
.llvm_name = "atmega32u4",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega32u6 = CpuModel{
.name = "atmega32u6",
.llvm_name = "atmega32u6",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega406 = CpuModel{
.name = "atmega406",
.llvm_name = "atmega406",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega48 = CpuModel{
.name = "atmega48",
.llvm_name = "atmega48",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega48a = CpuModel{
.name = "atmega48a",
.llvm_name = "atmega48a",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega48p = CpuModel{
.name = "atmega48p",
.llvm_name = "atmega48p",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega48pa = CpuModel{
.name = "atmega48pa",
.llvm_name = "atmega48pa",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega48pb = CpuModel{
.name = "atmega48pb",
.llvm_name = "atmega48pb",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega64 = CpuModel{
.name = "atmega64",
.llvm_name = "atmega64",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega640 = CpuModel{
.name = "atmega640",
.llvm_name = "atmega640",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega644 = CpuModel{
.name = "atmega644",
.llvm_name = "atmega644",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega644a = CpuModel{
.name = "atmega644a",
.llvm_name = "atmega644a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega644p = CpuModel{
.name = "atmega644p",
.llvm_name = "atmega644p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega644pa = CpuModel{
.name = "atmega644pa",
.llvm_name = "atmega644pa",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega644rfr2 = CpuModel{
.name = "atmega644rfr2",
.llvm_name = "atmega644rfr2",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega645 = CpuModel{
.name = "atmega645",
.llvm_name = "atmega645",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega6450 = CpuModel{
.name = "atmega6450",
.llvm_name = "atmega6450",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega6450a = CpuModel{
.name = "atmega6450a",
.llvm_name = "atmega6450a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega6450p = CpuModel{
.name = "atmega6450p",
.llvm_name = "atmega6450p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega645a = CpuModel{
.name = "atmega645a",
.llvm_name = "atmega645a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega645p = CpuModel{
.name = "atmega645p",
.llvm_name = "atmega645p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega649 = CpuModel{
.name = "atmega649",
.llvm_name = "atmega649",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega6490 = CpuModel{
.name = "atmega6490",
.llvm_name = "atmega6490",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega6490a = CpuModel{
.name = "atmega6490a",
.llvm_name = "atmega6490a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega6490p = CpuModel{
.name = "atmega6490p",
.llvm_name = "atmega6490p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega649a = CpuModel{
.name = "atmega649a",
.llvm_name = "atmega649a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega649p = CpuModel{
.name = "atmega649p",
.llvm_name = "atmega649p",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega64a = CpuModel{
.name = "atmega64a",
.llvm_name = "atmega64a",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega64c1 = CpuModel{
.name = "atmega64c1",
.llvm_name = "atmega64c1",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega64hve = CpuModel{
.name = "atmega64hve",
.llvm_name = "atmega64hve",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega64m1 = CpuModel{
.name = "atmega64m1",
.llvm_name = "atmega64m1",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega64rfr2 = CpuModel{
.name = "atmega64rfr2",
.llvm_name = "atmega64rfr2",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const atmega8 = CpuModel{
.name = "atmega8",
.llvm_name = "atmega8",
.features = featureSet(&[_]Feature{
.avr2,
.lpmx,
.movw,
.mul,
.spm,
}),
};
pub const atmega8515 = CpuModel{
.name = "atmega8515",
.llvm_name = "atmega8515",
.features = featureSet(&[_]Feature{
.avr2,
.lpmx,
.movw,
.mul,
.spm,
}),
};
pub const atmega8535 = CpuModel{
.name = "atmega8535",
.llvm_name = "atmega8535",
.features = featureSet(&[_]Feature{
.avr2,
.lpmx,
.movw,
.mul,
.spm,
}),
};
pub const atmega88 = CpuModel{
.name = "atmega88",
.llvm_name = "atmega88",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega88a = CpuModel{
.name = "atmega88a",
.llvm_name = "atmega88a",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega88p = CpuModel{
.name = "atmega88p",
.llvm_name = "atmega88p",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega88pa = CpuModel{
.name = "atmega88pa",
.llvm_name = "atmega88pa",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega88pb = CpuModel{
.name = "atmega88pb",
.llvm_name = "atmega88pb",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega8a = CpuModel{
.name = "atmega8a",
.llvm_name = "atmega8a",
.features = featureSet(&[_]Feature{
.avr2,
.lpmx,
.movw,
.mul,
.spm,
}),
};
pub const atmega8hva = CpuModel{
.name = "atmega8hva",
.llvm_name = "atmega8hva",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const atmega8u2 = CpuModel{
.name = "atmega8u2",
.llvm_name = "atmega8u2",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const attiny10 = CpuModel{
.name = "attiny10",
.llvm_name = "attiny10",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny102 = CpuModel{
.name = "attiny102",
.llvm_name = "attiny102",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny104 = CpuModel{
.name = "attiny104",
.llvm_name = "attiny104",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny11 = CpuModel{
.name = "attiny11",
.llvm_name = "attiny11",
.features = featureSet(&[_]Feature{
.avr1,
}),
};
pub const attiny12 = CpuModel{
.name = "attiny12",
.llvm_name = "attiny12",
.features = featureSet(&[_]Feature{
.avr1,
}),
};
pub const attiny13 = CpuModel{
.name = "attiny13",
.llvm_name = "attiny13",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny13a = CpuModel{
.name = "attiny13a",
.llvm_name = "attiny13a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny15 = CpuModel{
.name = "attiny15",
.llvm_name = "attiny15",
.features = featureSet(&[_]Feature{
.avr1,
}),
};
pub const attiny1634 = CpuModel{
.name = "attiny1634",
.llvm_name = "attiny1634",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const attiny167 = CpuModel{
.name = "attiny167",
.llvm_name = "attiny167",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const attiny20 = CpuModel{
.name = "attiny20",
.llvm_name = "attiny20",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny22 = CpuModel{
.name = "attiny22",
.llvm_name = "attiny22",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const attiny2313 = CpuModel{
.name = "attiny2313",
.llvm_name = "attiny2313",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny2313a = CpuModel{
.name = "attiny2313a",
.llvm_name = "attiny2313a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny24 = CpuModel{
.name = "attiny24",
.llvm_name = "attiny24",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny24a = CpuModel{
.name = "attiny24a",
.llvm_name = "attiny24a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny25 = CpuModel{
.name = "attiny25",
.llvm_name = "attiny25",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny26 = CpuModel{
.name = "attiny26",
.llvm_name = "attiny26",
.features = featureSet(&[_]Feature{
.avr2,
.lpmx,
}),
};
pub const attiny261 = CpuModel{
.name = "attiny261",
.llvm_name = "attiny261",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny261a = CpuModel{
.name = "attiny261a",
.llvm_name = "attiny261a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny28 = CpuModel{
.name = "attiny28",
.llvm_name = "attiny28",
.features = featureSet(&[_]Feature{
.avr1,
}),
};
pub const attiny4 = CpuModel{
.name = "attiny4",
.llvm_name = "attiny4",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny40 = CpuModel{
.name = "attiny40",
.llvm_name = "attiny40",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny4313 = CpuModel{
.name = "attiny4313",
.llvm_name = "attiny4313",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny43u = CpuModel{
.name = "attiny43u",
.llvm_name = "attiny43u",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny44 = CpuModel{
.name = "attiny44",
.llvm_name = "attiny44",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny441 = CpuModel{
.name = "attiny441",
.llvm_name = "attiny441",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny44a = CpuModel{
.name = "attiny44a",
.llvm_name = "attiny44a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny45 = CpuModel{
.name = "attiny45",
.llvm_name = "attiny45",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny461 = CpuModel{
.name = "attiny461",
.llvm_name = "attiny461",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny461a = CpuModel{
.name = "attiny461a",
.llvm_name = "attiny461a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny48 = CpuModel{
.name = "attiny48",
.llvm_name = "attiny48",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny5 = CpuModel{
.name = "attiny5",
.llvm_name = "attiny5",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const attiny828 = CpuModel{
.name = "attiny828",
.llvm_name = "attiny828",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny84 = CpuModel{
.name = "attiny84",
.llvm_name = "attiny84",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny841 = CpuModel{
.name = "attiny841",
.llvm_name = "attiny841",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny84a = CpuModel{
.name = "attiny84a",
.llvm_name = "attiny84a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny85 = CpuModel{
.name = "attiny85",
.llvm_name = "attiny85",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny861 = CpuModel{
.name = "attiny861",
.llvm_name = "attiny861",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny861a = CpuModel{
.name = "attiny861a",
.llvm_name = "attiny861a",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny87 = CpuModel{
.name = "attiny87",
.llvm_name = "attiny87",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny88 = CpuModel{
.name = "attiny88",
.llvm_name = "attiny88",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const attiny9 = CpuModel{
.name = "attiny9",
.llvm_name = "attiny9",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const atxmega128a1 = CpuModel{
.name = "atxmega128a1",
.llvm_name = "atxmega128a1",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega128a1u = CpuModel{
.name = "atxmega128a1u",
.llvm_name = "atxmega128a1u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega128a3 = CpuModel{
.name = "atxmega128a3",
.llvm_name = "atxmega128a3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega128a3u = CpuModel{
.name = "atxmega128a3u",
.llvm_name = "atxmega128a3u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega128a4u = CpuModel{
.name = "atxmega128a4u",
.llvm_name = "atxmega128a4u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega128b1 = CpuModel{
.name = "atxmega128b1",
.llvm_name = "atxmega128b1",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega128b3 = CpuModel{
.name = "atxmega128b3",
.llvm_name = "atxmega128b3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega128c3 = CpuModel{
.name = "atxmega128c3",
.llvm_name = "atxmega128c3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega128d3 = CpuModel{
.name = "atxmega128d3",
.llvm_name = "atxmega128d3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega128d4 = CpuModel{
.name = "atxmega128d4",
.llvm_name = "atxmega128d4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega16a4 = CpuModel{
.name = "atxmega16a4",
.llvm_name = "atxmega16a4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega16a4u = CpuModel{
.name = "atxmega16a4u",
.llvm_name = "atxmega16a4u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega16c4 = CpuModel{
.name = "atxmega16c4",
.llvm_name = "atxmega16c4",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega16d4 = CpuModel{
.name = "atxmega16d4",
.llvm_name = "atxmega16d4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega16e5 = CpuModel{
.name = "atxmega16e5",
.llvm_name = "atxmega16e5",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega192a3 = CpuModel{
.name = "atxmega192a3",
.llvm_name = "atxmega192a3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega192a3u = CpuModel{
.name = "atxmega192a3u",
.llvm_name = "atxmega192a3u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega192c3 = CpuModel{
.name = "atxmega192c3",
.llvm_name = "atxmega192c3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega192d3 = CpuModel{
.name = "atxmega192d3",
.llvm_name = "atxmega192d3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega256a3 = CpuModel{
.name = "atxmega256a3",
.llvm_name = "atxmega256a3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega256a3b = CpuModel{
.name = "atxmega256a3b",
.llvm_name = "atxmega256a3b",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega256a3bu = CpuModel{
.name = "atxmega256a3bu",
.llvm_name = "atxmega256a3bu",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega256a3u = CpuModel{
.name = "atxmega256a3u",
.llvm_name = "atxmega256a3u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega256c3 = CpuModel{
.name = "atxmega256c3",
.llvm_name = "atxmega256c3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega256d3 = CpuModel{
.name = "atxmega256d3",
.llvm_name = "atxmega256d3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega32a4 = CpuModel{
.name = "atxmega32a4",
.llvm_name = "atxmega32a4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega32a4u = CpuModel{
.name = "atxmega32a4u",
.llvm_name = "atxmega32a4u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega32c4 = CpuModel{
.name = "atxmega32c4",
.llvm_name = "atxmega32c4",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega32d4 = CpuModel{
.name = "atxmega32d4",
.llvm_name = "atxmega32d4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega32e5 = CpuModel{
.name = "atxmega32e5",
.llvm_name = "atxmega32e5",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega32x1 = CpuModel{
.name = "atxmega32x1",
.llvm_name = "atxmega32x1",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega384c3 = CpuModel{
.name = "atxmega384c3",
.llvm_name = "atxmega384c3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega384d3 = CpuModel{
.name = "atxmega384d3",
.llvm_name = "atxmega384d3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega64a1 = CpuModel{
.name = "atxmega64a1",
.llvm_name = "atxmega64a1",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega64a1u = CpuModel{
.name = "atxmega64a1u",
.llvm_name = "atxmega64a1u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega64a3 = CpuModel{
.name = "atxmega64a3",
.llvm_name = "atxmega64a3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega64a3u = CpuModel{
.name = "atxmega64a3u",
.llvm_name = "atxmega64a3u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega64a4u = CpuModel{
.name = "atxmega64a4u",
.llvm_name = "atxmega64a4u",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega64b1 = CpuModel{
.name = "atxmega64b1",
.llvm_name = "atxmega64b1",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega64b3 = CpuModel{
.name = "atxmega64b3",
.llvm_name = "atxmega64b3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega64c3 = CpuModel{
.name = "atxmega64c3",
.llvm_name = "atxmega64c3",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const atxmega64d3 = CpuModel{
.name = "atxmega64d3",
.llvm_name = "atxmega64d3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega64d4 = CpuModel{
.name = "atxmega64d4",
.llvm_name = "atxmega64d4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const atxmega8e5 = CpuModel{
.name = "atxmega8e5",
.llvm_name = "atxmega8e5",
.features = featureSet(&[_]Feature{
.xmegau,
}),
};
pub const avr1 = CpuModel{
.name = "avr1",
.llvm_name = "avr1",
.features = featureSet(&[_]Feature{
.avr1,
}),
};
pub const avr2 = CpuModel{
.name = "avr2",
.llvm_name = "avr2",
.features = featureSet(&[_]Feature{
.avr2,
}),
};
pub const avr25 = CpuModel{
.name = "avr25",
.llvm_name = "avr25",
.features = featureSet(&[_]Feature{
.avr25,
}),
};
pub const avr3 = CpuModel{
.name = "avr3",
.llvm_name = "avr3",
.features = featureSet(&[_]Feature{
.avr3,
}),
};
pub const avr31 = CpuModel{
.name = "avr31",
.llvm_name = "avr31",
.features = featureSet(&[_]Feature{
.avr31,
}),
};
pub const avr35 = CpuModel{
.name = "avr35",
.llvm_name = "avr35",
.features = featureSet(&[_]Feature{
.avr35,
}),
};
pub const avr4 = CpuModel{
.name = "avr4",
.llvm_name = "avr4",
.features = featureSet(&[_]Feature{
.avr4,
}),
};
pub const avr5 = CpuModel{
.name = "avr5",
.llvm_name = "avr5",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
pub const avr51 = CpuModel{
.name = "avr51",
.llvm_name = "avr51",
.features = featureSet(&[_]Feature{
.avr51,
}),
};
pub const avr6 = CpuModel{
.name = "avr6",
.llvm_name = "avr6",
.features = featureSet(&[_]Feature{
.avr6,
}),
};
pub const avrtiny = CpuModel{
.name = "avrtiny",
.llvm_name = "avrtiny",
.features = featureSet(&[_]Feature{
.avrtiny,
}),
};
pub const avrxmega1 = CpuModel{
.name = "avrxmega1",
.llvm_name = "avrxmega1",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const avrxmega2 = CpuModel{
.name = "avrxmega2",
.llvm_name = "avrxmega2",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const avrxmega3 = CpuModel{
.name = "avrxmega3",
.llvm_name = "avrxmega3",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const avrxmega4 = CpuModel{
.name = "avrxmega4",
.llvm_name = "avrxmega4",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const avrxmega5 = CpuModel{
.name = "avrxmega5",
.llvm_name = "avrxmega5",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const avrxmega6 = CpuModel{
.name = "avrxmega6",
.llvm_name = "avrxmega6",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const avrxmega7 = CpuModel{
.name = "avrxmega7",
.llvm_name = "avrxmega7",
.features = featureSet(&[_]Feature{
.xmega,
}),
};
pub const m3000 = CpuModel{
.name = "m3000",
.llvm_name = "m3000",
.features = featureSet(&[_]Feature{
.avr5,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/wasm.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
atomics,
bulk_memory,
exception_handling,
multivalue,
mutable_globals,
nontrapping_fptoint,
reference_types,
sign_ext,
simd128,
tail_call,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.atomics)] = .{
.llvm_name = "atomics",
.description = "Enable Atomics",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.bulk_memory)] = .{
.llvm_name = "bulk-memory",
.description = "Enable bulk memory operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.exception_handling)] = .{
.llvm_name = "exception-handling",
.description = "Enable Wasm exception handling",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.multivalue)] = .{
.llvm_name = "multivalue",
.description = "Enable multivalue blocks, instructions, and functions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mutable_globals)] = .{
.llvm_name = "mutable-globals",
.description = "Enable mutable globals",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nontrapping_fptoint)] = .{
.llvm_name = "nontrapping-fptoint",
.description = "Enable non-trapping float-to-int conversion operators",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reference_types)] = .{
.llvm_name = "reference-types",
.description = "Enable reference types",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sign_ext)] = .{
.llvm_name = "sign-ext",
.description = "Enable sign extension operators",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.simd128)] = .{
.llvm_name = "simd128",
.description = "Enable 128-bit SIMD",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tail_call)] = .{
.llvm_name = "tail-call",
.description = "Enable tail call instructions",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const bleeding_edge = CpuModel{
.name = "bleeding_edge",
.llvm_name = "bleeding-edge",
.features = featureSet(&[_]Feature{
.atomics,
.bulk_memory,
.mutable_globals,
.nontrapping_fptoint,
.sign_ext,
.simd128,
.tail_call,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
pub const mvp = CpuModel{
.name = "mvp",
.llvm_name = "mvp",
.features = featureSet(&[_]Feature{}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/bpf.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
alu32,
dummy,
dwarfris,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.alu32)] = .{
.llvm_name = "alu32",
.description = "Enable ALU32 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dummy)] = .{
.llvm_name = "dummy",
.description = "unused feature",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dwarfris)] = .{
.llvm_name = "dwarfris",
.description = "Disable MCAsmInfo DwarfUsesRelocationsAcrossSections",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
pub const probe = CpuModel{
.name = "probe",
.llvm_name = "probe",
.features = featureSet(&[_]Feature{}),
};
pub const v1 = CpuModel{
.name = "v1",
.llvm_name = "v1",
.features = featureSet(&[_]Feature{}),
};
pub const v2 = CpuModel{
.name = "v2",
.llvm_name = "v2",
.features = featureSet(&[_]Feature{}),
};
pub const v3 = CpuModel{
.name = "v3",
.llvm_name = "v3",
.features = featureSet(&[_]Feature{}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/hexagon.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
audio,
compound,
duplex,
hvx,
hvx_length128b,
hvx_length64b,
hvxv60,
hvxv62,
hvxv65,
hvxv66,
hvxv67,
hvxv68,
long_calls,
mem_noshuf,
memops,
noreturn_stack_elim,
nvj,
nvs,
packets,
prev65,
reserved_r19,
small_data,
tinycore,
unsafe_fp,
v5,
v55,
v60,
v62,
v65,
v66,
v67,
v68,
zreg,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.audio)] = .{
.llvm_name = "audio",
.description = "Hexagon Audio extension instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.compound)] = .{
.llvm_name = "compound",
.description = "Use compound instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.duplex)] = .{
.llvm_name = "duplex",
.description = "Enable generation of duplex instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hvx)] = .{
.llvm_name = "hvx",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hvx_length128b)] = .{
.llvm_name = "hvx-length128b",
.description = "Hexagon HVX 128B instructions",
.dependencies = featureSet(&[_]Feature{
.hvx,
}),
};
result[@intFromEnum(Feature.hvx_length64b)] = .{
.llvm_name = "hvx-length64b",
.description = "Hexagon HVX 64B instructions",
.dependencies = featureSet(&[_]Feature{
.hvx,
}),
};
result[@intFromEnum(Feature.hvxv60)] = .{
.llvm_name = "hvxv60",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{
.hvx,
}),
};
result[@intFromEnum(Feature.hvxv62)] = .{
.llvm_name = "hvxv62",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{
.hvxv60,
}),
};
result[@intFromEnum(Feature.hvxv65)] = .{
.llvm_name = "hvxv65",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{
.hvxv62,
}),
};
result[@intFromEnum(Feature.hvxv66)] = .{
.llvm_name = "hvxv66",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{
.hvxv65,
.zreg,
}),
};
result[@intFromEnum(Feature.hvxv67)] = .{
.llvm_name = "hvxv67",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{
.hvxv66,
}),
};
result[@intFromEnum(Feature.hvxv68)] = .{
.llvm_name = "hvxv68",
.description = "Hexagon HVX instructions",
.dependencies = featureSet(&[_]Feature{
.hvxv67,
}),
};
result[@intFromEnum(Feature.long_calls)] = .{
.llvm_name = "long-calls",
.description = "Use constant-extended calls",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mem_noshuf)] = .{
.llvm_name = "mem_noshuf",
.description = "Supports mem_noshuf feature",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.memops)] = .{
.llvm_name = "memops",
.description = "Use memop instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.noreturn_stack_elim)] = .{
.llvm_name = "noreturn-stack-elim",
.description = "Eliminate stack allocation in a noreturn function when possible",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nvj)] = .{
.llvm_name = "nvj",
.description = "Support for new-value jumps",
.dependencies = featureSet(&[_]Feature{
.packets,
}),
};
result[@intFromEnum(Feature.nvs)] = .{
.llvm_name = "nvs",
.description = "Support for new-value stores",
.dependencies = featureSet(&[_]Feature{
.packets,
}),
};
result[@intFromEnum(Feature.packets)] = .{
.llvm_name = "packets",
.description = "Support for instruction packets",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prev65)] = .{
.llvm_name = "prev65",
.description = "Support features deprecated in v65",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserved_r19)] = .{
.llvm_name = "reserved-r19",
.description = "Reserve register R19",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.small_data)] = .{
.llvm_name = "small-data",
.description = "Allow GP-relative addressing of global variables",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tinycore)] = .{
.llvm_name = "tinycore",
.description = "Hexagon Tiny Core",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unsafe_fp)] = .{
.llvm_name = "unsafe-fp",
.description = "Use unsafe FP math",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v5)] = .{
.llvm_name = "v5",
.description = "Enable Hexagon V5 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v55)] = .{
.llvm_name = "v55",
.description = "Enable Hexagon V55 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v60)] = .{
.llvm_name = "v60",
.description = "Enable Hexagon V60 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v62)] = .{
.llvm_name = "v62",
.description = "Enable Hexagon V62 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v65)] = .{
.llvm_name = "v65",
.description = "Enable Hexagon V65 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v66)] = .{
.llvm_name = "v66",
.description = "Enable Hexagon V66 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v67)] = .{
.llvm_name = "v67",
.description = "Enable Hexagon V67 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v68)] = .{
.llvm_name = "v68",
.description = "Enable Hexagon V68 architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.zreg)] = .{
.llvm_name = "zreg",
.description = "Hexagon ZReg extension instructions",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.memops,
.nvj,
.nvs,
.prev65,
.small_data,
.v5,
.v55,
.v60,
}),
};
pub const hexagonv5 = CpuModel{
.name = "hexagonv5",
.llvm_name = "hexagonv5",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.memops,
.nvj,
.nvs,
.prev65,
.small_data,
.v5,
}),
};
pub const hexagonv55 = CpuModel{
.name = "hexagonv55",
.llvm_name = "hexagonv55",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.memops,
.nvj,
.nvs,
.prev65,
.small_data,
.v5,
.v55,
}),
};
pub const hexagonv60 = CpuModel{
.name = "hexagonv60",
.llvm_name = "hexagonv60",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.memops,
.nvj,
.nvs,
.prev65,
.small_data,
.v5,
.v55,
.v60,
}),
};
pub const hexagonv62 = CpuModel{
.name = "hexagonv62",
.llvm_name = "hexagonv62",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.memops,
.nvj,
.nvs,
.prev65,
.small_data,
.v5,
.v55,
.v60,
.v62,
}),
};
pub const hexagonv65 = CpuModel{
.name = "hexagonv65",
.llvm_name = "hexagonv65",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.mem_noshuf,
.memops,
.nvj,
.nvs,
.small_data,
.v5,
.v55,
.v60,
.v62,
.v65,
}),
};
pub const hexagonv66 = CpuModel{
.name = "hexagonv66",
.llvm_name = "hexagonv66",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.mem_noshuf,
.memops,
.nvj,
.nvs,
.small_data,
.v5,
.v55,
.v60,
.v62,
.v65,
.v66,
}),
};
pub const hexagonv67 = CpuModel{
.name = "hexagonv67",
.llvm_name = "hexagonv67",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.mem_noshuf,
.memops,
.nvj,
.nvs,
.small_data,
.v5,
.v55,
.v60,
.v62,
.v65,
.v66,
.v67,
}),
};
pub const hexagonv67t = CpuModel{
.name = "hexagonv67t",
.llvm_name = "hexagonv67t",
.features = featureSet(&[_]Feature{
.audio,
.compound,
.mem_noshuf,
.memops,
.nvs,
.small_data,
.tinycore,
.v5,
.v55,
.v60,
.v62,
.v65,
.v66,
.v67,
}),
};
pub const hexagonv68 = CpuModel{
.name = "hexagonv68",
.llvm_name = "hexagonv68",
.features = featureSet(&[_]Feature{
.compound,
.duplex,
.mem_noshuf,
.memops,
.nvj,
.nvs,
.small_data,
.v5,
.v55,
.v60,
.v62,
.v65,
.v66,
.v67,
.v68,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/aarch64.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
a65,
a76,
aes,
aggressive_fma,
alternate_sextload_cvt_f32_pattern,
altnzcv,
am,
amvs,
apple_a12,
apple_a13,
apple_a7,
arith_bcc_fusion,
arith_cbz_fusion,
balance_fp_ops,
bf16,
brbe,
bti,
call_saved_x10,
call_saved_x11,
call_saved_x12,
call_saved_x13,
call_saved_x14,
call_saved_x15,
call_saved_x18,
call_saved_x8,
call_saved_x9,
ccdp,
ccidx,
ccpp,
cmp_bcc_fusion,
complxnum,
contextidr_el2,
cortex_a78c,
cortex_r82,
crc,
crypto,
custom_cheap_as_move,
disable_latency_sched_heuristic,
dit,
dotprod,
ecv,
ete,
exynos_cheap_as_move,
exynos_m4,
f32mm,
f64mm,
fgt,
flagm,
force_32bit_jump_tables,
fp16fml,
fp_armv8,
fptoint,
fullfp16,
fuse_address,
fuse_aes,
fuse_arith_logic,
fuse_crypto_eor,
fuse_csel,
fuse_literals,
harden_sls_blr,
harden_sls_nocomdat,
harden_sls_retbr,
hcx,
i8mm,
jsconv,
lor,
ls64,
lse,
lsl_fast,
mpam,
mte,
neon,
neoverse_e1,
neoverse_n1,
neoverse_n2,
neoverse_v1,
no_neg_immediates,
no_zcz_fp,
nv,
outline_atomics,
pan,
pan_rwv,
pauth,
perfmon,
pmu,
predictable_select_expensive,
predres,
rand,
ras,
rcpc,
rcpc_immo,
rdm,
reserve_x1,
reserve_x10,
reserve_x11,
reserve_x12,
reserve_x13,
reserve_x14,
reserve_x15,
reserve_x18,
reserve_x2,
reserve_x20,
reserve_x21,
reserve_x22,
reserve_x23,
reserve_x24,
reserve_x25,
reserve_x26,
reserve_x27,
reserve_x28,
reserve_x3,
reserve_x30,
reserve_x4,
reserve_x5,
reserve_x6,
reserve_x7,
reserve_x9,
rme,
sb,
sel2,
sha2,
sha3,
slow_misaligned_128store,
slow_paired_128,
slow_strqro_store,
sm4,
sme,
sme_f64,
sme_i64,
spe,
spe_eef,
specrestrict,
ssbs,
strict_align,
sve,
sve2,
sve2_aes,
sve2_bitperm,
sve2_sha3,
sve2_sm4,
tagged_globals,
tlb_rmi,
tme,
tpidr_el1,
tpidr_el2,
tpidr_el3,
tracev8_4,
trbe,
uaops,
use_experimental_zeroing_pseudos,
use_postra_scheduler,
use_reciprocal_square_root,
v8_1a,
v8_2a,
v8_3a,
v8_4a,
v8_5a,
v8_6a,
v8_7a,
v8a,
v8r,
vh,
wfxt,
xs,
zcm,
zcz,
zcz_fp_workaround,
zcz_gp,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(2000);
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.a65)] = .{
.llvm_name = "a65",
.description = "Cortex-A65 ARM processors",
.dependencies = featureSet(&[_]Feature{
.crypto,
.dotprod,
.fullfp16,
.fuse_address,
.fuse_aes,
.fuse_literals,
.rcpc,
.ssbs,
.v8_2a,
}),
};
result[@intFromEnum(Feature.a76)] = .{
.llvm_name = "a76",
.description = "Cortex-A76 ARM processors",
.dependencies = featureSet(&[_]Feature{
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.rcpc,
.ssbs,
.v8_2a,
}),
};
result[@intFromEnum(Feature.aes)] = .{
.llvm_name = "aes",
.description = "Enable AES support",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.aggressive_fma)] = .{
.llvm_name = "aggressive-fma",
.description = "Enable Aggressive FMA for floating-point.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.alternate_sextload_cvt_f32_pattern)] = .{
.llvm_name = "alternate-sextload-cvt-f32-pattern",
.description = "Use alternative pattern for sextload convert to f32",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.altnzcv)] = .{
.llvm_name = "altnzcv",
.description = "Enable alternative NZCV format for floating point comparisons",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.am)] = .{
.llvm_name = "am",
.description = "Enable v8.4-A Activity Monitors extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.amvs)] = .{
.llvm_name = "amvs",
.description = "Enable v8.6-A Activity Monitors Virtualization support",
.dependencies = featureSet(&[_]Feature{
.am,
}),
};
result[@intFromEnum(Feature.apple_a12)] = .{
.llvm_name = "apple-a12",
.description = "Apple A12",
.dependencies = featureSet(&[_]Feature{
.alternate_sextload_cvt_f32_pattern,
.arith_bcc_fusion,
.arith_cbz_fusion,
.crypto,
.disable_latency_sched_heuristic,
.fullfp16,
.fuse_aes,
.fuse_crypto_eor,
.perfmon,
.v8_3a,
.zcm,
.zcz,
}),
};
result[@intFromEnum(Feature.apple_a13)] = .{
.llvm_name = "apple-a13",
.description = "Apple A13",
.dependencies = featureSet(&[_]Feature{
.alternate_sextload_cvt_f32_pattern,
.arith_bcc_fusion,
.arith_cbz_fusion,
.crypto,
.disable_latency_sched_heuristic,
.fp16fml,
.fuse_aes,
.fuse_crypto_eor,
.perfmon,
.sha3,
.v8_4a,
.zcm,
.zcz,
}),
};
result[@intFromEnum(Feature.apple_a7)] = .{
.llvm_name = "apple-a7",
.description = "Apple A7 (the CPU formerly known as Cyclone)",
.dependencies = featureSet(&[_]Feature{
.alternate_sextload_cvt_f32_pattern,
.arith_bcc_fusion,
.arith_cbz_fusion,
.crypto,
.disable_latency_sched_heuristic,
.fuse_aes,
.fuse_crypto_eor,
.perfmon,
.zcm,
.zcz,
.zcz_fp_workaround,
}),
};
result[@intFromEnum(Feature.arith_bcc_fusion)] = .{
.llvm_name = "arith-bcc-fusion",
.description = "CPU fuses arithmetic+bcc operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.arith_cbz_fusion)] = .{
.llvm_name = "arith-cbz-fusion",
.description = "CPU fuses arithmetic + cbz/cbnz operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.balance_fp_ops)] = .{
.llvm_name = "balance-fp-ops",
.description = "balance mix of odd and even D-registers for fp multiply(-accumulate) ops",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.bf16)] = .{
.llvm_name = "bf16",
.description = "Enable BFloat16 Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.brbe)] = .{
.llvm_name = "brbe",
.description = "Enable Branch Record Buffer Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.bti)] = .{
.llvm_name = "bti",
.description = "Enable Branch Target Identification",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x10)] = .{
.llvm_name = "call-saved-x10",
.description = "Make X10 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x11)] = .{
.llvm_name = "call-saved-x11",
.description = "Make X11 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x12)] = .{
.llvm_name = "call-saved-x12",
.description = "Make X12 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x13)] = .{
.llvm_name = "call-saved-x13",
.description = "Make X13 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x14)] = .{
.llvm_name = "call-saved-x14",
.description = "Make X14 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x15)] = .{
.llvm_name = "call-saved-x15",
.description = "Make X15 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x18)] = .{
.llvm_name = "call-saved-x18",
.description = "Make X18 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x8)] = .{
.llvm_name = "call-saved-x8",
.description = "Make X8 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.call_saved_x9)] = .{
.llvm_name = "call-saved-x9",
.description = "Make X9 callee saved.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ccdp)] = .{
.llvm_name = "ccdp",
.description = "Enable v8.5 Cache Clean to Point of Deep Persistence",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ccidx)] = .{
.llvm_name = "ccidx",
.description = "Enable v8.3-A Extend of the CCSIDR number of sets",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ccpp)] = .{
.llvm_name = "ccpp",
.description = "Enable v8.2 data Cache Clean to Point of Persistence",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cmp_bcc_fusion)] = .{
.llvm_name = "cmp-bcc-fusion",
.description = "CPU fuses cmp+bcc operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.complxnum)] = .{
.llvm_name = "complxnum",
.description = "Enable v8.3-A Floating-point complex number support",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.contextidr_el2)] = .{
.llvm_name = "CONTEXTIDREL2",
.description = "Enable RW operand Context ID Register (EL2)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cortex_a78c)] = .{
.llvm_name = "cortex-a78c",
.description = "Cortex-A78C ARM processors",
.dependencies = featureSet(&[_]Feature{
.cmp_bcc_fusion,
.crypto,
.dotprod,
.flagm,
.fp16fml,
.fuse_aes,
.pauth,
.perfmon,
.rcpc,
.spe,
.ssbs,
.use_postra_scheduler,
.v8_2a,
}),
};
result[@intFromEnum(Feature.cortex_r82)] = .{
.llvm_name = "cortex-r82",
.description = "Cortex-R82 ARM Processors",
.dependencies = featureSet(&[_]Feature{
.use_postra_scheduler,
.v8r,
}),
};
result[@intFromEnum(Feature.crc)] = .{
.llvm_name = "crc",
.description = "Enable ARMv8 CRC-32 checksum instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.crypto)] = .{
.llvm_name = "crypto",
.description = "Enable cryptographic instructions",
.dependencies = featureSet(&[_]Feature{
.aes,
.sha2,
}),
};
result[@intFromEnum(Feature.custom_cheap_as_move)] = .{
.llvm_name = "custom-cheap-as-move",
.description = "Use custom handling of cheap instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.disable_latency_sched_heuristic)] = .{
.llvm_name = "disable-latency-sched-heuristic",
.description = "Disable latency scheduling heuristic",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dit)] = .{
.llvm_name = "dit",
.description = "Enable v8.4-A Data Independent Timing instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dotprod)] = .{
.llvm_name = "dotprod",
.description = "Enable dot product support",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ecv)] = .{
.llvm_name = "ecv",
.description = "Enable enhanced counter virtualization extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ete)] = .{
.llvm_name = "ete",
.description = "Enable Embedded Trace Extension",
.dependencies = featureSet(&[_]Feature{
.trbe,
}),
};
result[@intFromEnum(Feature.exynos_cheap_as_move)] = .{
.llvm_name = "exynos-cheap-as-move",
.description = "Use Exynos specific handling of cheap instructions",
.dependencies = featureSet(&[_]Feature{
.custom_cheap_as_move,
}),
};
result[@intFromEnum(Feature.exynos_m4)] = .{
.llvm_name = "exynosm4",
.description = "Samsung Exynos-M4 processors",
.dependencies = featureSet(&[_]Feature{
.arith_bcc_fusion,
.arith_cbz_fusion,
.crypto,
.dotprod,
.exynos_cheap_as_move,
.force_32bit_jump_tables,
.fullfp16,
.fuse_address,
.fuse_aes,
.fuse_arith_logic,
.fuse_csel,
.fuse_literals,
.lsl_fast,
.perfmon,
.use_postra_scheduler,
.v8_2a,
.zcz,
}),
};
result[@intFromEnum(Feature.f32mm)] = .{
.llvm_name = "f32mm",
.description = "Enable Matrix Multiply FP32 Extension",
.dependencies = featureSet(&[_]Feature{
.sve,
}),
};
result[@intFromEnum(Feature.f64mm)] = .{
.llvm_name = "f64mm",
.description = "Enable Matrix Multiply FP64 Extension",
.dependencies = featureSet(&[_]Feature{
.sve,
}),
};
result[@intFromEnum(Feature.fgt)] = .{
.llvm_name = "fgt",
.description = "Enable fine grained virtualization traps extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flagm)] = .{
.llvm_name = "flagm",
.description = "Enable v8.4-A Flag Manipulation Instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.force_32bit_jump_tables)] = .{
.llvm_name = "force-32bit-jump-tables",
.description = "Force jump table entries to be 32-bits wide except at MinSize",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fp16fml)] = .{
.llvm_name = "fp16fml",
.description = "Enable FP16 FML instructions",
.dependencies = featureSet(&[_]Feature{
.fullfp16,
}),
};
result[@intFromEnum(Feature.fp_armv8)] = .{
.llvm_name = "fp-armv8",
.description = "Enable ARMv8 FP",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fptoint)] = .{
.llvm_name = "fptoint",
.description = "Enable FRInt[32|64][Z|X] instructions that round a floating-point number to an integer (in FP format) forcing it to fit into a 32- or 64-bit int",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fullfp16)] = .{
.llvm_name = "fullfp16",
.description = "Full FP16",
.dependencies = featureSet(&[_]Feature{
.fp_armv8,
}),
};
result[@intFromEnum(Feature.fuse_address)] = .{
.llvm_name = "fuse-address",
.description = "CPU fuses address generation and memory operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fuse_aes)] = .{
.llvm_name = "fuse-aes",
.description = "CPU fuses AES crypto operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fuse_arith_logic)] = .{
.llvm_name = "fuse-arith-logic",
.description = "CPU fuses arithmetic and logic operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fuse_crypto_eor)] = .{
.llvm_name = "fuse-crypto-eor",
.description = "CPU fuses AES/PMULL and EOR operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fuse_csel)] = .{
.llvm_name = "fuse-csel",
.description = "CPU fuses conditional select operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fuse_literals)] = .{
.llvm_name = "fuse-literals",
.description = "CPU fuses literal generation operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.harden_sls_blr)] = .{
.llvm_name = "harden-sls-blr",
.description = "Harden against straight line speculation across BLR instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{
.llvm_name = "harden-sls-nocomdat",
.description = "Generate thunk code for SLS mitigation in the normal text section",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.harden_sls_retbr)] = .{
.llvm_name = "harden-sls-retbr",
.description = "Harden against straight line speculation across RET and BR instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hcx)] = .{
.llvm_name = "hcx",
.description = "Enable Armv8.7-A HCRX_EL2 system register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.i8mm)] = .{
.llvm_name = "i8mm",
.description = "Enable Matrix Multiply Int8 Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.jsconv)] = .{
.llvm_name = "jsconv",
.description = "Enable v8.3-A JavaScript FP conversion instructions",
.dependencies = featureSet(&[_]Feature{
.fp_armv8,
}),
};
result[@intFromEnum(Feature.lor)] = .{
.llvm_name = "lor",
.description = "Enables ARM v8.1 Limited Ordering Regions extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ls64)] = .{
.llvm_name = "ls64",
.description = "Enable Armv8.7-A LD64B/ST64B Accelerator Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lse)] = .{
.llvm_name = "lse",
.description = "Enable ARMv8.1 Large System Extension (LSE) atomic instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lsl_fast)] = .{
.llvm_name = "lsl-fast",
.description = "CPU has a fastpath logical shift of up to 3 places",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mpam)] = .{
.llvm_name = "mpam",
.description = "Enable v8.4-A Memory system Partitioning and Monitoring extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mte)] = .{
.llvm_name = "mte",
.description = "Enable Memory Tagging Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.neon)] = .{
.llvm_name = "neon",
.description = "Enable Advanced SIMD instructions",
.dependencies = featureSet(&[_]Feature{
.fp_armv8,
}),
};
result[@intFromEnum(Feature.neoverse_e1)] = .{
.llvm_name = "neoversee1",
.description = "Neoverse E1 ARM processors",
.dependencies = featureSet(&[_]Feature{
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.rcpc,
.ssbs,
.use_postra_scheduler,
.v8_2a,
}),
};
result[@intFromEnum(Feature.neoverse_n1)] = .{
.llvm_name = "neoversen1",
.description = "Neoverse N1 ARM processors",
.dependencies = featureSet(&[_]Feature{
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.rcpc,
.spe,
.ssbs,
.use_postra_scheduler,
.v8_2a,
}),
};
result[@intFromEnum(Feature.neoverse_n2)] = .{
.llvm_name = "neoversen2",
.description = "Neoverse N2 ARM processors",
.dependencies = featureSet(&[_]Feature{
.bf16,
.crypto,
.ete,
.fuse_aes,
.i8mm,
.mte,
.sve2_bitperm,
.use_postra_scheduler,
.v8_5a,
}),
};
result[@intFromEnum(Feature.neoverse_v1)] = .{
.llvm_name = "neoversev1",
.description = "Neoverse V1 ARM processors",
.dependencies = featureSet(&[_]Feature{
.bf16,
.ccdp,
.crypto,
.fp16fml,
.fuse_aes,
.i8mm,
.perfmon,
.rand,
.spe,
.ssbs,
.sve,
.use_postra_scheduler,
.v8_4a,
}),
};
result[@intFromEnum(Feature.no_neg_immediates)] = .{
.llvm_name = "no-neg-immediates",
.description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_zcz_fp)] = .{
.llvm_name = "no-zcz-fp",
.description = "Has no zero-cycle zeroing instructions for FP registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nv)] = .{
.llvm_name = "nv",
.description = "Enable v8.4-A Nested Virtualization Enchancement",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.outline_atomics)] = .{
.llvm_name = "outline-atomics",
.description = "Enable out of line atomics to support LSE instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pan)] = .{
.llvm_name = "pan",
.description = "Enables ARM v8.1 Privileged Access-Never extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pan_rwv)] = .{
.llvm_name = "pan-rwv",
.description = "Enable v8.2 PAN s1e1R and s1e1W Variants",
.dependencies = featureSet(&[_]Feature{
.pan,
}),
};
result[@intFromEnum(Feature.pauth)] = .{
.llvm_name = "pauth",
.description = "Enable v8.3-A Pointer Authentication extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.perfmon)] = .{
.llvm_name = "perfmon",
.description = "Enable ARMv8 PMUv3 Performance Monitors extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pmu)] = .{
.llvm_name = "pmu",
.description = "Enable v8.4-A PMU extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.predictable_select_expensive)] = .{
.llvm_name = "predictable-select-expensive",
.description = "Prefer likely predicted branches over selects",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.predres)] = .{
.llvm_name = "predres",
.description = "Enable v8.5a execution and data prediction invalidation instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rand)] = .{
.llvm_name = "rand",
.description = "Enable Random Number generation instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ras)] = .{
.llvm_name = "ras",
.description = "Enable ARMv8 Reliability, Availability and Serviceability Extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rcpc)] = .{
.llvm_name = "rcpc",
.description = "Enable support for RCPC extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rcpc_immo)] = .{
.llvm_name = "rcpc-immo",
.description = "Enable v8.4-A RCPC instructions with Immediate Offsets",
.dependencies = featureSet(&[_]Feature{
.rcpc,
}),
};
result[@intFromEnum(Feature.rdm)] = .{
.llvm_name = "rdm",
.description = "Enable ARMv8.1 Rounding Double Multiply Add/Subtract instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x1)] = .{
.llvm_name = "reserve-x1",
.description = "Reserve X1, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x10)] = .{
.llvm_name = "reserve-x10",
.description = "Reserve X10, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x11)] = .{
.llvm_name = "reserve-x11",
.description = "Reserve X11, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x12)] = .{
.llvm_name = "reserve-x12",
.description = "Reserve X12, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x13)] = .{
.llvm_name = "reserve-x13",
.description = "Reserve X13, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x14)] = .{
.llvm_name = "reserve-x14",
.description = "Reserve X14, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x15)] = .{
.llvm_name = "reserve-x15",
.description = "Reserve X15, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x18)] = .{
.llvm_name = "reserve-x18",
.description = "Reserve X18, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x2)] = .{
.llvm_name = "reserve-x2",
.description = "Reserve X2, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x20)] = .{
.llvm_name = "reserve-x20",
.description = "Reserve X20, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x21)] = .{
.llvm_name = "reserve-x21",
.description = "Reserve X21, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x22)] = .{
.llvm_name = "reserve-x22",
.description = "Reserve X22, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x23)] = .{
.llvm_name = "reserve-x23",
.description = "Reserve X23, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x24)] = .{
.llvm_name = "reserve-x24",
.description = "Reserve X24, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x25)] = .{
.llvm_name = "reserve-x25",
.description = "Reserve X25, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x26)] = .{
.llvm_name = "reserve-x26",
.description = "Reserve X26, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x27)] = .{
.llvm_name = "reserve-x27",
.description = "Reserve X27, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x28)] = .{
.llvm_name = "reserve-x28",
.description = "Reserve X28, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x3)] = .{
.llvm_name = "reserve-x3",
.description = "Reserve X3, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x30)] = .{
.llvm_name = "reserve-x30",
.description = "Reserve X30, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x4)] = .{
.llvm_name = "reserve-x4",
.description = "Reserve X4, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x5)] = .{
.llvm_name = "reserve-x5",
.description = "Reserve X5, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x6)] = .{
.llvm_name = "reserve-x6",
.description = "Reserve X6, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x7)] = .{
.llvm_name = "reserve-x7",
.description = "Reserve X7, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x9)] = .{
.llvm_name = "reserve-x9",
.description = "Reserve X9, making it unavailable as a GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rme)] = .{
.llvm_name = "rme",
.description = "Enable Realm Management Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sb)] = .{
.llvm_name = "sb",
.description = "Enable v8.5 Speculation Barrier",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sel2)] = .{
.llvm_name = "sel2",
.description = "Enable v8.4-A Secure Exception Level 2 extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sha2)] = .{
.llvm_name = "sha2",
.description = "Enable SHA1 and SHA256 support",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.sha3)] = .{
.llvm_name = "sha3",
.description = "Enable SHA512 and SHA3 support",
.dependencies = featureSet(&[_]Feature{
.sha2,
}),
};
result[@intFromEnum(Feature.slow_misaligned_128store)] = .{
.llvm_name = "slow-misaligned-128store",
.description = "Misaligned 128 bit stores are slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_paired_128)] = .{
.llvm_name = "slow-paired-128",
.description = "Paired 128 bit loads and stores are slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_strqro_store)] = .{
.llvm_name = "slow-strqro-store",
.description = "STR of Q register with register offset is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm4)] = .{
.llvm_name = "sm4",
.description = "Enable SM3 and SM4 support",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.sme)] = .{
.llvm_name = "sme",
.description = "Enable Scalable Matrix Extension (SME)",
.dependencies = featureSet(&[_]Feature{
.bf16,
.sve2,
}),
};
result[@intFromEnum(Feature.sme_f64)] = .{
.llvm_name = "sme-f64",
.description = "Enable Scalable Matrix Extension (SME) F64F64 instructions",
.dependencies = featureSet(&[_]Feature{
.sme,
}),
};
result[@intFromEnum(Feature.sme_i64)] = .{
.llvm_name = "sme-i64",
.description = "Enable Scalable Matrix Extension (SME) I16I64 instructions",
.dependencies = featureSet(&[_]Feature{
.sme,
}),
};
result[@intFromEnum(Feature.spe)] = .{
.llvm_name = "spe",
.description = "Enable Statistical Profiling extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.spe_eef)] = .{
.llvm_name = "spe-eef",
.description = "Enable extra register in the Statistical Profiling Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.specrestrict)] = .{
.llvm_name = "specrestrict",
.description = "Enable architectural speculation restriction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ssbs)] = .{
.llvm_name = "ssbs",
.description = "Enable Speculative Store Bypass Safe bit",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.strict_align)] = .{
.llvm_name = "strict-align",
.description = "Disallow all unaligned memory access",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sve)] = .{
.llvm_name = "sve",
.description = "Enable Scalable Vector Extension (SVE) instructions",
.dependencies = featureSet(&[_]Feature{
.fullfp16,
}),
};
result[@intFromEnum(Feature.sve2)] = .{
.llvm_name = "sve2",
.description = "Enable Scalable Vector Extension 2 (SVE2) instructions",
.dependencies = featureSet(&[_]Feature{
.sve,
}),
};
result[@intFromEnum(Feature.sve2_aes)] = .{
.llvm_name = "sve2-aes",
.description = "Enable AES SVE2 instructions",
.dependencies = featureSet(&[_]Feature{
.aes,
.sve2,
}),
};
result[@intFromEnum(Feature.sve2_bitperm)] = .{
.llvm_name = "sve2-bitperm",
.description = "Enable bit permutation SVE2 instructions",
.dependencies = featureSet(&[_]Feature{
.sve2,
}),
};
result[@intFromEnum(Feature.sve2_sha3)] = .{
.llvm_name = "sve2-sha3",
.description = "Enable SHA3 SVE2 instructions",
.dependencies = featureSet(&[_]Feature{
.sha3,
.sve2,
}),
};
result[@intFromEnum(Feature.sve2_sm4)] = .{
.llvm_name = "sve2-sm4",
.description = "Enable SM4 SVE2 instructions",
.dependencies = featureSet(&[_]Feature{
.sm4,
.sve2,
}),
};
result[@intFromEnum(Feature.tagged_globals)] = .{
.llvm_name = "tagged-globals",
.description = "Use an instruction sequence for taking the address of a global that allows a memory tag in the upper address bits",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tlb_rmi)] = .{
.llvm_name = "tlb-rmi",
.description = "Enable v8.4-A TLB Range and Maintenance Instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tme)] = .{
.llvm_name = "tme",
.description = "Enable Transactional Memory Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tpidr_el1)] = .{
.llvm_name = "tpidr-el1",
.description = "Permit use of TPIDR_EL1 for the TLS base",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tpidr_el2)] = .{
.llvm_name = "tpidr-el2",
.description = "Permit use of TPIDR_EL2 for the TLS base",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tpidr_el3)] = .{
.llvm_name = "tpidr-el3",
.description = "Permit use of TPIDR_EL3 for the TLS base",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tracev8_4)] = .{
.llvm_name = "tracev8.4",
.description = "Enable v8.4-A Trace extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.trbe)] = .{
.llvm_name = "trbe",
.description = "Enable Trace Buffer Extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.uaops)] = .{
.llvm_name = "uaops",
.description = "Enable v8.2 UAO PState",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_experimental_zeroing_pseudos)] = .{
.llvm_name = "use-experimental-zeroing-pseudos",
.description = "Hint to the compiler that the MOVPRFX instruction is merged with destructive operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_postra_scheduler)] = .{
.llvm_name = "use-postra-scheduler",
.description = "Schedule again after register allocation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_reciprocal_square_root)] = .{
.llvm_name = "use-reciprocal-square-root",
.description = "Use the reciprocal square root approximation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v8_1a)] = .{
.llvm_name = "v8.1a",
.description = "Support ARM v8.1a instructions",
.dependencies = featureSet(&[_]Feature{
.crc,
.lor,
.lse,
.pan,
.rdm,
.v8a,
.vh,
}),
};
result[@intFromEnum(Feature.v8_2a)] = .{
.llvm_name = "v8.2a",
.description = "Support ARM v8.2a instructions",
.dependencies = featureSet(&[_]Feature{
.ccpp,
.pan_rwv,
.ras,
.uaops,
.v8_1a,
}),
};
result[@intFromEnum(Feature.v8_3a)] = .{
.llvm_name = "v8.3a",
.description = "Support ARM v8.3a instructions",
.dependencies = featureSet(&[_]Feature{
.ccidx,
.complxnum,
.jsconv,
.pauth,
.rcpc,
.v8_2a,
}),
};
result[@intFromEnum(Feature.v8_4a)] = .{
.llvm_name = "v8.4a",
.description = "Support ARM v8.4a instructions",
.dependencies = featureSet(&[_]Feature{
.am,
.dit,
.dotprod,
.flagm,
.mpam,
.nv,
.pmu,
.rcpc_immo,
.sel2,
.tlb_rmi,
.tracev8_4,
.v8_3a,
}),
};
result[@intFromEnum(Feature.v8_5a)] = .{
.llvm_name = "v8.5a",
.description = "Support ARM v8.5a instructions",
.dependencies = featureSet(&[_]Feature{
.altnzcv,
.bti,
.ccdp,
.fptoint,
.predres,
.sb,
.specrestrict,
.ssbs,
.v8_4a,
}),
};
result[@intFromEnum(Feature.v8_6a)] = .{
.llvm_name = "v8.6a",
.description = "Support ARM v8.6a instructions",
.dependencies = featureSet(&[_]Feature{
.amvs,
.bf16,
.ecv,
.fgt,
.i8mm,
.v8_5a,
}),
};
result[@intFromEnum(Feature.v8_7a)] = .{
.llvm_name = "v8.7a",
.description = "Support ARM v8.7a instructions",
.dependencies = featureSet(&[_]Feature{
.hcx,
.v8_6a,
.wfxt,
.xs,
}),
};
result[@intFromEnum(Feature.v8a)] = .{
.llvm_name = null,
.description = "Support ARM v8a instructions",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.v8r)] = .{
.llvm_name = "v8r",
.description = "Support ARM v8r instructions",
.dependencies = featureSet(&[_]Feature{
.ccidx,
.ccpp,
.complxnum,
.contextidr_el2,
.crc,
.dit,
.dotprod,
.flagm,
.fp16fml,
.jsconv,
.lse,
.pan_rwv,
.pauth,
.perfmon,
.predres,
.ras,
.rcpc_immo,
.rdm,
.sb,
.sel2,
.sha3,
.sm4,
.specrestrict,
.ssbs,
.tlb_rmi,
.tracev8_4,
.uaops,
}),
};
result[@intFromEnum(Feature.vh)] = .{
.llvm_name = "vh",
.description = "Enables ARM v8.1 Virtual Host extension",
.dependencies = featureSet(&[_]Feature{
.contextidr_el2,
}),
};
result[@intFromEnum(Feature.wfxt)] = .{
.llvm_name = "wfxt",
.description = "Enable Armv8.7-A WFET and WFIT instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xs)] = .{
.llvm_name = "xs",
.description = "Enable Armv8.7-A limited-TLB-maintenance instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.zcm)] = .{
.llvm_name = "zcm",
.description = "Has zero-cycle register moves",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.zcz)] = .{
.llvm_name = "zcz",
.description = "Has zero-cycle zeroing instructions",
.dependencies = featureSet(&[_]Feature{
.zcz_gp,
}),
};
result[@intFromEnum(Feature.zcz_fp_workaround)] = .{
.llvm_name = "zcz-fp-workaround",
.description = "The zero-cycle floating-point zeroing instruction has a bug",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.zcz_gp)] = .{
.llvm_name = "zcz-gp",
.description = "Has zero-cycle zeroing instructions for generic registers",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const a64fx = CpuModel{
.name = "a64fx",
.llvm_name = "a64fx",
.features = featureSet(&[_]Feature{
.aggressive_fma,
.arith_bcc_fusion,
.complxnum,
.perfmon,
.predictable_select_expensive,
.sha2,
.sve,
.use_postra_scheduler,
.v8_2a,
}),
};
pub const apple_a10 = CpuModel{
.name = "apple_a10",
.llvm_name = "apple-a10",
.features = featureSet(&[_]Feature{
.alternate_sextload_cvt_f32_pattern,
.arith_bcc_fusion,
.arith_cbz_fusion,
.crc,
.crypto,
.disable_latency_sched_heuristic,
.fuse_aes,
.fuse_crypto_eor,
.lor,
.pan,
.perfmon,
.rdm,
.vh,
.zcm,
.zcz,
}),
};
pub const apple_a11 = CpuModel{
.name = "apple_a11",
.llvm_name = "apple-a11",
.features = featureSet(&[_]Feature{
.alternate_sextload_cvt_f32_pattern,
.arith_bcc_fusion,
.arith_cbz_fusion,
.crypto,
.disable_latency_sched_heuristic,
.fullfp16,
.fuse_aes,
.fuse_crypto_eor,
.perfmon,
.v8_2a,
.zcm,
.zcz,
}),
};
pub const apple_a12 = CpuModel{
.name = "apple_a12",
.llvm_name = "apple-a12",
.features = featureSet(&[_]Feature{
.apple_a12,
}),
};
pub const apple_a13 = CpuModel{
.name = "apple_a13",
.llvm_name = "apple-a13",
.features = featureSet(&[_]Feature{
.apple_a13,
}),
};
pub const apple_a14 = CpuModel{
.name = "apple_a14",
.llvm_name = "apple-a14",
.features = featureSet(&[_]Feature{
.aggressive_fma,
.alternate_sextload_cvt_f32_pattern,
.altnzcv,
.arith_bcc_fusion,
.arith_cbz_fusion,
.ccdp,
.crypto,
.disable_latency_sched_heuristic,
.fp16fml,
.fptoint,
.fuse_address,
.fuse_aes,
.fuse_arith_logic,
.fuse_crypto_eor,
.fuse_csel,
.fuse_literals,
.perfmon,
.predres,
.sb,
.sha3,
.specrestrict,
.ssbs,
.v8_4a,
.zcm,
.zcz,
}),
};
pub const apple_a7 = CpuModel{
.name = "apple_a7",
.llvm_name = "apple-a7",
.features = featureSet(&[_]Feature{
.apple_a7,
}),
};
pub const apple_a8 = CpuModel{
.name = "apple_a8",
.llvm_name = "apple-a8",
.features = featureSet(&[_]Feature{
.apple_a7,
}),
};
pub const apple_a9 = CpuModel{
.name = "apple_a9",
.llvm_name = "apple-a9",
.features = featureSet(&[_]Feature{
.apple_a7,
}),
};
pub const apple_latest = CpuModel{
.name = "apple_latest",
.llvm_name = "apple-latest",
.features = featureSet(&[_]Feature{
.aggressive_fma,
.alternate_sextload_cvt_f32_pattern,
.altnzcv,
.arith_bcc_fusion,
.arith_cbz_fusion,
.ccdp,
.crypto,
.disable_latency_sched_heuristic,
.fp16fml,
.fptoint,
.fuse_address,
.fuse_aes,
.fuse_arith_logic,
.fuse_crypto_eor,
.fuse_csel,
.fuse_literals,
.perfmon,
.predres,
.sb,
.sha3,
.specrestrict,
.ssbs,
.v8_4a,
.zcm,
.zcz,
}),
};
pub const apple_m1 = CpuModel{
.name = "apple_m1",
.llvm_name = "apple-m1",
.features = featureSet(&[_]Feature{
.aggressive_fma,
.alternate_sextload_cvt_f32_pattern,
.altnzcv,
.arith_bcc_fusion,
.arith_cbz_fusion,
.ccdp,
.crypto,
.disable_latency_sched_heuristic,
.fp16fml,
.fptoint,
.fuse_address,
.fuse_aes,
.fuse_arith_logic,
.fuse_crypto_eor,
.fuse_csel,
.fuse_literals,
.perfmon,
.predres,
.sb,
.sha3,
.specrestrict,
.ssbs,
.v8_4a,
.zcm,
.zcz,
}),
};
pub const apple_s4 = CpuModel{
.name = "apple_s4",
.llvm_name = "apple-s4",
.features = featureSet(&[_]Feature{
.apple_a12,
}),
};
pub const apple_s5 = CpuModel{
.name = "apple_s5",
.llvm_name = "apple-s5",
.features = featureSet(&[_]Feature{
.apple_a12,
}),
};
pub const carmel = CpuModel{
.name = "carmel",
.llvm_name = "carmel",
.features = featureSet(&[_]Feature{
.crypto,
.fullfp16,
.v8_2a,
}),
};
pub const cortex_a34 = CpuModel{
.name = "cortex_a34",
.llvm_name = "cortex-a34",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.v8a,
}),
};
pub const cortex_a35 = CpuModel{
.name = "cortex_a35",
.llvm_name = "cortex-a35",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.v8a,
}),
};
pub const cortex_a53 = CpuModel{
.name = "cortex_a53",
.llvm_name = "cortex-a53",
.features = featureSet(&[_]Feature{
.balance_fp_ops,
.crc,
.crypto,
.custom_cheap_as_move,
.fuse_aes,
.perfmon,
.use_postra_scheduler,
.v8a,
}),
};
pub const cortex_a55 = CpuModel{
.name = "cortex_a55",
.llvm_name = "cortex-a55",
.features = featureSet(&[_]Feature{
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.perfmon,
.rcpc,
.use_postra_scheduler,
.v8_2a,
}),
};
pub const cortex_a57 = CpuModel{
.name = "cortex_a57",
.llvm_name = "cortex-a57",
.features = featureSet(&[_]Feature{
.balance_fp_ops,
.crc,
.crypto,
.custom_cheap_as_move,
.fuse_aes,
.fuse_literals,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
}),
};
pub const cortex_a65 = CpuModel{
.name = "cortex_a65",
.llvm_name = "cortex-a65",
.features = featureSet(&[_]Feature{
.a65,
}),
};
pub const cortex_a65ae = CpuModel{
.name = "cortex_a65ae",
.llvm_name = "cortex-a65ae",
.features = featureSet(&[_]Feature{
.a65,
}),
};
pub const cortex_a72 = CpuModel{
.name = "cortex_a72",
.llvm_name = "cortex-a72",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.fuse_aes,
.fuse_literals,
.perfmon,
.v8a,
}),
};
pub const cortex_a73 = CpuModel{
.name = "cortex_a73",
.llvm_name = "cortex-a73",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.fuse_aes,
.perfmon,
.v8a,
}),
};
pub const cortex_a75 = CpuModel{
.name = "cortex_a75",
.llvm_name = "cortex-a75",
.features = featureSet(&[_]Feature{
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.perfmon,
.rcpc,
.v8_2a,
}),
};
pub const cortex_a76 = CpuModel{
.name = "cortex_a76",
.llvm_name = "cortex-a76",
.features = featureSet(&[_]Feature{
.a76,
}),
};
pub const cortex_a76ae = CpuModel{
.name = "cortex_a76ae",
.llvm_name = "cortex-a76ae",
.features = featureSet(&[_]Feature{
.a76,
}),
};
pub const cortex_a77 = CpuModel{
.name = "cortex_a77",
.llvm_name = "cortex-a77",
.features = featureSet(&[_]Feature{
.cmp_bcc_fusion,
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.rcpc,
.v8_2a,
}),
};
pub const cortex_a78 = CpuModel{
.name = "cortex_a78",
.llvm_name = "cortex-a78",
.features = featureSet(&[_]Feature{
.cmp_bcc_fusion,
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.perfmon,
.rcpc,
.spe,
.ssbs,
.use_postra_scheduler,
.v8_2a,
}),
};
pub const cortex_a78c = CpuModel{
.name = "cortex_a78c",
.llvm_name = "cortex-a78c",
.features = featureSet(&[_]Feature{
.cortex_a78c,
}),
};
pub const cortex_r82 = CpuModel{
.name = "cortex_r82",
.llvm_name = "cortex-r82",
.features = featureSet(&[_]Feature{
.cortex_r82,
}),
};
pub const cortex_x1 = CpuModel{
.name = "cortex_x1",
.llvm_name = "cortex-x1",
.features = featureSet(&[_]Feature{
.cmp_bcc_fusion,
.crypto,
.dotprod,
.fullfp16,
.fuse_aes,
.perfmon,
.rcpc,
.spe,
.use_postra_scheduler,
.v8_2a,
}),
};
pub const cyclone = CpuModel{
.name = "cyclone",
.llvm_name = "cyclone",
.features = featureSet(&[_]Feature{
.apple_a7,
}),
};
pub const emag = CpuModel{
.name = "emag",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.v8a,
}),
};
pub const exynos_m1 = CpuModel{
.name = "exynos_m1",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.exynos_cheap_as_move,
.force_32bit_jump_tables,
.fuse_aes,
.perfmon,
.slow_misaligned_128store,
.slow_paired_128,
.use_postra_scheduler,
.use_reciprocal_square_root,
.v8a,
}),
};
pub const exynos_m2 = CpuModel{
.name = "exynos_m2",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.exynos_cheap_as_move,
.force_32bit_jump_tables,
.fuse_aes,
.perfmon,
.slow_misaligned_128store,
.slow_paired_128,
.use_postra_scheduler,
.v8a,
}),
};
pub const exynos_m3 = CpuModel{
.name = "exynos_m3",
.llvm_name = "exynos-m3",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.exynos_cheap_as_move,
.force_32bit_jump_tables,
.fuse_address,
.fuse_aes,
.fuse_csel,
.fuse_literals,
.lsl_fast,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
}),
};
pub const exynos_m4 = CpuModel{
.name = "exynos_m4",
.llvm_name = "exynos-m4",
.features = featureSet(&[_]Feature{
.exynos_m4,
}),
};
pub const exynos_m5 = CpuModel{
.name = "exynos_m5",
.llvm_name = "exynos-m5",
.features = featureSet(&[_]Feature{
.exynos_m4,
}),
};
pub const falkor = CpuModel{
.name = "falkor",
.llvm_name = "falkor",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.custom_cheap_as_move,
.lsl_fast,
.perfmon,
.predictable_select_expensive,
.rdm,
.slow_strqro_store,
.use_postra_scheduler,
.v8a,
.zcz,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.ete,
.fuse_aes,
.neon,
.perfmon,
.use_postra_scheduler,
}),
};
pub const kryo = CpuModel{
.name = "kryo",
.llvm_name = "kryo",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.custom_cheap_as_move,
.lsl_fast,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
.zcz,
}),
};
pub const neoverse_e1 = CpuModel{
.name = "neoverse_e1",
.llvm_name = "neoverse-e1",
.features = featureSet(&[_]Feature{
.neoverse_e1,
}),
};
pub const neoverse_n1 = CpuModel{
.name = "neoverse_n1",
.llvm_name = "neoverse-n1",
.features = featureSet(&[_]Feature{
.neoverse_n1,
}),
};
pub const neoverse_n2 = CpuModel{
.name = "neoverse_n2",
.llvm_name = "neoverse-n2",
.features = featureSet(&[_]Feature{
.neoverse_n2,
}),
};
pub const neoverse_v1 = CpuModel{
.name = "neoverse_v1",
.llvm_name = "neoverse-v1",
.features = featureSet(&[_]Feature{
.neoverse_v1,
}),
};
pub const saphira = CpuModel{
.name = "saphira",
.llvm_name = "saphira",
.features = featureSet(&[_]Feature{
.crypto,
.custom_cheap_as_move,
.lsl_fast,
.perfmon,
.predictable_select_expensive,
.spe,
.use_postra_scheduler,
.v8_4a,
.zcz,
}),
};
pub const thunderx = CpuModel{
.name = "thunderx",
.llvm_name = "thunderx",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
}),
};
pub const thunderx2t99 = CpuModel{
.name = "thunderx2t99",
.llvm_name = "thunderx2t99",
.features = featureSet(&[_]Feature{
.aggressive_fma,
.arith_bcc_fusion,
.crypto,
.predictable_select_expensive,
.use_postra_scheduler,
.v8_1a,
}),
};
pub const thunderx3t110 = CpuModel{
.name = "thunderx3t110",
.llvm_name = "thunderx3t110",
.features = featureSet(&[_]Feature{
.aggressive_fma,
.arith_bcc_fusion,
.balance_fp_ops,
.crypto,
.perfmon,
.predictable_select_expensive,
.strict_align,
.use_postra_scheduler,
.v8_3a,
}),
};
pub const thunderxt81 = CpuModel{
.name = "thunderxt81",
.llvm_name = "thunderxt81",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
}),
};
pub const thunderxt83 = CpuModel{
.name = "thunderxt83",
.llvm_name = "thunderxt83",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
}),
};
pub const thunderxt88 = CpuModel{
.name = "thunderxt88",
.llvm_name = "thunderxt88",
.features = featureSet(&[_]Feature{
.crc,
.crypto,
.perfmon,
.predictable_select_expensive,
.use_postra_scheduler,
.v8a,
}),
};
pub const tsv110 = CpuModel{
.name = "tsv110",
.llvm_name = "tsv110",
.features = featureSet(&[_]Feature{
.crypto,
.custom_cheap_as_move,
.dotprod,
.fp16fml,
.fuse_aes,
.perfmon,
.spe,
.use_postra_scheduler,
.v8_2a,
}),
};
pub const xgene1 = CpuModel{
.name = "xgene1",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.perfmon,
.v8a,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/amdgpu.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
@"16_bit_insts",
a16,
add_no_carry_insts,
aperture_regs,
architected_flat_scratch,
atomic_fadd_insts,
auto_waitcnt_before_barrier,
ci_insts,
cumode,
dl_insts,
dot1_insts,
dot2_insts,
dot3_insts,
dot4_insts,
dot5_insts,
dot6_insts,
dot7_insts,
dpp,
dpp8,
dpp_64bit,
ds_src2_insts,
enable_ds128,
enable_prt_strict_null,
extended_image_insts,
fast_denormal_f32,
fast_fmaf,
flat_address_space,
flat_for_global,
flat_global_insts,
flat_inst_offsets,
flat_scratch_insts,
flat_segment_offset_bug,
fma_mix_insts,
fmaf,
fp64,
full_rate_64_ops,
g16,
gcn3_encoding,
get_wave_id_inst,
gfx10,
gfx10_3_insts,
gfx10_a_encoding,
gfx10_b_encoding,
gfx10_insts,
gfx7_gfx8_gfx9_insts,
gfx8_insts,
gfx9,
gfx90a_insts,
gfx9_insts,
half_rate_64_ops,
image_gather4_d16_bug,
image_store_d16_bug,
inst_fwd_prefetch_bug,
int_clamp_insts,
inv_2pi_inline_imm,
lds_branch_vmem_war_hazard,
lds_misaligned_bug,
ldsbankcount16,
ldsbankcount32,
load_store_opt,
localmemorysize0,
localmemorysize32768,
localmemorysize65536,
mad_mac_f32_insts,
mad_mix_insts,
mai_insts,
max_private_element_size_16,
max_private_element_size_4,
max_private_element_size_8,
mfma_inline_literal_bug,
mimg_r128,
movrel,
negative_scratch_offset_bug,
negative_unaligned_scratch_offset_bug,
no_data_dep_hazard,
no_sdst_cmpx,
nsa_clause_bug,
nsa_encoding,
nsa_max_size_13,
nsa_max_size_5,
nsa_to_vmem_bug,
offset_3f_bug,
packed_fp32_ops,
packed_tid,
pk_fmac_f16_inst,
promote_alloca,
r128_a16,
register_banking,
s_memrealtime,
s_memtime_inst,
scalar_atomics,
scalar_flat_scratch_insts,
scalar_stores,
sdwa,
sdwa_mav,
sdwa_omod,
sdwa_out_mods_vopc,
sdwa_scalar,
sdwa_sdst,
sea_islands,
sgpr_init_bug,
shader_cycles_register,
si_scheduler,
smem_to_vector_write_hazard,
southern_islands,
sramecc,
sramecc_support,
tgsplit,
trap_handler,
trig_reduced_range,
unaligned_access_mode,
unaligned_buffer_access,
unaligned_ds_access,
unaligned_scratch_access,
unpacked_d16_vmem,
unsafe_ds_offset_folding,
vcmpx_exec_war_hazard,
vcmpx_permlane_hazard,
vgpr_index_mode,
vmem_to_scalar_write_hazard,
volcanic_islands,
vop3_literal,
vop3p,
vscnt,
wavefrontsize16,
wavefrontsize32,
wavefrontsize64,
xnack,
xnack_support,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"16_bit_insts")] = .{
.llvm_name = "16-bit-insts",
.description = "Has i16/f16 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.a16)] = .{
.llvm_name = "a16",
.description = "Support gfx10-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.add_no_carry_insts)] = .{
.llvm_name = "add-no-carry-insts",
.description = "Have VALU add/sub instructions without carry out",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.aperture_regs)] = .{
.llvm_name = "aperture-regs",
.description = "Has Memory Aperture Base and Size Registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.architected_flat_scratch)] = .{
.llvm_name = "architected-flat-scratch",
.description = "Flat Scratch register is a readonly SPI initialized architected register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.atomic_fadd_insts)] = .{
.llvm_name = "atomic-fadd-insts",
.description = "Has buffer_atomic_add_f32, buffer_atomic_pk_add_f16, global_atomic_add_f32, global_atomic_pk_add_f16 instructions",
.dependencies = featureSet(&[_]Feature{
.flat_global_insts,
}),
};
result[@intFromEnum(Feature.auto_waitcnt_before_barrier)] = .{
.llvm_name = "auto-waitcnt-before-barrier",
.description = "Hardware automatically inserts waitcnt before barrier",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ci_insts)] = .{
.llvm_name = "ci-insts",
.description = "Additional instructions for CI+",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cumode)] = .{
.llvm_name = "cumode",
.description = "Enable CU wavefront execution mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dl_insts)] = .{
.llvm_name = "dl-insts",
.description = "Has v_fmac_f32 and v_xnor_b32 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot1_insts)] = .{
.llvm_name = "dot1-insts",
.description = "Has v_dot4_i32_i8 and v_dot8_i32_i4 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot2_insts)] = .{
.llvm_name = "dot2-insts",
.description = "Has v_dot2_i32_i16, v_dot2_u32_u16 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot3_insts)] = .{
.llvm_name = "dot3-insts",
.description = "Has v_dot8c_i32_i4 instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot4_insts)] = .{
.llvm_name = "dot4-insts",
.description = "Has v_dot2c_i32_i16 instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot5_insts)] = .{
.llvm_name = "dot5-insts",
.description = "Has v_dot2c_f32_f16 instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot6_insts)] = .{
.llvm_name = "dot6-insts",
.description = "Has v_dot4c_i32_i8 instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dot7_insts)] = .{
.llvm_name = "dot7-insts",
.description = "Has v_dot2_f32_f16, v_dot4_u32_u8, v_dot8_u32_u4 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dpp)] = .{
.llvm_name = "dpp",
.description = "Support DPP (Data Parallel Primitives) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dpp8)] = .{
.llvm_name = "dpp8",
.description = "Support DPP8 (Data Parallel Primitives) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dpp_64bit)] = .{
.llvm_name = "dpp-64bit",
.description = "Support DPP (Data Parallel Primitives) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ds_src2_insts)] = .{
.llvm_name = "ds-src2-insts",
.description = "Has ds_*_src2 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.enable_ds128)] = .{
.llvm_name = "enable-ds128",
.description = "Use ds_{read|write}_b128",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.enable_prt_strict_null)] = .{
.llvm_name = "enable-prt-strict-null",
.description = "Enable zeroing of result registers for sparse texture fetches",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.extended_image_insts)] = .{
.llvm_name = "extended-image-insts",
.description = "Support mips != 0, lod != 0, gather4, and get_lod",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_denormal_f32)] = .{
.llvm_name = "fast-denormal-f32",
.description = "Enabling denormals does not cause f32 instructions to run at f64 rates",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_fmaf)] = .{
.llvm_name = "fast-fmaf",
.description = "Assuming f32 fma is at least as fast as mul + add",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flat_address_space)] = .{
.llvm_name = "flat-address-space",
.description = "Support flat address space",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flat_for_global)] = .{
.llvm_name = "flat-for-global",
.description = "Force to generate flat instruction for global",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flat_global_insts)] = .{
.llvm_name = "flat-global-insts",
.description = "Have global_* flat memory instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flat_inst_offsets)] = .{
.llvm_name = "flat-inst-offsets",
.description = "Flat instructions have immediate offset addressing mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flat_scratch_insts)] = .{
.llvm_name = "flat-scratch-insts",
.description = "Have scratch_* flat memory instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.flat_segment_offset_bug)] = .{
.llvm_name = "flat-segment-offset-bug",
.description = "GFX10 bug where inst_offset is ignored when flat instructions access global memory",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fma_mix_insts)] = .{
.llvm_name = "fma-mix-insts",
.description = "Has v_fma_mix_f32, v_fma_mixlo_f16, v_fma_mixhi_f16 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fmaf)] = .{
.llvm_name = "fmaf",
.description = "Enable single precision FMA (not as fast as mul+add, but fused)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fp64)] = .{
.llvm_name = "fp64",
.description = "Enable double precision operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.full_rate_64_ops)] = .{
.llvm_name = "full-rate-64-ops",
.description = "Most fp64 instructions are full rate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.g16)] = .{
.llvm_name = "g16",
.description = "Support G16 for 16-bit gradient image operands",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gcn3_encoding)] = .{
.llvm_name = "gcn3-encoding",
.description = "Encoding format for VI",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.get_wave_id_inst)] = .{
.llvm_name = "get-wave-id-inst",
.description = "Has s_get_waveid_in_workgroup instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx10)] = .{
.llvm_name = "gfx10",
.description = "GFX10 GPU generation",
.dependencies = featureSet(&[_]Feature{
.@"16_bit_insts",
.a16,
.add_no_carry_insts,
.aperture_regs,
.ci_insts,
.dpp,
.dpp8,
.extended_image_insts,
.fast_denormal_f32,
.fast_fmaf,
.flat_address_space,
.flat_global_insts,
.flat_inst_offsets,
.flat_scratch_insts,
.fma_mix_insts,
.fp64,
.g16,
.gfx10_insts,
.gfx8_insts,
.gfx9_insts,
.int_clamp_insts,
.inv_2pi_inline_imm,
.localmemorysize65536,
.mimg_r128,
.movrel,
.no_data_dep_hazard,
.no_sdst_cmpx,
.pk_fmac_f16_inst,
.register_banking,
.s_memrealtime,
.s_memtime_inst,
.sdwa,
.sdwa_omod,
.sdwa_scalar,
.sdwa_sdst,
.unaligned_buffer_access,
.unaligned_ds_access,
.vop3_literal,
.vop3p,
.vscnt,
}),
};
result[@intFromEnum(Feature.gfx10_3_insts)] = .{
.llvm_name = "gfx10-3-insts",
.description = "Additional instructions for GFX10.3",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx10_a_encoding)] = .{
.llvm_name = "gfx10_a-encoding",
.description = "Has BVH ray tracing instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx10_b_encoding)] = .{
.llvm_name = "gfx10_b-encoding",
.description = "Encoding format GFX10_B",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx10_insts)] = .{
.llvm_name = "gfx10-insts",
.description = "Additional instructions for GFX10+",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx7_gfx8_gfx9_insts)] = .{
.llvm_name = "gfx7-gfx8-gfx9-insts",
.description = "Instructions shared in GFX7, GFX8, GFX9",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx8_insts)] = .{
.llvm_name = "gfx8-insts",
.description = "Additional instructions for GFX8+",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx9)] = .{
.llvm_name = "gfx9",
.description = "GFX9 GPU generation",
.dependencies = featureSet(&[_]Feature{
.@"16_bit_insts",
.add_no_carry_insts,
.aperture_regs,
.ci_insts,
.dpp,
.fast_denormal_f32,
.fast_fmaf,
.flat_address_space,
.flat_global_insts,
.flat_inst_offsets,
.flat_scratch_insts,
.fp64,
.gcn3_encoding,
.gfx7_gfx8_gfx9_insts,
.gfx8_insts,
.gfx9_insts,
.int_clamp_insts,
.inv_2pi_inline_imm,
.localmemorysize65536,
.negative_scratch_offset_bug,
.r128_a16,
.s_memrealtime,
.s_memtime_inst,
.scalar_atomics,
.scalar_flat_scratch_insts,
.scalar_stores,
.sdwa,
.sdwa_omod,
.sdwa_scalar,
.sdwa_sdst,
.unaligned_buffer_access,
.unaligned_ds_access,
.vgpr_index_mode,
.vop3p,
.wavefrontsize64,
.xnack_support,
}),
};
result[@intFromEnum(Feature.gfx90a_insts)] = .{
.llvm_name = "gfx90a-insts",
.description = "Additional instructions for GFX90A+",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfx9_insts)] = .{
.llvm_name = "gfx9-insts",
.description = "Additional instructions for GFX9+",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.half_rate_64_ops)] = .{
.llvm_name = "half-rate-64-ops",
.description = "Most fp64 instructions are half rate instead of quarter",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.image_gather4_d16_bug)] = .{
.llvm_name = "image-gather4-d16-bug",
.description = "Image Gather4 D16 hardware bug",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.image_store_d16_bug)] = .{
.llvm_name = "image-store-d16-bug",
.description = "Image Store D16 hardware bug",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.inst_fwd_prefetch_bug)] = .{
.llvm_name = "inst-fwd-prefetch-bug",
.description = "S_INST_PREFETCH instruction causes shader to hang",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.int_clamp_insts)] = .{
.llvm_name = "int-clamp-insts",
.description = "Support clamp for integer destination",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.inv_2pi_inline_imm)] = .{
.llvm_name = "inv-2pi-inline-imm",
.description = "Has 1 / (2 * pi) as inline immediate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lds_branch_vmem_war_hazard)] = .{
.llvm_name = "lds-branch-vmem-war-hazard",
.description = "Switching between LDS and VMEM-tex not waiting VM_VSRC=0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lds_misaligned_bug)] = .{
.llvm_name = "lds-misaligned-bug",
.description = "Some GFX10 bug with multi-dword LDS and flat access that is not naturally aligned in WGP mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ldsbankcount16)] = .{
.llvm_name = "ldsbankcount16",
.description = "The number of LDS banks per compute unit.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ldsbankcount32)] = .{
.llvm_name = "ldsbankcount32",
.description = "The number of LDS banks per compute unit.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.load_store_opt)] = .{
.llvm_name = "load-store-opt",
.description = "Enable SI load/store optimizer pass",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.localmemorysize0)] = .{
.llvm_name = "localmemorysize0",
.description = "The size of local memory in bytes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.localmemorysize32768)] = .{
.llvm_name = "localmemorysize32768",
.description = "The size of local memory in bytes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.localmemorysize65536)] = .{
.llvm_name = "localmemorysize65536",
.description = "The size of local memory in bytes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mad_mac_f32_insts)] = .{
.llvm_name = "mad-mac-f32-insts",
.description = "Has v_mad_f32/v_mac_f32/v_madak_f32/v_madmk_f32 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mad_mix_insts)] = .{
.llvm_name = "mad-mix-insts",
.description = "Has v_mad_mix_f32, v_mad_mixlo_f16, v_mad_mixhi_f16 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mai_insts)] = .{
.llvm_name = "mai-insts",
.description = "Has mAI instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.max_private_element_size_16)] = .{
.llvm_name = "max-private-element-size-16",
.description = "Maximum private access size may be 16",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.max_private_element_size_4)] = .{
.llvm_name = "max-private-element-size-4",
.description = "Maximum private access size may be 4",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.max_private_element_size_8)] = .{
.llvm_name = "max-private-element-size-8",
.description = "Maximum private access size may be 8",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mfma_inline_literal_bug)] = .{
.llvm_name = "mfma-inline-literal-bug",
.description = "MFMA cannot use inline literal as SrcC",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mimg_r128)] = .{
.llvm_name = "mimg-r128",
.description = "Support 128-bit texture resources",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.movrel)] = .{
.llvm_name = "movrel",
.description = "Has v_movrel*_b32 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.negative_scratch_offset_bug)] = .{
.llvm_name = "negative-scratch-offset-bug",
.description = "Negative immediate offsets in scratch instructions with an SGPR offset page fault on GFX9",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.negative_unaligned_scratch_offset_bug)] = .{
.llvm_name = "negative-unaligned-scratch-offset-bug",
.description = "Scratch instructions with a VGPR offset and a negative immediate offset that is not a multiple of 4 read wrong memory on GFX10",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_data_dep_hazard)] = .{
.llvm_name = "no-data-dep-hazard",
.description = "Does not need SW waitstates",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_sdst_cmpx)] = .{
.llvm_name = "no-sdst-cmpx",
.description = "V_CMPX does not write VCC/SGPR in addition to EXEC",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nsa_clause_bug)] = .{
.llvm_name = "nsa-clause-bug",
.description = "MIMG-NSA in a hard clause has unpredictable results on GFX10.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nsa_encoding)] = .{
.llvm_name = "nsa-encoding",
.description = "Support NSA encoding for image instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nsa_max_size_13)] = .{
.llvm_name = "nsa-max-size-13",
.description = "The maximum non-sequential address size in VGPRs.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nsa_max_size_5)] = .{
.llvm_name = "nsa-max-size-5",
.description = "The maximum non-sequential address size in VGPRs.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nsa_to_vmem_bug)] = .{
.llvm_name = "nsa-to-vmem-bug",
.description = "MIMG-NSA followed by VMEM fail if EXEC_LO or EXEC_HI equals zero",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.offset_3f_bug)] = .{
.llvm_name = "offset-3f-bug",
.description = "Branch offset of 3f hardware bug",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.packed_fp32_ops)] = .{
.llvm_name = "packed-fp32-ops",
.description = "Support packed fp32 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.packed_tid)] = .{
.llvm_name = "packed-tid",
.description = "Workitem IDs are packed into v0 at kernel launch",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pk_fmac_f16_inst)] = .{
.llvm_name = "pk-fmac-f16-inst",
.description = "Has v_pk_fmac_f16 instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.promote_alloca)] = .{
.llvm_name = "promote-alloca",
.description = "Enable promote alloca pass",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.r128_a16)] = .{
.llvm_name = "r128-a16",
.description = "Support gfx9-style A16 for 16-bit coordinates/gradients/lod/clamp/mip image operands, where a16 is aliased with r128",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.register_banking)] = .{
.llvm_name = "register-banking",
.description = "Has register banking",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.s_memrealtime)] = .{
.llvm_name = "s-memrealtime",
.description = "Has s_memrealtime instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.s_memtime_inst)] = .{
.llvm_name = "s-memtime-inst",
.description = "Has s_memtime instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.scalar_atomics)] = .{
.llvm_name = "scalar-atomics",
.description = "Has atomic scalar memory instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.scalar_flat_scratch_insts)] = .{
.llvm_name = "scalar-flat-scratch-insts",
.description = "Have s_scratch_* flat memory instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.scalar_stores)] = .{
.llvm_name = "scalar-stores",
.description = "Has store scalar memory instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sdwa)] = .{
.llvm_name = "sdwa",
.description = "Support SDWA (Sub-DWORD Addressing) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sdwa_mav)] = .{
.llvm_name = "sdwa-mav",
.description = "Support v_mac_f32/f16 with SDWA (Sub-DWORD Addressing) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sdwa_omod)] = .{
.llvm_name = "sdwa-omod",
.description = "Support OMod with SDWA (Sub-DWORD Addressing) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sdwa_out_mods_vopc)] = .{
.llvm_name = "sdwa-out-mods-vopc",
.description = "Support clamp for VOPC with SDWA (Sub-DWORD Addressing) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sdwa_scalar)] = .{
.llvm_name = "sdwa-scalar",
.description = "Support scalar register with SDWA (Sub-DWORD Addressing) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sdwa_sdst)] = .{
.llvm_name = "sdwa-sdst",
.description = "Support scalar dst for VOPC with SDWA (Sub-DWORD Addressing) extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sea_islands)] = .{
.llvm_name = "sea-islands",
.description = "SEA_ISLANDS GPU generation",
.dependencies = featureSet(&[_]Feature{
.ci_insts,
.ds_src2_insts,
.extended_image_insts,
.flat_address_space,
.fp64,
.gfx7_gfx8_gfx9_insts,
.localmemorysize65536,
.mad_mac_f32_insts,
.mimg_r128,
.movrel,
.s_memtime_inst,
.trig_reduced_range,
.unaligned_buffer_access,
.wavefrontsize64,
}),
};
result[@intFromEnum(Feature.sgpr_init_bug)] = .{
.llvm_name = "sgpr-init-bug",
.description = "VI SGPR initialization bug requiring a fixed SGPR allocation size",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.shader_cycles_register)] = .{
.llvm_name = "shader-cycles-register",
.description = "Has SHADER_CYCLES hardware register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.si_scheduler)] = .{
.llvm_name = "si-scheduler",
.description = "Enable SI Machine Scheduler",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.smem_to_vector_write_hazard)] = .{
.llvm_name = "smem-to-vector-write-hazard",
.description = "s_load_dword followed by v_cmp page faults",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.southern_islands)] = .{
.llvm_name = "southern-islands",
.description = "SOUTHERN_ISLANDS GPU generation",
.dependencies = featureSet(&[_]Feature{
.ds_src2_insts,
.extended_image_insts,
.fp64,
.ldsbankcount32,
.localmemorysize32768,
.mad_mac_f32_insts,
.mimg_r128,
.movrel,
.s_memtime_inst,
.trig_reduced_range,
.wavefrontsize64,
}),
};
result[@intFromEnum(Feature.sramecc)] = .{
.llvm_name = "sramecc",
.description = "Enable SRAMECC",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sramecc_support)] = .{
.llvm_name = "sramecc-support",
.description = "Hardware supports SRAMECC",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tgsplit)] = .{
.llvm_name = "tgsplit",
.description = "Enable threadgroup split execution",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.trap_handler)] = .{
.llvm_name = "trap-handler",
.description = "Trap handler support",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.trig_reduced_range)] = .{
.llvm_name = "trig-reduced-range",
.description = "Requires use of fract on arguments to trig instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unaligned_access_mode)] = .{
.llvm_name = "unaligned-access-mode",
.description = "Enable unaligned global, local and region loads and stores if the hardware supports it",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unaligned_buffer_access)] = .{
.llvm_name = "unaligned-buffer-access",
.description = "Hardware supports unaligned global loads and stores",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unaligned_ds_access)] = .{
.llvm_name = "unaligned-ds-access",
.description = "Hardware supports unaligned local and region loads and stores",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unaligned_scratch_access)] = .{
.llvm_name = "unaligned-scratch-access",
.description = "Support unaligned scratch loads and stores",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unpacked_d16_vmem)] = .{
.llvm_name = "unpacked-d16-vmem",
.description = "Has unpacked d16 vmem instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.unsafe_ds_offset_folding)] = .{
.llvm_name = "unsafe-ds-offset-folding",
.description = "Force using DS instruction immediate offsets on SI",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vcmpx_exec_war_hazard)] = .{
.llvm_name = "vcmpx-exec-war-hazard",
.description = "V_CMPX WAR hazard on EXEC (V_CMPX issue ONLY)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vcmpx_permlane_hazard)] = .{
.llvm_name = "vcmpx-permlane-hazard",
.description = "TODO: describe me",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vgpr_index_mode)] = .{
.llvm_name = "vgpr-index-mode",
.description = "Has VGPR mode register indexing",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vmem_to_scalar_write_hazard)] = .{
.llvm_name = "vmem-to-scalar-write-hazard",
.description = "VMEM instruction followed by scalar writing to EXEC mask, M0 or SGPR leads to incorrect execution.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.volcanic_islands)] = .{
.llvm_name = "volcanic-islands",
.description = "VOLCANIC_ISLANDS GPU generation",
.dependencies = featureSet(&[_]Feature{
.@"16_bit_insts",
.ci_insts,
.dpp,
.ds_src2_insts,
.extended_image_insts,
.fast_denormal_f32,
.flat_address_space,
.fp64,
.gcn3_encoding,
.gfx7_gfx8_gfx9_insts,
.gfx8_insts,
.int_clamp_insts,
.inv_2pi_inline_imm,
.localmemorysize65536,
.mad_mac_f32_insts,
.mimg_r128,
.movrel,
.s_memrealtime,
.s_memtime_inst,
.scalar_stores,
.sdwa,
.sdwa_mav,
.sdwa_out_mods_vopc,
.trig_reduced_range,
.unaligned_buffer_access,
.vgpr_index_mode,
.wavefrontsize64,
}),
};
result[@intFromEnum(Feature.vop3_literal)] = .{
.llvm_name = "vop3-literal",
.description = "Can use one literal in VOP3",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vop3p)] = .{
.llvm_name = "vop3p",
.description = "Has VOP3P packed instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vscnt)] = .{
.llvm_name = "vscnt",
.description = "Has separate store vscnt counter",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.wavefrontsize16)] = .{
.llvm_name = "wavefrontsize16",
.description = "The number of threads per wavefront",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.wavefrontsize32)] = .{
.llvm_name = "wavefrontsize32",
.description = "The number of threads per wavefront",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.wavefrontsize64)] = .{
.llvm_name = "wavefrontsize64",
.description = "The number of threads per wavefront",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xnack)] = .{
.llvm_name = "xnack",
.description = "Enable XNACK support",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xnack_support)] = .{
.llvm_name = "xnack-support",
.description = "Hardware supports XNACK",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const bonaire = CpuModel{
.name = "bonaire",
.llvm_name = "bonaire",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sea_islands,
}),
};
pub const carrizo = CpuModel{
.name = "carrizo",
.llvm_name = "carrizo",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.half_rate_64_ops,
.ldsbankcount32,
.unpacked_d16_vmem,
.volcanic_islands,
.xnack_support,
}),
};
pub const fiji = CpuModel{
.name = "fiji",
.llvm_name = "fiji",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.wavefrontsize64,
}),
};
pub const generic_hsa = CpuModel{
.name = "generic_hsa",
.llvm_name = "generic-hsa",
.features = featureSet(&[_]Feature{
.flat_address_space,
.wavefrontsize64,
}),
};
pub const gfx1010 = CpuModel{
.name = "gfx1010",
.llvm_name = "gfx1010",
.features = featureSet(&[_]Feature{
.dl_insts,
.ds_src2_insts,
.flat_segment_offset_bug,
.get_wave_id_inst,
.gfx10,
.inst_fwd_prefetch_bug,
.lds_branch_vmem_war_hazard,
.lds_misaligned_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.negative_unaligned_scratch_offset_bug,
.nsa_clause_bug,
.nsa_encoding,
.nsa_max_size_5,
.nsa_to_vmem_bug,
.offset_3f_bug,
.scalar_atomics,
.scalar_flat_scratch_insts,
.scalar_stores,
.smem_to_vector_write_hazard,
.vcmpx_exec_war_hazard,
.vcmpx_permlane_hazard,
.vmem_to_scalar_write_hazard,
.wavefrontsize32,
.xnack_support,
}),
};
pub const gfx1011 = CpuModel{
.name = "gfx1011",
.llvm_name = "gfx1011",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.ds_src2_insts,
.flat_segment_offset_bug,
.get_wave_id_inst,
.gfx10,
.inst_fwd_prefetch_bug,
.lds_branch_vmem_war_hazard,
.lds_misaligned_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.negative_unaligned_scratch_offset_bug,
.nsa_clause_bug,
.nsa_encoding,
.nsa_max_size_5,
.nsa_to_vmem_bug,
.offset_3f_bug,
.scalar_atomics,
.scalar_flat_scratch_insts,
.scalar_stores,
.smem_to_vector_write_hazard,
.vcmpx_exec_war_hazard,
.vcmpx_permlane_hazard,
.vmem_to_scalar_write_hazard,
.wavefrontsize32,
.xnack_support,
}),
};
pub const gfx1012 = CpuModel{
.name = "gfx1012",
.llvm_name = "gfx1012",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.ds_src2_insts,
.flat_segment_offset_bug,
.get_wave_id_inst,
.gfx10,
.inst_fwd_prefetch_bug,
.lds_branch_vmem_war_hazard,
.lds_misaligned_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.negative_unaligned_scratch_offset_bug,
.nsa_clause_bug,
.nsa_encoding,
.nsa_max_size_5,
.nsa_to_vmem_bug,
.offset_3f_bug,
.scalar_atomics,
.scalar_flat_scratch_insts,
.scalar_stores,
.smem_to_vector_write_hazard,
.vcmpx_exec_war_hazard,
.vcmpx_permlane_hazard,
.vmem_to_scalar_write_hazard,
.wavefrontsize32,
.xnack_support,
}),
};
pub const gfx1013 = CpuModel{
.name = "gfx1013",
.llvm_name = "gfx1013",
.features = featureSet(&[_]Feature{
.dl_insts,
.ds_src2_insts,
.flat_segment_offset_bug,
.get_wave_id_inst,
.gfx10,
.gfx10_a_encoding,
.inst_fwd_prefetch_bug,
.lds_branch_vmem_war_hazard,
.lds_misaligned_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.negative_unaligned_scratch_offset_bug,
.nsa_clause_bug,
.nsa_encoding,
.nsa_max_size_5,
.nsa_to_vmem_bug,
.offset_3f_bug,
.scalar_atomics,
.scalar_flat_scratch_insts,
.scalar_stores,
.smem_to_vector_write_hazard,
.vcmpx_exec_war_hazard,
.vcmpx_permlane_hazard,
.vmem_to_scalar_write_hazard,
.wavefrontsize32,
.xnack_support,
}),
};
pub const gfx1030 = CpuModel{
.name = "gfx1030",
.llvm_name = "gfx1030",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.gfx10,
.gfx10_3_insts,
.gfx10_a_encoding,
.gfx10_b_encoding,
.ldsbankcount32,
.nsa_encoding,
.nsa_max_size_13,
.shader_cycles_register,
.wavefrontsize32,
}),
};
pub const gfx1031 = CpuModel{
.name = "gfx1031",
.llvm_name = "gfx1031",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.gfx10,
.gfx10_3_insts,
.gfx10_a_encoding,
.gfx10_b_encoding,
.ldsbankcount32,
.nsa_encoding,
.nsa_max_size_13,
.shader_cycles_register,
.wavefrontsize32,
}),
};
pub const gfx1032 = CpuModel{
.name = "gfx1032",
.llvm_name = "gfx1032",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.gfx10,
.gfx10_3_insts,
.gfx10_a_encoding,
.gfx10_b_encoding,
.ldsbankcount32,
.nsa_encoding,
.nsa_max_size_13,
.shader_cycles_register,
.wavefrontsize32,
}),
};
pub const gfx1033 = CpuModel{
.name = "gfx1033",
.llvm_name = "gfx1033",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.gfx10,
.gfx10_3_insts,
.gfx10_a_encoding,
.gfx10_b_encoding,
.ldsbankcount32,
.nsa_encoding,
.nsa_max_size_13,
.shader_cycles_register,
.wavefrontsize32,
}),
};
pub const gfx1034 = CpuModel{
.name = "gfx1034",
.llvm_name = "gfx1034",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.gfx10,
.gfx10_3_insts,
.gfx10_a_encoding,
.gfx10_b_encoding,
.ldsbankcount32,
.nsa_encoding,
.nsa_max_size_13,
.shader_cycles_register,
.wavefrontsize32,
}),
};
pub const gfx1035 = CpuModel{
.name = "gfx1035",
.llvm_name = "gfx1035",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.gfx10,
.gfx10_3_insts,
.gfx10_a_encoding,
.gfx10_b_encoding,
.ldsbankcount32,
.nsa_encoding,
.nsa_max_size_13,
.shader_cycles_register,
.wavefrontsize32,
}),
};
pub const gfx600 = CpuModel{
.name = "gfx600",
.llvm_name = "gfx600",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.half_rate_64_ops,
.southern_islands,
}),
};
pub const gfx601 = CpuModel{
.name = "gfx601",
.llvm_name = "gfx601",
.features = featureSet(&[_]Feature{
.southern_islands,
}),
};
pub const gfx602 = CpuModel{
.name = "gfx602",
.llvm_name = "gfx602",
.features = featureSet(&[_]Feature{
.southern_islands,
}),
};
pub const gfx700 = CpuModel{
.name = "gfx700",
.llvm_name = "gfx700",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sea_islands,
}),
};
pub const gfx701 = CpuModel{
.name = "gfx701",
.llvm_name = "gfx701",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.half_rate_64_ops,
.ldsbankcount32,
.sea_islands,
}),
};
pub const gfx702 = CpuModel{
.name = "gfx702",
.llvm_name = "gfx702",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.ldsbankcount16,
.sea_islands,
}),
};
pub const gfx703 = CpuModel{
.name = "gfx703",
.llvm_name = "gfx703",
.features = featureSet(&[_]Feature{
.ldsbankcount16,
.sea_islands,
}),
};
pub const gfx704 = CpuModel{
.name = "gfx704",
.llvm_name = "gfx704",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sea_islands,
}),
};
pub const gfx705 = CpuModel{
.name = "gfx705",
.llvm_name = "gfx705",
.features = featureSet(&[_]Feature{
.ldsbankcount16,
.sea_islands,
}),
};
pub const gfx801 = CpuModel{
.name = "gfx801",
.llvm_name = "gfx801",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.half_rate_64_ops,
.ldsbankcount32,
.unpacked_d16_vmem,
.volcanic_islands,
.xnack_support,
}),
};
pub const gfx802 = CpuModel{
.name = "gfx802",
.llvm_name = "gfx802",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sgpr_init_bug,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const gfx803 = CpuModel{
.name = "gfx803",
.llvm_name = "gfx803",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const gfx805 = CpuModel{
.name = "gfx805",
.llvm_name = "gfx805",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sgpr_init_bug,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const gfx810 = CpuModel{
.name = "gfx810",
.llvm_name = "gfx810",
.features = featureSet(&[_]Feature{
.image_gather4_d16_bug,
.image_store_d16_bug,
.ldsbankcount16,
.volcanic_islands,
.xnack_support,
}),
};
pub const gfx900 = CpuModel{
.name = "gfx900",
.llvm_name = "gfx900",
.features = featureSet(&[_]Feature{
.ds_src2_insts,
.extended_image_insts,
.gfx9,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.mad_mix_insts,
}),
};
pub const gfx902 = CpuModel{
.name = "gfx902",
.llvm_name = "gfx902",
.features = featureSet(&[_]Feature{
.ds_src2_insts,
.extended_image_insts,
.gfx9,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.mad_mix_insts,
}),
};
pub const gfx904 = CpuModel{
.name = "gfx904",
.llvm_name = "gfx904",
.features = featureSet(&[_]Feature{
.ds_src2_insts,
.extended_image_insts,
.fma_mix_insts,
.gfx9,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
}),
};
pub const gfx906 = CpuModel{
.name = "gfx906",
.llvm_name = "gfx906",
.features = featureSet(&[_]Feature{
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot7_insts,
.ds_src2_insts,
.extended_image_insts,
.fma_mix_insts,
.gfx9,
.half_rate_64_ops,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.sramecc_support,
}),
};
pub const gfx908 = CpuModel{
.name = "gfx908",
.llvm_name = "gfx908",
.features = featureSet(&[_]Feature{
.atomic_fadd_insts,
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot3_insts,
.dot4_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.ds_src2_insts,
.extended_image_insts,
.fma_mix_insts,
.gfx9,
.half_rate_64_ops,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.mai_insts,
.mfma_inline_literal_bug,
.pk_fmac_f16_inst,
.sramecc_support,
}),
};
pub const gfx909 = CpuModel{
.name = "gfx909",
.llvm_name = "gfx909",
.features = featureSet(&[_]Feature{
.ds_src2_insts,
.extended_image_insts,
.gfx9,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.mad_mix_insts,
}),
};
pub const gfx90a = CpuModel{
.name = "gfx90a",
.llvm_name = "gfx90a",
.features = featureSet(&[_]Feature{
.atomic_fadd_insts,
.dl_insts,
.dot1_insts,
.dot2_insts,
.dot3_insts,
.dot4_insts,
.dot5_insts,
.dot6_insts,
.dot7_insts,
.dpp_64bit,
.fma_mix_insts,
.full_rate_64_ops,
.gfx9,
.gfx90a_insts,
.ldsbankcount32,
.mad_mac_f32_insts,
.mai_insts,
.packed_fp32_ops,
.packed_tid,
.pk_fmac_f16_inst,
.sramecc_support,
}),
};
pub const gfx90c = CpuModel{
.name = "gfx90c",
.llvm_name = "gfx90c",
.features = featureSet(&[_]Feature{
.ds_src2_insts,
.extended_image_insts,
.gfx9,
.image_gather4_d16_bug,
.ldsbankcount32,
.mad_mac_f32_insts,
.mad_mix_insts,
}),
};
pub const hainan = CpuModel{
.name = "hainan",
.llvm_name = "hainan",
.features = featureSet(&[_]Feature{
.southern_islands,
}),
};
pub const hawaii = CpuModel{
.name = "hawaii",
.llvm_name = "hawaii",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.half_rate_64_ops,
.ldsbankcount32,
.sea_islands,
}),
};
pub const iceland = CpuModel{
.name = "iceland",
.llvm_name = "iceland",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sgpr_init_bug,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const kabini = CpuModel{
.name = "kabini",
.llvm_name = "kabini",
.features = featureSet(&[_]Feature{
.ldsbankcount16,
.sea_islands,
}),
};
pub const kaveri = CpuModel{
.name = "kaveri",
.llvm_name = "kaveri",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sea_islands,
}),
};
pub const mullins = CpuModel{
.name = "mullins",
.llvm_name = "mullins",
.features = featureSet(&[_]Feature{
.ldsbankcount16,
.sea_islands,
}),
};
pub const oland = CpuModel{
.name = "oland",
.llvm_name = "oland",
.features = featureSet(&[_]Feature{
.southern_islands,
}),
};
pub const pitcairn = CpuModel{
.name = "pitcairn",
.llvm_name = "pitcairn",
.features = featureSet(&[_]Feature{
.southern_islands,
}),
};
pub const polaris10 = CpuModel{
.name = "polaris10",
.llvm_name = "polaris10",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const polaris11 = CpuModel{
.name = "polaris11",
.llvm_name = "polaris11",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const stoney = CpuModel{
.name = "stoney",
.llvm_name = "stoney",
.features = featureSet(&[_]Feature{
.image_gather4_d16_bug,
.image_store_d16_bug,
.ldsbankcount16,
.volcanic_islands,
.xnack_support,
}),
};
pub const tahiti = CpuModel{
.name = "tahiti",
.llvm_name = "tahiti",
.features = featureSet(&[_]Feature{
.fast_fmaf,
.half_rate_64_ops,
.southern_islands,
}),
};
pub const tonga = CpuModel{
.name = "tonga",
.llvm_name = "tonga",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sgpr_init_bug,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const tongapro = CpuModel{
.name = "tongapro",
.llvm_name = "tongapro",
.features = featureSet(&[_]Feature{
.ldsbankcount32,
.sgpr_init_bug,
.unpacked_d16_vmem,
.volcanic_islands,
}),
};
pub const verde = CpuModel{
.name = "verde",
.llvm_name = "verde",
.features = featureSet(&[_]Feature{
.southern_islands,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/msp430.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
ext,
hwmult16,
hwmult32,
hwmultf5,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.ext)] = .{
.llvm_name = "ext",
.description = "Enable MSP430-X extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hwmult16)] = .{
.llvm_name = "hwmult16",
.description = "Enable 16-bit hardware multiplier",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hwmult32)] = .{
.llvm_name = "hwmult32",
.description = "Enable 32-bit hardware multiplier",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hwmultf5)] = .{
.llvm_name = "hwmultf5",
.description = "Enable F5 series hardware multiplier",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
pub const msp430 = CpuModel{
.name = "msp430",
.llvm_name = "msp430",
.features = featureSet(&[_]Feature{}),
};
pub const msp430x = CpuModel{
.name = "msp430x",
.llvm_name = "msp430x",
.features = featureSet(&[_]Feature{
.ext,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/arm.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
@"32bit",
@"8msecext",
a76,
aclass,
acquire_release,
aes,
avoid_movs_shop,
avoid_partial_cpsr,
bf16,
cde,
cdecp0,
cdecp1,
cdecp2,
cdecp3,
cdecp4,
cdecp5,
cdecp6,
cdecp7,
cheap_predicable_cpsr,
crc,
crypto,
d32,
db,
dfb,
disable_postra_scheduler,
dont_widen_vmovs,
dotprod,
dsp,
execute_only,
expand_fp_mlx,
exynos,
fp16,
fp16fml,
fp64,
fp_armv8,
fp_armv8d16,
fp_armv8d16sp,
fp_armv8sp,
fpao,
fpregs,
fpregs16,
fpregs64,
fullfp16,
fuse_aes,
fuse_literals,
harden_sls_blr,
harden_sls_nocomdat,
harden_sls_retbr,
has_v4t,
has_v5t,
has_v5te,
has_v6,
has_v6k,
has_v6m,
has_v6t2,
has_v7,
has_v7clrex,
has_v8,
has_v8_1a,
has_v8_1m_main,
has_v8_2a,
has_v8_3a,
has_v8_4a,
has_v8_5a,
has_v8_6a,
has_v8_7a,
has_v8m,
has_v8m_main,
hwdiv,
hwdiv_arm,
i8mm,
iwmmxt,
iwmmxt2,
lob,
long_calls,
loop_align,
m3,
mclass,
mp,
muxed_units,
mve,
mve1beat,
mve2beat,
mve4beat,
mve_fp,
nacl_trap,
neon,
neon_fpmovs,
neonfp,
no_branch_predictor,
no_movt,
no_neg_immediates,
noarm,
nonpipelined_vfp,
perfmon,
prefer_ishst,
prefer_vmovsr,
prof_unpr,
r4,
ras,
rclass,
read_tp_hard,
reserve_r9,
ret_addr_stack,
sb,
sha2,
slow_fp_brcc,
slow_load_D_subreg,
slow_odd_reg,
slow_vdup32,
slow_vgetlni32,
slowfpvfmx,
slowfpvmlx,
soft_float,
splat_vfp_neon,
strict_align,
swift,
thumb2,
thumb_mode,
trustzone,
use_misched,
v2,
v2a,
v3,
v3m,
v4,
v4t,
v5t,
v5te,
v5tej,
v6,
v6j,
v6k,
v6kz,
v6m,
v6sm,
v6t2,
v7a,
v7em,
v7k,
v7m,
v7r,
v7s,
v7ve,
v8_1a,
v8_1m_main,
v8_2a,
v8_3a,
v8_4a,
v8_5a,
v8_6a,
v8_7a,
v8a,
v8m,
v8m_main,
v8r,
vfp2,
vfp2sp,
vfp3,
vfp3d16,
vfp3d16sp,
vfp3sp,
vfp4,
vfp4d16,
vfp4d16sp,
vfp4sp,
virtualization,
vldn_align,
vmlx_forwarding,
vmlx_hazards,
wide_stride_vfp,
xscale,
zcz,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(10000);
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"32bit")] = .{
.llvm_name = "32bit",
.description = "Prefer 32-bit Thumb instrs",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.@"8msecext")] = .{
.llvm_name = "8msecext",
.description = "Enable support for ARMv8-M Security Extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.a76)] = .{
.llvm_name = "a76",
.description = "Cortex-A76 ARM processors",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.aclass)] = .{
.llvm_name = "aclass",
.description = "Is application profile ('A' series)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.acquire_release)] = .{
.llvm_name = "acquire-release",
.description = "Has v8 acquire/release (lda/ldaex etc) instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.aes)] = .{
.llvm_name = "aes",
.description = "Enable AES support",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.avoid_movs_shop)] = .{
.llvm_name = "avoid-movs-shop",
.description = "Avoid movs instructions with shifter operand",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.avoid_partial_cpsr)] = .{
.llvm_name = "avoid-partial-cpsr",
.description = "Avoid CPSR partial update for OOO execution",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.bf16)] = .{
.llvm_name = "bf16",
.description = "Enable support for BFloat16 instructions",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.cde)] = .{
.llvm_name = "cde",
.description = "Support CDE instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8m_main,
}),
};
result[@intFromEnum(Feature.cdecp0)] = .{
.llvm_name = "cdecp0",
.description = "Coprocessor 0 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp1)] = .{
.llvm_name = "cdecp1",
.description = "Coprocessor 1 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp2)] = .{
.llvm_name = "cdecp2",
.description = "Coprocessor 2 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp3)] = .{
.llvm_name = "cdecp3",
.description = "Coprocessor 3 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp4)] = .{
.llvm_name = "cdecp4",
.description = "Coprocessor 4 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp5)] = .{
.llvm_name = "cdecp5",
.description = "Coprocessor 5 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp6)] = .{
.llvm_name = "cdecp6",
.description = "Coprocessor 6 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cdecp7)] = .{
.llvm_name = "cdecp7",
.description = "Coprocessor 7 ISA is CDEv1",
.dependencies = featureSet(&[_]Feature{
.cde,
}),
};
result[@intFromEnum(Feature.cheap_predicable_cpsr)] = .{
.llvm_name = "cheap-predicable-cpsr",
.description = "Disable +1 predication cost for instructions updating CPSR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.crc)] = .{
.llvm_name = "crc",
.description = "Enable support for CRC instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.crypto)] = .{
.llvm_name = "crypto",
.description = "Enable support for Cryptography extensions",
.dependencies = featureSet(&[_]Feature{
.aes,
.sha2,
}),
};
result[@intFromEnum(Feature.d32)] = .{
.llvm_name = "d32",
.description = "Extend FP to 32 double registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.db)] = .{
.llvm_name = "db",
.description = "Has data barrier (dmb/dsb) instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dfb)] = .{
.llvm_name = "dfb",
.description = "Has full data barrier (dfb) instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.disable_postra_scheduler)] = .{
.llvm_name = "disable-postra-scheduler",
.description = "Don't schedule again after register allocation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dont_widen_vmovs)] = .{
.llvm_name = "dont-widen-vmovs",
.description = "Don't widen VMOVS to VMOVD",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dotprod)] = .{
.llvm_name = "dotprod",
.description = "Enable support for dot product instructions",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.dsp)] = .{
.llvm_name = "dsp",
.description = "Supports DSP instructions in ARM and/or Thumb2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.execute_only)] = .{
.llvm_name = "execute-only",
.description = "Enable the generation of execute only code.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.expand_fp_mlx)] = .{
.llvm_name = "expand-fp-mlx",
.description = "Expand VFP/NEON MLA/MLS instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.exynos)] = .{
.llvm_name = "exynos",
.description = "Samsung Exynos processors",
.dependencies = featureSet(&[_]Feature{
.crc,
.crypto,
.expand_fp_mlx,
.fuse_aes,
.fuse_literals,
.hwdiv,
.hwdiv_arm,
.prof_unpr,
.ret_addr_stack,
.slow_fp_brcc,
.slow_vdup32,
.slow_vgetlni32,
.slowfpvfmx,
.slowfpvmlx,
.splat_vfp_neon,
.wide_stride_vfp,
.zcz,
}),
};
result[@intFromEnum(Feature.fp16)] = .{
.llvm_name = "fp16",
.description = "Enable half-precision floating point",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fp16fml)] = .{
.llvm_name = "fp16fml",
.description = "Enable full half-precision floating point fml instructions",
.dependencies = featureSet(&[_]Feature{
.fullfp16,
}),
};
result[@intFromEnum(Feature.fp64)] = .{
.llvm_name = "fp64",
.description = "Floating point unit supports double precision",
.dependencies = featureSet(&[_]Feature{
.fpregs64,
}),
};
result[@intFromEnum(Feature.fp_armv8)] = .{
.llvm_name = "fp-armv8",
.description = "Enable ARMv8 FP",
.dependencies = featureSet(&[_]Feature{
.fp_armv8d16,
.fp_armv8sp,
.vfp4,
}),
};
result[@intFromEnum(Feature.fp_armv8d16)] = .{
.llvm_name = "fp-armv8d16",
.description = "Enable ARMv8 FP with only 16 d-registers",
.dependencies = featureSet(&[_]Feature{
.fp_armv8d16sp,
.vfp4d16,
}),
};
result[@intFromEnum(Feature.fp_armv8d16sp)] = .{
.llvm_name = "fp-armv8d16sp",
.description = "Enable ARMv8 FP with only 16 d-registers and no double precision",
.dependencies = featureSet(&[_]Feature{
.vfp4d16sp,
}),
};
result[@intFromEnum(Feature.fp_armv8sp)] = .{
.llvm_name = "fp-armv8sp",
.description = "Enable ARMv8 FP with no double precision",
.dependencies = featureSet(&[_]Feature{
.fp_armv8d16sp,
.vfp4sp,
}),
};
result[@intFromEnum(Feature.fpao)] = .{
.llvm_name = "fpao",
.description = "Enable fast computation of positive address offsets",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fpregs)] = .{
.llvm_name = "fpregs",
.description = "Enable FP registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fpregs16)] = .{
.llvm_name = "fpregs16",
.description = "Enable 16-bit FP registers",
.dependencies = featureSet(&[_]Feature{
.fpregs,
}),
};
result[@intFromEnum(Feature.fpregs64)] = .{
.llvm_name = "fpregs64",
.description = "Enable 64-bit FP registers",
.dependencies = featureSet(&[_]Feature{
.fpregs,
}),
};
result[@intFromEnum(Feature.fullfp16)] = .{
.llvm_name = "fullfp16",
.description = "Enable full half-precision floating point",
.dependencies = featureSet(&[_]Feature{
.fp_armv8d16sp,
.fpregs16,
}),
};
result[@intFromEnum(Feature.fuse_aes)] = .{
.llvm_name = "fuse-aes",
.description = "CPU fuses AES crypto operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fuse_literals)] = .{
.llvm_name = "fuse-literals",
.description = "CPU fuses literal generation operations",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.harden_sls_blr)] = .{
.llvm_name = "harden-sls-blr",
.description = "Harden against straight line speculation across indirect calls",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.harden_sls_nocomdat)] = .{
.llvm_name = "harden-sls-nocomdat",
.description = "Generate thunk code for SLS mitigation in the normal text section",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.harden_sls_retbr)] = .{
.llvm_name = "harden-sls-retbr",
.description = "Harden against straight line speculation across RETurn and BranchRegister instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.has_v4t)] = .{
.llvm_name = "v4t",
.description = "Support ARM v4T instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.has_v5t)] = .{
.llvm_name = "v5t",
.description = "Support ARM v5T instructions",
.dependencies = featureSet(&[_]Feature{
.has_v4t,
}),
};
result[@intFromEnum(Feature.has_v5te)] = .{
.llvm_name = "v5te",
.description = "Support ARM v5TE, v5TEj, and v5TExp instructions",
.dependencies = featureSet(&[_]Feature{
.has_v5t,
}),
};
result[@intFromEnum(Feature.has_v6)] = .{
.llvm_name = "v6",
.description = "Support ARM v6 instructions",
.dependencies = featureSet(&[_]Feature{
.has_v5te,
}),
};
result[@intFromEnum(Feature.has_v6k)] = .{
.llvm_name = "v6k",
.description = "Support ARM v6k instructions",
.dependencies = featureSet(&[_]Feature{
.has_v6,
}),
};
result[@intFromEnum(Feature.has_v6m)] = .{
.llvm_name = "v6m",
.description = "Support ARM v6M instructions",
.dependencies = featureSet(&[_]Feature{
.has_v6,
}),
};
result[@intFromEnum(Feature.has_v6t2)] = .{
.llvm_name = "v6t2",
.description = "Support ARM v6t2 instructions",
.dependencies = featureSet(&[_]Feature{
.has_v6k,
.has_v8m,
.thumb2,
}),
};
result[@intFromEnum(Feature.has_v7)] = .{
.llvm_name = "v7",
.description = "Support ARM v7 instructions",
.dependencies = featureSet(&[_]Feature{
.has_v6t2,
.has_v7clrex,
.perfmon,
}),
};
result[@intFromEnum(Feature.has_v7clrex)] = .{
.llvm_name = "v7clrex",
.description = "Has v7 clrex instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.has_v8)] = .{
.llvm_name = "v8",
.description = "Support ARM v8 instructions",
.dependencies = featureSet(&[_]Feature{
.acquire_release,
.has_v7,
}),
};
result[@intFromEnum(Feature.has_v8_1a)] = .{
.llvm_name = "v8.1a",
.description = "Support ARM v8.1a instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8,
}),
};
result[@intFromEnum(Feature.has_v8_1m_main)] = .{
.llvm_name = "v8.1m.main",
.description = "Support ARM v8-1M Mainline instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8m_main,
}),
};
result[@intFromEnum(Feature.has_v8_2a)] = .{
.llvm_name = "v8.2a",
.description = "Support ARM v8.2a instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8_1a,
}),
};
result[@intFromEnum(Feature.has_v8_3a)] = .{
.llvm_name = "v8.3a",
.description = "Support ARM v8.3a instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8_2a,
}),
};
result[@intFromEnum(Feature.has_v8_4a)] = .{
.llvm_name = "v8.4a",
.description = "Support ARM v8.4a instructions",
.dependencies = featureSet(&[_]Feature{
.dotprod,
.has_v8_3a,
}),
};
result[@intFromEnum(Feature.has_v8_5a)] = .{
.llvm_name = "v8.5a",
.description = "Support ARM v8.5a instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8_4a,
.sb,
}),
};
result[@intFromEnum(Feature.has_v8_6a)] = .{
.llvm_name = "v8.6a",
.description = "Support ARM v8.6a instructions",
.dependencies = featureSet(&[_]Feature{
.bf16,
.has_v8_5a,
.i8mm,
}),
};
result[@intFromEnum(Feature.has_v8_7a)] = .{
.llvm_name = "v8.7a",
.description = "Support ARM v8.7a instructions",
.dependencies = featureSet(&[_]Feature{
.has_v8_6a,
}),
};
result[@intFromEnum(Feature.has_v8m)] = .{
.llvm_name = "v8m",
.description = "Support ARM v8M Baseline instructions",
.dependencies = featureSet(&[_]Feature{
.has_v6m,
}),
};
result[@intFromEnum(Feature.has_v8m_main)] = .{
.llvm_name = "v8m.main",
.description = "Support ARM v8M Mainline instructions",
.dependencies = featureSet(&[_]Feature{
.has_v7,
}),
};
result[@intFromEnum(Feature.hwdiv)] = .{
.llvm_name = "hwdiv",
.description = "Enable divide instructions in Thumb",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hwdiv_arm)] = .{
.llvm_name = "hwdiv-arm",
.description = "Enable divide instructions in ARM mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.i8mm)] = .{
.llvm_name = "i8mm",
.description = "Enable Matrix Multiply Int8 Extension",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.iwmmxt)] = .{
.llvm_name = "iwmmxt",
.description = "ARMv5te architecture",
.dependencies = featureSet(&[_]Feature{
.v5te,
}),
};
result[@intFromEnum(Feature.iwmmxt2)] = .{
.llvm_name = "iwmmxt2",
.description = "ARMv5te architecture",
.dependencies = featureSet(&[_]Feature{
.v5te,
}),
};
result[@intFromEnum(Feature.lob)] = .{
.llvm_name = "lob",
.description = "Enable Low Overhead Branch extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.long_calls)] = .{
.llvm_name = "long-calls",
.description = "Generate calls via indirect call instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.loop_align)] = .{
.llvm_name = "loop-align",
.description = "Prefer 32-bit alignment for loops",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.m3)] = .{
.llvm_name = "m3",
.description = "Cortex-M3 ARM processors",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mclass)] = .{
.llvm_name = "mclass",
.description = "Is microcontroller profile ('M' series)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mp)] = .{
.llvm_name = "mp",
.description = "Supports Multiprocessing extension",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.muxed_units)] = .{
.llvm_name = "muxed-units",
.description = "Has muxed AGU and NEON/FPU",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mve)] = .{
.llvm_name = "mve",
.description = "Support M-Class Vector Extension with integer ops",
.dependencies = featureSet(&[_]Feature{
.dsp,
.fpregs16,
.fpregs64,
.has_v8_1m_main,
}),
};
result[@intFromEnum(Feature.mve1beat)] = .{
.llvm_name = "mve1beat",
.description = "Model MVE instructions as a 1 beat per tick architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mve2beat)] = .{
.llvm_name = "mve2beat",
.description = "Model MVE instructions as a 2 beats per tick architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mve4beat)] = .{
.llvm_name = "mve4beat",
.description = "Model MVE instructions as a 4 beats per tick architecture",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mve_fp)] = .{
.llvm_name = "mve.fp",
.description = "Support M-Class Vector Extension with integer and floating ops",
.dependencies = featureSet(&[_]Feature{
.fullfp16,
.mve,
}),
};
result[@intFromEnum(Feature.nacl_trap)] = .{
.llvm_name = "nacl-trap",
.description = "NaCl trap",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.neon)] = .{
.llvm_name = "neon",
.description = "Enable NEON instructions",
.dependencies = featureSet(&[_]Feature{
.vfp3,
}),
};
result[@intFromEnum(Feature.neon_fpmovs)] = .{
.llvm_name = "neon-fpmovs",
.description = "Convert VMOVSR, VMOVRS, VMOVS to NEON",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.neonfp)] = .{
.llvm_name = "neonfp",
.description = "Use NEON for single precision FP",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_branch_predictor)] = .{
.llvm_name = "no-branch-predictor",
.description = "Has no branch predictor",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_movt)] = .{
.llvm_name = "no-movt",
.description = "Don't use movt/movw pairs for 32-bit imms",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_neg_immediates)] = .{
.llvm_name = "no-neg-immediates",
.description = "Convert immediates and instructions to their negated or complemented equivalent when the immediate does not fit in the encoding.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.noarm)] = .{
.llvm_name = "noarm",
.description = "Does not support ARM mode execution",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nonpipelined_vfp)] = .{
.llvm_name = "nonpipelined-vfp",
.description = "VFP instructions are not pipelined",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.perfmon)] = .{
.llvm_name = "perfmon",
.description = "Enable support for Performance Monitor extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefer_ishst)] = .{
.llvm_name = "prefer-ishst",
.description = "Prefer ISHST barriers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefer_vmovsr)] = .{
.llvm_name = "prefer-vmovsr",
.description = "Prefer VMOVSR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prof_unpr)] = .{
.llvm_name = "prof-unpr",
.description = "Is profitable to unpredicate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.r4)] = .{
.llvm_name = "r4",
.description = "Cortex-R4 ARM processors",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ras)] = .{
.llvm_name = "ras",
.description = "Enable Reliability, Availability and Serviceability extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rclass)] = .{
.llvm_name = "rclass",
.description = "Is realtime profile ('R' series)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.read_tp_hard)] = .{
.llvm_name = "read-tp-hard",
.description = "Reading thread pointer from register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_r9)] = .{
.llvm_name = "reserve-r9",
.description = "Reserve R9, making it unavailable as GPR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ret_addr_stack)] = .{
.llvm_name = "ret-addr-stack",
.description = "Has return address stack",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sb)] = .{
.llvm_name = "sb",
.description = "Enable v8.5a Speculation Barrier",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sha2)] = .{
.llvm_name = "sha2",
.description = "Enable SHA1 and SHA256 support",
.dependencies = featureSet(&[_]Feature{
.neon,
}),
};
result[@intFromEnum(Feature.slow_fp_brcc)] = .{
.llvm_name = "slow-fp-brcc",
.description = "FP compare + branch is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_load_D_subreg)] = .{
.llvm_name = "slow-load-D-subreg",
.description = "Loading into D subregs is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_odd_reg)] = .{
.llvm_name = "slow-odd-reg",
.description = "VLDM/VSTM starting with an odd register is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_vdup32)] = .{
.llvm_name = "slow-vdup32",
.description = "Has slow VDUP32 - prefer VMOV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_vgetlni32)] = .{
.llvm_name = "slow-vgetlni32",
.description = "Has slow VGETLNi32 - prefer VMOV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slowfpvfmx)] = .{
.llvm_name = "slowfpvfmx",
.description = "Disable VFP / NEON FMA instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slowfpvmlx)] = .{
.llvm_name = "slowfpvmlx",
.description = "Disable VFP / NEON MAC instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.soft_float)] = .{
.llvm_name = "soft-float",
.description = "Use software floating point features.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.splat_vfp_neon)] = .{
.llvm_name = "splat-vfp-neon",
.description = "Splat register from VFP to NEON",
.dependencies = featureSet(&[_]Feature{
.dont_widen_vmovs,
}),
};
result[@intFromEnum(Feature.strict_align)] = .{
.llvm_name = "strict-align",
.description = "Disallow all unaligned memory access",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.swift)] = .{
.llvm_name = "swift",
.description = "Swift ARM processors",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.thumb2)] = .{
.llvm_name = "thumb2",
.description = "Enable Thumb2 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.thumb_mode)] = .{
.llvm_name = "thumb-mode",
.description = "Thumb mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.trustzone)] = .{
.llvm_name = "trustzone",
.description = "Enable support for TrustZone security extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_misched)] = .{
.llvm_name = "use-misched",
.description = "Use the MachineScheduler",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v2)] = .{
.llvm_name = "armv2",
.description = "ARMv2 architecture",
.dependencies = featureSet(&[_]Feature{
.strict_align,
}),
};
result[@intFromEnum(Feature.v2a)] = .{
.llvm_name = "armv2a",
.description = "ARMv2a architecture",
.dependencies = featureSet(&[_]Feature{
.strict_align,
}),
};
result[@intFromEnum(Feature.v3)] = .{
.llvm_name = "armv3",
.description = "ARMv3 architecture",
.dependencies = featureSet(&[_]Feature{
.strict_align,
}),
};
result[@intFromEnum(Feature.v3m)] = .{
.llvm_name = "armv3m",
.description = "ARMv3m architecture",
.dependencies = featureSet(&[_]Feature{
.strict_align,
}),
};
result[@intFromEnum(Feature.v4)] = .{
.llvm_name = "armv4",
.description = "ARMv4 architecture",
.dependencies = featureSet(&[_]Feature{
.strict_align,
}),
};
result[@intFromEnum(Feature.v4t)] = .{
.llvm_name = "armv4t",
.description = "ARMv4t architecture",
.dependencies = featureSet(&[_]Feature{
.has_v4t,
.strict_align,
}),
};
result[@intFromEnum(Feature.v5t)] = .{
.llvm_name = "armv5t",
.description = "ARMv5t architecture",
.dependencies = featureSet(&[_]Feature{
.has_v5t,
.strict_align,
}),
};
result[@intFromEnum(Feature.v5te)] = .{
.llvm_name = "armv5te",
.description = "ARMv5te architecture",
.dependencies = featureSet(&[_]Feature{
.has_v5te,
.strict_align,
}),
};
result[@intFromEnum(Feature.v5tej)] = .{
.llvm_name = "armv5tej",
.description = "ARMv5tej architecture",
.dependencies = featureSet(&[_]Feature{
.has_v5te,
.strict_align,
}),
};
result[@intFromEnum(Feature.v6)] = .{
.llvm_name = "armv6",
.description = "ARMv6 architecture",
.dependencies = featureSet(&[_]Feature{
.dsp,
.has_v6,
}),
};
result[@intFromEnum(Feature.v6j)] = .{
.llvm_name = "armv6j",
.description = "ARMv7a architecture",
.dependencies = featureSet(&[_]Feature{
.v6,
}),
};
result[@intFromEnum(Feature.v6k)] = .{
.llvm_name = "armv6k",
.description = "ARMv6k architecture",
.dependencies = featureSet(&[_]Feature{
.has_v6k,
}),
};
result[@intFromEnum(Feature.v6kz)] = .{
.llvm_name = "armv6kz",
.description = "ARMv6kz architecture",
.dependencies = featureSet(&[_]Feature{
.has_v6k,
.trustzone,
}),
};
result[@intFromEnum(Feature.v6m)] = .{
.llvm_name = "armv6-m",
.description = "ARMv6m architecture",
.dependencies = featureSet(&[_]Feature{
.db,
.has_v6m,
.mclass,
.noarm,
.strict_align,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v6sm)] = .{
.llvm_name = "armv6s-m",
.description = "ARMv6sm architecture",
.dependencies = featureSet(&[_]Feature{
.db,
.has_v6m,
.mclass,
.noarm,
.strict_align,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v6t2)] = .{
.llvm_name = "armv6t2",
.description = "ARMv6t2 architecture",
.dependencies = featureSet(&[_]Feature{
.dsp,
.has_v6t2,
}),
};
result[@intFromEnum(Feature.v7a)] = .{
.llvm_name = "armv7-a",
.description = "ARMv7a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.db,
.dsp,
.has_v7,
.neon,
}),
};
result[@intFromEnum(Feature.v7em)] = .{
.llvm_name = "armv7e-m",
.description = "ARMv7em architecture",
.dependencies = featureSet(&[_]Feature{
.db,
.dsp,
.has_v7,
.hwdiv,
.mclass,
.noarm,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v7k)] = .{
.llvm_name = "armv7k",
.description = "ARMv7a architecture",
.dependencies = featureSet(&[_]Feature{
.v7a,
}),
};
result[@intFromEnum(Feature.v7m)] = .{
.llvm_name = "armv7-m",
.description = "ARMv7m architecture",
.dependencies = featureSet(&[_]Feature{
.db,
.has_v7,
.hwdiv,
.mclass,
.noarm,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v7r)] = .{
.llvm_name = "armv7-r",
.description = "ARMv7r architecture",
.dependencies = featureSet(&[_]Feature{
.db,
.dsp,
.has_v7,
.hwdiv,
.rclass,
}),
};
result[@intFromEnum(Feature.v7s)] = .{
.llvm_name = "armv7s",
.description = "ARMv7a architecture",
.dependencies = featureSet(&[_]Feature{
.v7a,
}),
};
result[@intFromEnum(Feature.v7ve)] = .{
.llvm_name = "armv7ve",
.description = "ARMv7ve architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.db,
.dsp,
.has_v7,
.mp,
.neon,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_1a)] = .{
.llvm_name = "armv8.1-a",
.description = "ARMv81a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_1a,
.mp,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_1m_main)] = .{
.llvm_name = "armv8.1-m.main",
.description = "ARMv81mMainline architecture",
.dependencies = featureSet(&[_]Feature{
.@"8msecext",
.acquire_release,
.db,
.has_v8_1m_main,
.hwdiv,
.lob,
.mclass,
.noarm,
.ras,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v8_2a)] = .{
.llvm_name = "armv8.2-a",
.description = "ARMv82a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_2a,
.mp,
.ras,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_3a)] = .{
.llvm_name = "armv8.3-a",
.description = "ARMv83a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_3a,
.mp,
.ras,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_4a)] = .{
.llvm_name = "armv8.4-a",
.description = "ARMv84a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_4a,
.mp,
.ras,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_5a)] = .{
.llvm_name = "armv8.5-a",
.description = "ARMv85a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_5a,
.mp,
.ras,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_6a)] = .{
.llvm_name = "armv8.6-a",
.description = "ARMv86a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_6a,
.mp,
.ras,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8_7a)] = .{
.llvm_name = "armv8.7-a",
.description = "ARMv87a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8_7a,
.mp,
.ras,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8a)] = .{
.llvm_name = "armv8-a",
.description = "ARMv8a architecture",
.dependencies = featureSet(&[_]Feature{
.aclass,
.crc,
.crypto,
.db,
.dsp,
.fp_armv8,
.has_v8,
.mp,
.trustzone,
.virtualization,
}),
};
result[@intFromEnum(Feature.v8m)] = .{
.llvm_name = "armv8-m.base",
.description = "ARMv8mBaseline architecture",
.dependencies = featureSet(&[_]Feature{
.@"8msecext",
.acquire_release,
.db,
.has_v7clrex,
.has_v8m,
.hwdiv,
.mclass,
.noarm,
.strict_align,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v8m_main)] = .{
.llvm_name = "armv8-m.main",
.description = "ARMv8mMainline architecture",
.dependencies = featureSet(&[_]Feature{
.@"8msecext",
.acquire_release,
.db,
.has_v8m_main,
.hwdiv,
.mclass,
.noarm,
.thumb_mode,
}),
};
result[@intFromEnum(Feature.v8r)] = .{
.llvm_name = "armv8-r",
.description = "ARMv8r architecture",
.dependencies = featureSet(&[_]Feature{
.crc,
.db,
.dfb,
.dsp,
.fp_armv8,
.has_v8,
.mp,
.neon,
.rclass,
.virtualization,
}),
};
result[@intFromEnum(Feature.vfp2)] = .{
.llvm_name = "vfp2",
.description = "Enable VFP2 instructions",
.dependencies = featureSet(&[_]Feature{
.fp64,
.vfp2sp,
}),
};
result[@intFromEnum(Feature.vfp2sp)] = .{
.llvm_name = "vfp2sp",
.description = "Enable VFP2 instructions with no double precision",
.dependencies = featureSet(&[_]Feature{
.fpregs,
}),
};
result[@intFromEnum(Feature.vfp3)] = .{
.llvm_name = "vfp3",
.description = "Enable VFP3 instructions",
.dependencies = featureSet(&[_]Feature{
.vfp3d16,
.vfp3sp,
}),
};
result[@intFromEnum(Feature.vfp3d16)] = .{
.llvm_name = "vfp3d16",
.description = "Enable VFP3 instructions with only 16 d-registers",
.dependencies = featureSet(&[_]Feature{
.vfp2,
.vfp3d16sp,
}),
};
result[@intFromEnum(Feature.vfp3d16sp)] = .{
.llvm_name = "vfp3d16sp",
.description = "Enable VFP3 instructions with only 16 d-registers and no double precision",
.dependencies = featureSet(&[_]Feature{
.vfp2sp,
}),
};
result[@intFromEnum(Feature.vfp3sp)] = .{
.llvm_name = "vfp3sp",
.description = "Enable VFP3 instructions with no double precision",
.dependencies = featureSet(&[_]Feature{
.d32,
.vfp3d16sp,
}),
};
result[@intFromEnum(Feature.vfp4)] = .{
.llvm_name = "vfp4",
.description = "Enable VFP4 instructions",
.dependencies = featureSet(&[_]Feature{
.vfp3,
.vfp4d16,
.vfp4sp,
}),
};
result[@intFromEnum(Feature.vfp4d16)] = .{
.llvm_name = "vfp4d16",
.description = "Enable VFP4 instructions with only 16 d-registers",
.dependencies = featureSet(&[_]Feature{
.vfp3d16,
.vfp4d16sp,
}),
};
result[@intFromEnum(Feature.vfp4d16sp)] = .{
.llvm_name = "vfp4d16sp",
.description = "Enable VFP4 instructions with only 16 d-registers and no double precision",
.dependencies = featureSet(&[_]Feature{
.fp16,
.vfp3d16sp,
}),
};
result[@intFromEnum(Feature.vfp4sp)] = .{
.llvm_name = "vfp4sp",
.description = "Enable VFP4 instructions with no double precision",
.dependencies = featureSet(&[_]Feature{
.vfp3sp,
.vfp4d16sp,
}),
};
result[@intFromEnum(Feature.virtualization)] = .{
.llvm_name = "virtualization",
.description = "Supports Virtualization extension",
.dependencies = featureSet(&[_]Feature{
.hwdiv,
.hwdiv_arm,
}),
};
result[@intFromEnum(Feature.vldn_align)] = .{
.llvm_name = "vldn-align",
.description = "Check for VLDn unaligned access",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vmlx_forwarding)] = .{
.llvm_name = "vmlx-forwarding",
.description = "Has multiplier accumulator forwarding",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vmlx_hazards)] = .{
.llvm_name = "vmlx-hazards",
.description = "Has VMLx hazards",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.wide_stride_vfp)] = .{
.llvm_name = "wide-stride-vfp",
.description = "Use a wide stride when allocating VFP registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xscale)] = .{
.llvm_name = "xscale",
.description = "ARMv5te architecture",
.dependencies = featureSet(&[_]Feature{
.v5te,
}),
};
result[@intFromEnum(Feature.zcz)] = .{
.llvm_name = "zcz",
.description = "Has zero-cycle zeroing instructions",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const arm1020e = CpuModel{
.name = "arm1020e",
.llvm_name = "arm1020e",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm1020t = CpuModel{
.name = "arm1020t",
.llvm_name = "arm1020t",
.features = featureSet(&[_]Feature{
.v5t,
}),
};
pub const arm1022e = CpuModel{
.name = "arm1022e",
.llvm_name = "arm1022e",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm10e = CpuModel{
.name = "arm10e",
.llvm_name = "arm10e",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm10tdmi = CpuModel{
.name = "arm10tdmi",
.llvm_name = "arm10tdmi",
.features = featureSet(&[_]Feature{
.v5t,
}),
};
pub const arm1136j_s = CpuModel{
.name = "arm1136j_s",
.llvm_name = "arm1136j-s",
.features = featureSet(&[_]Feature{
.v6,
}),
};
pub const arm1136jf_s = CpuModel{
.name = "arm1136jf_s",
.llvm_name = "arm1136jf-s",
.features = featureSet(&[_]Feature{
.slowfpvmlx,
.v6,
.vfp2,
}),
};
pub const arm1156t2_s = CpuModel{
.name = "arm1156t2_s",
.llvm_name = "arm1156t2-s",
.features = featureSet(&[_]Feature{
.v6t2,
}),
};
pub const arm1156t2f_s = CpuModel{
.name = "arm1156t2f_s",
.llvm_name = "arm1156t2f-s",
.features = featureSet(&[_]Feature{
.slowfpvmlx,
.v6t2,
.vfp2,
}),
};
pub const arm1176jz_s = CpuModel{
.name = "arm1176jz_s",
.llvm_name = "arm1176jz-s",
.features = featureSet(&[_]Feature{
.v6kz,
}),
};
pub const arm1176jzf_s = CpuModel{
.name = "arm1176jzf_s",
.llvm_name = "arm1176jzf-s",
.features = featureSet(&[_]Feature{
.slowfpvmlx,
.v6kz,
.vfp2,
}),
};
pub const arm710t = CpuModel{
.name = "arm710t",
.llvm_name = "arm710t",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm720t = CpuModel{
.name = "arm720t",
.llvm_name = "arm720t",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm7tdmi = CpuModel{
.name = "arm7tdmi",
.llvm_name = "arm7tdmi",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm7tdmi_s = CpuModel{
.name = "arm7tdmi_s",
.llvm_name = "arm7tdmi-s",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm8 = CpuModel{
.name = "arm8",
.llvm_name = "arm8",
.features = featureSet(&[_]Feature{
.v4,
}),
};
pub const arm810 = CpuModel{
.name = "arm810",
.llvm_name = "arm810",
.features = featureSet(&[_]Feature{
.v4,
}),
};
pub const arm9 = CpuModel{
.name = "arm9",
.llvm_name = "arm9",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm920 = CpuModel{
.name = "arm920",
.llvm_name = "arm920",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm920t = CpuModel{
.name = "arm920t",
.llvm_name = "arm920t",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm922t = CpuModel{
.name = "arm922t",
.llvm_name = "arm922t",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm926ej_s = CpuModel{
.name = "arm926ej_s",
.llvm_name = "arm926ej-s",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm940t = CpuModel{
.name = "arm940t",
.llvm_name = "arm940t",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const arm946e_s = CpuModel{
.name = "arm946e_s",
.llvm_name = "arm946e-s",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm966e_s = CpuModel{
.name = "arm966e_s",
.llvm_name = "arm966e-s",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm968e_s = CpuModel{
.name = "arm968e_s",
.llvm_name = "arm968e-s",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm9e = CpuModel{
.name = "arm9e",
.llvm_name = "arm9e",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const arm9tdmi = CpuModel{
.name = "arm9tdmi",
.llvm_name = "arm9tdmi",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const baseline = CpuModel{
.name = "baseline",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.v7a,
}),
};
pub const cortex_a12 = CpuModel{
.name = "cortex_a12",
.llvm_name = "cortex-a12",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.mp,
.ret_addr_stack,
.trustzone,
.v7a,
.vfp4,
.virtualization,
.vmlx_forwarding,
}),
};
pub const cortex_a15 = CpuModel{
.name = "cortex_a15",
.llvm_name = "cortex-a15",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.mp,
.muxed_units,
.ret_addr_stack,
.splat_vfp_neon,
.trustzone,
.v7a,
.vfp4,
.virtualization,
.vldn_align,
}),
};
pub const cortex_a17 = CpuModel{
.name = "cortex_a17",
.llvm_name = "cortex-a17",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.mp,
.ret_addr_stack,
.trustzone,
.v7a,
.vfp4,
.virtualization,
.vmlx_forwarding,
}),
};
pub const cortex_a32 = CpuModel{
.name = "cortex_a32",
.llvm_name = "cortex-a32",
.features = featureSet(&[_]Feature{
.v8a,
}),
};
pub const cortex_a35 = CpuModel{
.name = "cortex_a35",
.llvm_name = "cortex-a35",
.features = featureSet(&[_]Feature{
.v8a,
}),
};
pub const cortex_a5 = CpuModel{
.name = "cortex_a5",
.llvm_name = "cortex-a5",
.features = featureSet(&[_]Feature{
.mp,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.trustzone,
.v7a,
.vfp4,
.vmlx_forwarding,
}),
};
pub const cortex_a53 = CpuModel{
.name = "cortex_a53",
.llvm_name = "cortex-a53",
.features = featureSet(&[_]Feature{
.fpao,
.v8a,
}),
};
pub const cortex_a55 = CpuModel{
.name = "cortex_a55",
.llvm_name = "cortex-a55",
.features = featureSet(&[_]Feature{
.dotprod,
.v8_2a,
}),
};
pub const cortex_a57 = CpuModel{
.name = "cortex_a57",
.llvm_name = "cortex-a57",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.cheap_predicable_cpsr,
.fpao,
.v8a,
}),
};
pub const cortex_a7 = CpuModel{
.name = "cortex_a7",
.llvm_name = "cortex-a7",
.features = featureSet(&[_]Feature{
.mp,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.trustzone,
.v7a,
.vfp4,
.virtualization,
.vmlx_forwarding,
.vmlx_hazards,
}),
};
pub const cortex_a72 = CpuModel{
.name = "cortex_a72",
.llvm_name = "cortex-a72",
.features = featureSet(&[_]Feature{
.v8a,
}),
};
pub const cortex_a73 = CpuModel{
.name = "cortex_a73",
.llvm_name = "cortex-a73",
.features = featureSet(&[_]Feature{
.v8a,
}),
};
pub const cortex_a75 = CpuModel{
.name = "cortex_a75",
.llvm_name = "cortex-a75",
.features = featureSet(&[_]Feature{
.dotprod,
.v8_2a,
}),
};
pub const cortex_a76 = CpuModel{
.name = "cortex_a76",
.llvm_name = "cortex-a76",
.features = featureSet(&[_]Feature{
.a76,
.dotprod,
.fullfp16,
.v8_2a,
}),
};
pub const cortex_a76ae = CpuModel{
.name = "cortex_a76ae",
.llvm_name = "cortex-a76ae",
.features = featureSet(&[_]Feature{
.a76,
.dotprod,
.fullfp16,
.v8_2a,
}),
};
pub const cortex_a77 = CpuModel{
.name = "cortex_a77",
.llvm_name = "cortex-a77",
.features = featureSet(&[_]Feature{
.dotprod,
.fullfp16,
.v8_2a,
}),
};
pub const cortex_a78 = CpuModel{
.name = "cortex_a78",
.llvm_name = "cortex-a78",
.features = featureSet(&[_]Feature{
.dotprod,
.fullfp16,
.v8_2a,
}),
};
pub const cortex_a78c = CpuModel{
.name = "cortex_a78c",
.llvm_name = "cortex-a78c",
.features = featureSet(&[_]Feature{
.dotprod,
.fullfp16,
.v8_2a,
}),
};
pub const cortex_a8 = CpuModel{
.name = "cortex_a8",
.llvm_name = "cortex-a8",
.features = featureSet(&[_]Feature{
.nonpipelined_vfp,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.trustzone,
.v7a,
.vmlx_forwarding,
.vmlx_hazards,
}),
};
pub const cortex_a9 = CpuModel{
.name = "cortex_a9",
.llvm_name = "cortex-a9",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.expand_fp_mlx,
.fp16,
.mp,
.muxed_units,
.neon_fpmovs,
.prefer_vmovsr,
.ret_addr_stack,
.trustzone,
.v7a,
.vldn_align,
.vmlx_forwarding,
.vmlx_hazards,
}),
};
pub const cortex_m0 = CpuModel{
.name = "cortex_m0",
.llvm_name = "cortex-m0",
.features = featureSet(&[_]Feature{
.no_branch_predictor,
.v6m,
}),
};
pub const cortex_m0plus = CpuModel{
.name = "cortex_m0plus",
.llvm_name = "cortex-m0plus",
.features = featureSet(&[_]Feature{
.no_branch_predictor,
.v6m,
}),
};
pub const cortex_m1 = CpuModel{
.name = "cortex_m1",
.llvm_name = "cortex-m1",
.features = featureSet(&[_]Feature{
.no_branch_predictor,
.v6m,
}),
};
pub const cortex_m23 = CpuModel{
.name = "cortex_m23",
.llvm_name = "cortex-m23",
.features = featureSet(&[_]Feature{
.no_branch_predictor,
.no_movt,
.v8m,
}),
};
pub const cortex_m3 = CpuModel{
.name = "cortex_m3",
.llvm_name = "cortex-m3",
.features = featureSet(&[_]Feature{
.loop_align,
.m3,
.no_branch_predictor,
.use_misched,
.v7m,
}),
};
pub const cortex_m33 = CpuModel{
.name = "cortex_m33",
.llvm_name = "cortex-m33",
.features = featureSet(&[_]Feature{
.dsp,
.fp_armv8d16sp,
.loop_align,
.no_branch_predictor,
.slowfpvfmx,
.slowfpvmlx,
.use_misched,
.v8m_main,
}),
};
pub const cortex_m35p = CpuModel{
.name = "cortex_m35p",
.llvm_name = "cortex-m35p",
.features = featureSet(&[_]Feature{
.dsp,
.fp_armv8d16sp,
.loop_align,
.no_branch_predictor,
.slowfpvfmx,
.slowfpvmlx,
.use_misched,
.v8m_main,
}),
};
pub const cortex_m4 = CpuModel{
.name = "cortex_m4",
.llvm_name = "cortex-m4",
.features = featureSet(&[_]Feature{
.loop_align,
.no_branch_predictor,
.slowfpvfmx,
.slowfpvmlx,
.use_misched,
.v7em,
.vfp4d16sp,
}),
};
pub const cortex_m55 = CpuModel{
.name = "cortex_m55",
.llvm_name = "cortex-m55",
.features = featureSet(&[_]Feature{
.fp_armv8d16,
.loop_align,
.mve_fp,
.no_branch_predictor,
.slowfpvmlx,
.use_misched,
.v8_1m_main,
}),
};
pub const cortex_m7 = CpuModel{
.name = "cortex_m7",
.llvm_name = "cortex-m7",
.features = featureSet(&[_]Feature{
.fp_armv8d16,
.use_misched,
.v7em,
}),
};
pub const cortex_r4 = CpuModel{
.name = "cortex_r4",
.llvm_name = "cortex-r4",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.r4,
.ret_addr_stack,
.v7r,
}),
};
pub const cortex_r4f = CpuModel{
.name = "cortex_r4f",
.llvm_name = "cortex-r4f",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.r4,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.v7r,
.vfp3d16,
}),
};
pub const cortex_r5 = CpuModel{
.name = "cortex_r5",
.llvm_name = "cortex-r5",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.hwdiv_arm,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.v7r,
.vfp3d16,
}),
};
pub const cortex_r52 = CpuModel{
.name = "cortex_r52",
.llvm_name = "cortex-r52",
.features = featureSet(&[_]Feature{
.fpao,
.use_misched,
.v8r,
}),
};
pub const cortex_r7 = CpuModel{
.name = "cortex_r7",
.llvm_name = "cortex-r7",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.fp16,
.hwdiv_arm,
.mp,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.v7r,
.vfp3d16,
}),
};
pub const cortex_r8 = CpuModel{
.name = "cortex_r8",
.llvm_name = "cortex-r8",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.fp16,
.hwdiv_arm,
.mp,
.ret_addr_stack,
.slow_fp_brcc,
.slowfpvfmx,
.slowfpvmlx,
.v7r,
.vfp3d16,
}),
};
pub const cortex_x1 = CpuModel{
.name = "cortex_x1",
.llvm_name = "cortex-x1",
.features = featureSet(&[_]Feature{
.dotprod,
.fullfp16,
.v8_2a,
}),
};
pub const cyclone = CpuModel{
.name = "cyclone",
.llvm_name = "cyclone",
.features = featureSet(&[_]Feature{
.avoid_movs_shop,
.avoid_partial_cpsr,
.disable_postra_scheduler,
.neonfp,
.ret_addr_stack,
.slowfpvfmx,
.slowfpvmlx,
.swift,
.use_misched,
.v8a,
.zcz,
}),
};
pub const ep9312 = CpuModel{
.name = "ep9312",
.llvm_name = "ep9312",
.features = featureSet(&[_]Feature{
.v4t,
}),
};
pub const exynos_m1 = CpuModel{
.name = "exynos_m1",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.exynos,
.v8a,
}),
};
pub const exynos_m2 = CpuModel{
.name = "exynos_m2",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.exynos,
.v8a,
}),
};
pub const exynos_m3 = CpuModel{
.name = "exynos_m3",
.llvm_name = "exynos-m3",
.features = featureSet(&[_]Feature{
.exynos,
.v8a,
}),
};
pub const exynos_m4 = CpuModel{
.name = "exynos_m4",
.llvm_name = "exynos-m4",
.features = featureSet(&[_]Feature{
.dotprod,
.exynos,
.fullfp16,
.v8_2a,
}),
};
pub const exynos_m5 = CpuModel{
.name = "exynos_m5",
.llvm_name = "exynos-m5",
.features = featureSet(&[_]Feature{
.dotprod,
.exynos,
.fullfp16,
.v8_2a,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
pub const iwmmxt = CpuModel{
.name = "iwmmxt",
.llvm_name = "iwmmxt",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
pub const krait = CpuModel{
.name = "krait",
.llvm_name = "krait",
.features = featureSet(&[_]Feature{
.avoid_partial_cpsr,
.hwdiv,
.hwdiv_arm,
.muxed_units,
.ret_addr_stack,
.v7a,
.vfp4,
.vldn_align,
.vmlx_forwarding,
}),
};
pub const kryo = CpuModel{
.name = "kryo",
.llvm_name = "kryo",
.features = featureSet(&[_]Feature{
.v8a,
}),
};
pub const mpcore = CpuModel{
.name = "mpcore",
.llvm_name = "mpcore",
.features = featureSet(&[_]Feature{
.slowfpvmlx,
.v6k,
.vfp2,
}),
};
pub const mpcorenovfp = CpuModel{
.name = "mpcorenovfp",
.llvm_name = "mpcorenovfp",
.features = featureSet(&[_]Feature{
.v6k,
}),
};
pub const neoverse_n1 = CpuModel{
.name = "neoverse_n1",
.llvm_name = "neoverse-n1",
.features = featureSet(&[_]Feature{
.dotprod,
.v8_2a,
}),
};
pub const neoverse_n2 = CpuModel{
.name = "neoverse_n2",
.llvm_name = "neoverse-n2",
.features = featureSet(&[_]Feature{
.bf16,
.i8mm,
.v8_5a,
}),
};
pub const neoverse_v1 = CpuModel{
.name = "neoverse_v1",
.llvm_name = "neoverse-v1",
.features = featureSet(&[_]Feature{
.bf16,
.fullfp16,
.i8mm,
.v8_4a,
}),
};
pub const sc000 = CpuModel{
.name = "sc000",
.llvm_name = "sc000",
.features = featureSet(&[_]Feature{
.no_branch_predictor,
.v6m,
}),
};
pub const sc300 = CpuModel{
.name = "sc300",
.llvm_name = "sc300",
.features = featureSet(&[_]Feature{
.m3,
.no_branch_predictor,
.use_misched,
.v7m,
}),
};
pub const strongarm = CpuModel{
.name = "strongarm",
.llvm_name = "strongarm",
.features = featureSet(&[_]Feature{
.v4,
}),
};
pub const strongarm110 = CpuModel{
.name = "strongarm110",
.llvm_name = "strongarm110",
.features = featureSet(&[_]Feature{
.v4,
}),
};
pub const strongarm1100 = CpuModel{
.name = "strongarm1100",
.llvm_name = "strongarm1100",
.features = featureSet(&[_]Feature{
.v4,
}),
};
pub const strongarm1110 = CpuModel{
.name = "strongarm1110",
.llvm_name = "strongarm1110",
.features = featureSet(&[_]Feature{
.v4,
}),
};
pub const swift = CpuModel{
.name = "swift",
.llvm_name = "swift",
.features = featureSet(&[_]Feature{
.avoid_movs_shop,
.avoid_partial_cpsr,
.disable_postra_scheduler,
.hwdiv,
.hwdiv_arm,
.mp,
.neonfp,
.prefer_ishst,
.prof_unpr,
.ret_addr_stack,
.slow_load_D_subreg,
.slow_odd_reg,
.slow_vdup32,
.slow_vgetlni32,
.slowfpvfmx,
.slowfpvmlx,
.swift,
.use_misched,
.v7a,
.vfp4,
.vmlx_hazards,
.wide_stride_vfp,
}),
};
pub const xscale = CpuModel{
.name = "xscale",
.llvm_name = "xscale",
.features = featureSet(&[_]Feature{
.v5te,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/arc.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
norm,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.norm)] = .{
.llvm_name = "norm",
.description = "Enable support for norm instruction.",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/nvptx.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
ptx32,
ptx40,
ptx41,
ptx42,
ptx43,
ptx50,
ptx60,
ptx61,
ptx63,
ptx64,
ptx65,
ptx70,
ptx71,
ptx72,
sm_20,
sm_21,
sm_30,
sm_32,
sm_35,
sm_37,
sm_50,
sm_52,
sm_53,
sm_60,
sm_61,
sm_62,
sm_70,
sm_72,
sm_75,
sm_80,
sm_86,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.ptx32)] = .{
.llvm_name = "ptx32",
.description = "Use PTX version 3.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx40)] = .{
.llvm_name = "ptx40",
.description = "Use PTX version 4.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx41)] = .{
.llvm_name = "ptx41",
.description = "Use PTX version 4.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx42)] = .{
.llvm_name = "ptx42",
.description = "Use PTX version 4.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx43)] = .{
.llvm_name = "ptx43",
.description = "Use PTX version 4.3",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx50)] = .{
.llvm_name = "ptx50",
.description = "Use PTX version 5.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx60)] = .{
.llvm_name = "ptx60",
.description = "Use PTX version 6.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx61)] = .{
.llvm_name = "ptx61",
.description = "Use PTX version 6.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx63)] = .{
.llvm_name = "ptx63",
.description = "Use PTX version 6.3",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx64)] = .{
.llvm_name = "ptx64",
.description = "Use PTX version 6.4",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx65)] = .{
.llvm_name = "ptx65",
.description = "Use PTX version 6.5",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx70)] = .{
.llvm_name = "ptx70",
.description = "Use PTX version 7.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx71)] = .{
.llvm_name = "ptx71",
.description = "Use PTX version 7.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptx72)] = .{
.llvm_name = "ptx72",
.description = "Use PTX version 7.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_20)] = .{
.llvm_name = "sm_20",
.description = "Target SM 2.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_21)] = .{
.llvm_name = "sm_21",
.description = "Target SM 2.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_30)] = .{
.llvm_name = "sm_30",
.description = "Target SM 3.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_32)] = .{
.llvm_name = "sm_32",
.description = "Target SM 3.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_35)] = .{
.llvm_name = "sm_35",
.description = "Target SM 3.5",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_37)] = .{
.llvm_name = "sm_37",
.description = "Target SM 3.7",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_50)] = .{
.llvm_name = "sm_50",
.description = "Target SM 5.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_52)] = .{
.llvm_name = "sm_52",
.description = "Target SM 5.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_53)] = .{
.llvm_name = "sm_53",
.description = "Target SM 5.3",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_60)] = .{
.llvm_name = "sm_60",
.description = "Target SM 6.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_61)] = .{
.llvm_name = "sm_61",
.description = "Target SM 6.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_62)] = .{
.llvm_name = "sm_62",
.description = "Target SM 6.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_70)] = .{
.llvm_name = "sm_70",
.description = "Target SM 7.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_72)] = .{
.llvm_name = "sm_72",
.description = "Target SM 7.2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_75)] = .{
.llvm_name = "sm_75",
.description = "Target SM 7.5",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_80)] = .{
.llvm_name = "sm_80",
.description = "Target SM 8.0",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sm_86)] = .{
.llvm_name = "sm_86",
.description = "Target SM 8.6",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const sm_20 = CpuModel{
.name = "sm_20",
.llvm_name = "sm_20",
.features = featureSet(&[_]Feature{
.sm_20,
}),
};
pub const sm_21 = CpuModel{
.name = "sm_21",
.llvm_name = "sm_21",
.features = featureSet(&[_]Feature{
.sm_21,
}),
};
pub const sm_30 = CpuModel{
.name = "sm_30",
.llvm_name = "sm_30",
.features = featureSet(&[_]Feature{
.sm_30,
}),
};
pub const sm_32 = CpuModel{
.name = "sm_32",
.llvm_name = "sm_32",
.features = featureSet(&[_]Feature{
.ptx40,
.sm_32,
}),
};
pub const sm_35 = CpuModel{
.name = "sm_35",
.llvm_name = "sm_35",
.features = featureSet(&[_]Feature{
.sm_35,
}),
};
pub const sm_37 = CpuModel{
.name = "sm_37",
.llvm_name = "sm_37",
.features = featureSet(&[_]Feature{
.ptx41,
.sm_37,
}),
};
pub const sm_50 = CpuModel{
.name = "sm_50",
.llvm_name = "sm_50",
.features = featureSet(&[_]Feature{
.ptx40,
.sm_50,
}),
};
pub const sm_52 = CpuModel{
.name = "sm_52",
.llvm_name = "sm_52",
.features = featureSet(&[_]Feature{
.ptx41,
.sm_52,
}),
};
pub const sm_53 = CpuModel{
.name = "sm_53",
.llvm_name = "sm_53",
.features = featureSet(&[_]Feature{
.ptx42,
.sm_53,
}),
};
pub const sm_60 = CpuModel{
.name = "sm_60",
.llvm_name = "sm_60",
.features = featureSet(&[_]Feature{
.ptx50,
.sm_60,
}),
};
pub const sm_61 = CpuModel{
.name = "sm_61",
.llvm_name = "sm_61",
.features = featureSet(&[_]Feature{
.ptx50,
.sm_61,
}),
};
pub const sm_62 = CpuModel{
.name = "sm_62",
.llvm_name = "sm_62",
.features = featureSet(&[_]Feature{
.ptx50,
.sm_62,
}),
};
pub const sm_70 = CpuModel{
.name = "sm_70",
.llvm_name = "sm_70",
.features = featureSet(&[_]Feature{
.ptx60,
.sm_70,
}),
};
pub const sm_72 = CpuModel{
.name = "sm_72",
.llvm_name = "sm_72",
.features = featureSet(&[_]Feature{
.ptx61,
.sm_72,
}),
};
pub const sm_75 = CpuModel{
.name = "sm_75",
.llvm_name = "sm_75",
.features = featureSet(&[_]Feature{
.ptx63,
.sm_75,
}),
};
pub const sm_80 = CpuModel{
.name = "sm_80",
.llvm_name = "sm_80",
.features = featureSet(&[_]Feature{
.ptx70,
.sm_80,
}),
};
pub const sm_86 = CpuModel{
.name = "sm_86",
.llvm_name = "sm_86",
.features = featureSet(&[_]Feature{
.ptx71,
.sm_86,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/sparc.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
deprecated_v8,
detectroundchange,
fixallfdivsqrt,
hard_quad_float,
hasleoncasa,
hasumacsmac,
insertnopload,
leon,
leoncyclecounter,
leonpwrpsr,
no_fmuls,
no_fsmuld,
popc,
soft_float,
soft_mul_div,
v9,
vis,
vis2,
vis3,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.deprecated_v8)] = .{
.llvm_name = "deprecated-v8",
.description = "Enable deprecated V8 instructions in V9 mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.detectroundchange)] = .{
.llvm_name = "detectroundchange",
.description = "LEON3 erratum detection: Detects any rounding mode change request: use only the round-to-nearest rounding mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fixallfdivsqrt)] = .{
.llvm_name = "fixallfdivsqrt",
.description = "LEON erratum fix: Fix FDIVS/FDIVD/FSQRTS/FSQRTD instructions with NOPs and floating-point store",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hard_quad_float)] = .{
.llvm_name = "hard-quad-float",
.description = "Enable quad-word floating point instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hasleoncasa)] = .{
.llvm_name = "hasleoncasa",
.description = "Enable CASA instruction for LEON3 and LEON4 processors",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hasumacsmac)] = .{
.llvm_name = "hasumacsmac",
.description = "Enable UMAC and SMAC for LEON3 and LEON4 processors",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.insertnopload)] = .{
.llvm_name = "insertnopload",
.description = "LEON3 erratum fix: Insert a NOP instruction after every single-cycle load instruction when the next instruction is another load/store instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.leon)] = .{
.llvm_name = "leon",
.description = "Enable LEON extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.leoncyclecounter)] = .{
.llvm_name = "leoncyclecounter",
.description = "Use the Leon cycle counter register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.leonpwrpsr)] = .{
.llvm_name = "leonpwrpsr",
.description = "Enable the PWRPSR instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_fmuls)] = .{
.llvm_name = "no-fmuls",
.description = "Disable the fmuls instruction.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_fsmuld)] = .{
.llvm_name = "no-fsmuld",
.description = "Disable the fsmuld instruction.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.popc)] = .{
.llvm_name = "popc",
.description = "Use the popc (population count) instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.soft_float)] = .{
.llvm_name = "soft-float",
.description = "Use software emulation for floating point",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.soft_mul_div)] = .{
.llvm_name = "soft-mul-div",
.description = "Use software emulation for integer multiply and divide",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v9)] = .{
.llvm_name = "v9",
.description = "Enable SPARC-V9 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vis)] = .{
.llvm_name = "vis",
.description = "Enable UltraSPARC Visual Instruction Set extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vis2)] = .{
.llvm_name = "vis2",
.description = "Enable Visual Instruction Set extensions II",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vis3)] = .{
.llvm_name = "vis3",
.description = "Enable Visual Instruction Set extensions III",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const at697e = CpuModel{
.name = "at697e",
.llvm_name = "at697e",
.features = featureSet(&[_]Feature{
.insertnopload,
.leon,
}),
};
pub const at697f = CpuModel{
.name = "at697f",
.llvm_name = "at697f",
.features = featureSet(&[_]Feature{
.insertnopload,
.leon,
}),
};
pub const f934 = CpuModel{
.name = "f934",
.llvm_name = "f934",
.features = featureSet(&[_]Feature{}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
pub const gr712rc = CpuModel{
.name = "gr712rc",
.llvm_name = "gr712rc",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const gr740 = CpuModel{
.name = "gr740",
.llvm_name = "gr740",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.hasumacsmac,
.leon,
.leoncyclecounter,
.leonpwrpsr,
}),
};
pub const hypersparc = CpuModel{
.name = "hypersparc",
.llvm_name = "hypersparc",
.features = featureSet(&[_]Feature{}),
};
pub const leon2 = CpuModel{
.name = "leon2",
.llvm_name = "leon2",
.features = featureSet(&[_]Feature{
.leon,
}),
};
pub const leon3 = CpuModel{
.name = "leon3",
.llvm_name = "leon3",
.features = featureSet(&[_]Feature{
.hasumacsmac,
.leon,
}),
};
pub const leon4 = CpuModel{
.name = "leon4",
.llvm_name = "leon4",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.hasumacsmac,
.leon,
}),
};
pub const ma2080 = CpuModel{
.name = "ma2080",
.llvm_name = "ma2080",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2085 = CpuModel{
.name = "ma2085",
.llvm_name = "ma2085",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2100 = CpuModel{
.name = "ma2100",
.llvm_name = "ma2100",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2150 = CpuModel{
.name = "ma2150",
.llvm_name = "ma2150",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2155 = CpuModel{
.name = "ma2155",
.llvm_name = "ma2155",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2450 = CpuModel{
.name = "ma2450",
.llvm_name = "ma2450",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2455 = CpuModel{
.name = "ma2455",
.llvm_name = "ma2455",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2480 = CpuModel{
.name = "ma2480",
.llvm_name = "ma2480",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2485 = CpuModel{
.name = "ma2485",
.llvm_name = "ma2485",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2x5x = CpuModel{
.name = "ma2x5x",
.llvm_name = "ma2x5x",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const ma2x8x = CpuModel{
.name = "ma2x8x",
.llvm_name = "ma2x8x",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const myriad2 = CpuModel{
.name = "myriad2",
.llvm_name = "myriad2",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const myriad2_1 = CpuModel{
.name = "myriad2_1",
.llvm_name = "myriad2.1",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const myriad2_2 = CpuModel{
.name = "myriad2_2",
.llvm_name = "myriad2.2",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const myriad2_3 = CpuModel{
.name = "myriad2_3",
.llvm_name = "myriad2.3",
.features = featureSet(&[_]Feature{
.hasleoncasa,
.leon,
}),
};
pub const niagara = CpuModel{
.name = "niagara",
.llvm_name = "niagara",
.features = featureSet(&[_]Feature{
.deprecated_v8,
.v9,
.vis,
.vis2,
}),
};
pub const niagara2 = CpuModel{
.name = "niagara2",
.llvm_name = "niagara2",
.features = featureSet(&[_]Feature{
.deprecated_v8,
.popc,
.v9,
.vis,
.vis2,
}),
};
pub const niagara3 = CpuModel{
.name = "niagara3",
.llvm_name = "niagara3",
.features = featureSet(&[_]Feature{
.deprecated_v8,
.popc,
.v9,
.vis,
.vis2,
}),
};
pub const niagara4 = CpuModel{
.name = "niagara4",
.llvm_name = "niagara4",
.features = featureSet(&[_]Feature{
.deprecated_v8,
.popc,
.v9,
.vis,
.vis2,
.vis3,
}),
};
pub const sparclet = CpuModel{
.name = "sparclet",
.llvm_name = "sparclet",
.features = featureSet(&[_]Feature{}),
};
pub const sparclite = CpuModel{
.name = "sparclite",
.llvm_name = "sparclite",
.features = featureSet(&[_]Feature{}),
};
pub const sparclite86x = CpuModel{
.name = "sparclite86x",
.llvm_name = "sparclite86x",
.features = featureSet(&[_]Feature{}),
};
pub const supersparc = CpuModel{
.name = "supersparc",
.llvm_name = "supersparc",
.features = featureSet(&[_]Feature{}),
};
pub const tsc701 = CpuModel{
.name = "tsc701",
.llvm_name = "tsc701",
.features = featureSet(&[_]Feature{}),
};
pub const ultrasparc = CpuModel{
.name = "ultrasparc",
.llvm_name = "ultrasparc",
.features = featureSet(&[_]Feature{
.deprecated_v8,
.v9,
.vis,
}),
};
pub const ultrasparc3 = CpuModel{
.name = "ultrasparc3",
.llvm_name = "ultrasparc3",
.features = featureSet(&[_]Feature{
.deprecated_v8,
.v9,
.vis,
.vis2,
}),
};
pub const ut699 = CpuModel{
.name = "ut699",
.llvm_name = "ut699",
.features = featureSet(&[_]Feature{
.fixallfdivsqrt,
.insertnopload,
.leon,
.no_fmuls,
.no_fsmuld,
}),
};
pub const v7 = CpuModel{
.name = "v7",
.llvm_name = "v7",
.features = featureSet(&[_]Feature{
.no_fsmuld,
.soft_mul_div,
}),
};
pub const v8 = CpuModel{
.name = "v8",
.llvm_name = "v8",
.features = featureSet(&[_]Feature{}),
};
pub const v9 = CpuModel{
.name = "v9",
.llvm_name = "v9",
.features = featureSet(&[_]Feature{
.v9,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/riscv.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
@"64bit",
a,
c,
d,
e,
experimental_b,
experimental_v,
experimental_zba,
experimental_zbb,
experimental_zbc,
experimental_zbe,
experimental_zbf,
experimental_zbm,
experimental_zbp,
experimental_zbproposedc,
experimental_zbr,
experimental_zbs,
experimental_zbt,
experimental_zfh,
experimental_zvamo,
experimental_zvlsseg,
f,
m,
no_rvc_hints,
relax,
reserve_x1,
reserve_x10,
reserve_x11,
reserve_x12,
reserve_x13,
reserve_x14,
reserve_x15,
reserve_x16,
reserve_x17,
reserve_x18,
reserve_x19,
reserve_x2,
reserve_x20,
reserve_x21,
reserve_x22,
reserve_x23,
reserve_x24,
reserve_x25,
reserve_x26,
reserve_x27,
reserve_x28,
reserve_x29,
reserve_x3,
reserve_x30,
reserve_x31,
reserve_x4,
reserve_x5,
reserve_x6,
reserve_x7,
reserve_x8,
reserve_x9,
save_restore,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"64bit")] = .{
.llvm_name = "64bit",
.description = "Implements RV64",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.a)] = .{
.llvm_name = "a",
.description = "'A' (Atomic Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.c)] = .{
.llvm_name = "c",
.description = "'C' (Compressed Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.d)] = .{
.llvm_name = "d",
.description = "'D' (Double-Precision Floating-Point)",
.dependencies = featureSet(&[_]Feature{
.f,
}),
};
result[@intFromEnum(Feature.e)] = .{
.llvm_name = "e",
.description = "Implements RV32E (provides 16 rather than 32 GPRs)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_b)] = .{
.llvm_name = "experimental-b",
.description = "'B' (Bit Manipulation Instructions)",
.dependencies = featureSet(&[_]Feature{
.experimental_zba,
.experimental_zbb,
.experimental_zbc,
.experimental_zbe,
.experimental_zbf,
.experimental_zbm,
.experimental_zbp,
.experimental_zbr,
.experimental_zbs,
.experimental_zbt,
}),
};
result[@intFromEnum(Feature.experimental_v)] = .{
.llvm_name = "experimental-v",
.description = "'V' (Vector Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zba)] = .{
.llvm_name = "experimental-zba",
.description = "'Zba' (Address calculation 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbb)] = .{
.llvm_name = "experimental-zbb",
.description = "'Zbb' (Base 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbc)] = .{
.llvm_name = "experimental-zbc",
.description = "'Zbc' (Carry-Less 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbe)] = .{
.llvm_name = "experimental-zbe",
.description = "'Zbe' (Extract-Deposit 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbf)] = .{
.llvm_name = "experimental-zbf",
.description = "'Zbf' (Bit-Field 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbm)] = .{
.llvm_name = "experimental-zbm",
.description = "'Zbm' (Matrix 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbp)] = .{
.llvm_name = "experimental-zbp",
.description = "'Zbp' (Permutation 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbproposedc)] = .{
.llvm_name = "experimental-zbproposedc",
.description = "'Zbproposedc' (Proposed Compressed 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbr)] = .{
.llvm_name = "experimental-zbr",
.description = "'Zbr' (Polynomial Reduction 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbs)] = .{
.llvm_name = "experimental-zbs",
.description = "'Zbs' (Single-Bit 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zbt)] = .{
.llvm_name = "experimental-zbt",
.description = "'Zbt' (Ternary 'B' Instructions)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.experimental_zfh)] = .{
.llvm_name = "experimental-zfh",
.description = "'Zfh' (Half-Precision Floating-Point)",
.dependencies = featureSet(&[_]Feature{
.f,
}),
};
result[@intFromEnum(Feature.experimental_zvamo)] = .{
.llvm_name = "experimental-zvamo",
.description = "'Zvamo' (Vector AMO Operations)",
.dependencies = featureSet(&[_]Feature{
.experimental_v,
}),
};
result[@intFromEnum(Feature.experimental_zvlsseg)] = .{
.llvm_name = "experimental-zvlsseg",
.description = "'Zvlsseg' (Vector segment load/store instructions)",
.dependencies = featureSet(&[_]Feature{
.experimental_v,
}),
};
result[@intFromEnum(Feature.f)] = .{
.llvm_name = "f",
.description = "'F' (Single-Precision Floating-Point)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.m)] = .{
.llvm_name = "m",
.description = "'M' (Integer Multiplication and Division)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.no_rvc_hints)] = .{
.llvm_name = "no-rvc-hints",
.description = "Disable RVC Hint Instructions.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.relax)] = .{
.llvm_name = "relax",
.description = "Enable Linker relaxation.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x1)] = .{
.llvm_name = "reserve-x1",
.description = "Reserve X1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x10)] = .{
.llvm_name = "reserve-x10",
.description = "Reserve X10",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x11)] = .{
.llvm_name = "reserve-x11",
.description = "Reserve X11",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x12)] = .{
.llvm_name = "reserve-x12",
.description = "Reserve X12",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x13)] = .{
.llvm_name = "reserve-x13",
.description = "Reserve X13",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x14)] = .{
.llvm_name = "reserve-x14",
.description = "Reserve X14",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x15)] = .{
.llvm_name = "reserve-x15",
.description = "Reserve X15",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x16)] = .{
.llvm_name = "reserve-x16",
.description = "Reserve X16",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x17)] = .{
.llvm_name = "reserve-x17",
.description = "Reserve X17",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x18)] = .{
.llvm_name = "reserve-x18",
.description = "Reserve X18",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x19)] = .{
.llvm_name = "reserve-x19",
.description = "Reserve X19",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x2)] = .{
.llvm_name = "reserve-x2",
.description = "Reserve X2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x20)] = .{
.llvm_name = "reserve-x20",
.description = "Reserve X20",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x21)] = .{
.llvm_name = "reserve-x21",
.description = "Reserve X21",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x22)] = .{
.llvm_name = "reserve-x22",
.description = "Reserve X22",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x23)] = .{
.llvm_name = "reserve-x23",
.description = "Reserve X23",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x24)] = .{
.llvm_name = "reserve-x24",
.description = "Reserve X24",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x25)] = .{
.llvm_name = "reserve-x25",
.description = "Reserve X25",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x26)] = .{
.llvm_name = "reserve-x26",
.description = "Reserve X26",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x27)] = .{
.llvm_name = "reserve-x27",
.description = "Reserve X27",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x28)] = .{
.llvm_name = "reserve-x28",
.description = "Reserve X28",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x29)] = .{
.llvm_name = "reserve-x29",
.description = "Reserve X29",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x3)] = .{
.llvm_name = "reserve-x3",
.description = "Reserve X3",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x30)] = .{
.llvm_name = "reserve-x30",
.description = "Reserve X30",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x31)] = .{
.llvm_name = "reserve-x31",
.description = "Reserve X31",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x4)] = .{
.llvm_name = "reserve-x4",
.description = "Reserve X4",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x5)] = .{
.llvm_name = "reserve-x5",
.description = "Reserve X5",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x6)] = .{
.llvm_name = "reserve-x6",
.description = "Reserve X6",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x7)] = .{
.llvm_name = "reserve-x7",
.description = "Reserve X7",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x8)] = .{
.llvm_name = "reserve-x8",
.description = "Reserve X8",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reserve_x9)] = .{
.llvm_name = "reserve-x9",
.description = "Reserve X9",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.save_restore)] = .{
.llvm_name = "save-restore",
.description = "Enable save/restore.",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const baseline_rv32 = CpuModel{
.name = "baseline_rv32",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.a,
.c,
.d,
.m,
}),
};
pub const baseline_rv64 = CpuModel{
.name = "baseline_rv64",
.llvm_name = null,
.features = featureSet(&[_]Feature{
.@"64bit",
.a,
.c,
.d,
.m,
}),
};
pub const generic_rv32 = CpuModel{
.name = "generic_rv32",
.llvm_name = "generic-rv32",
.features = featureSet(&[_]Feature{}),
};
pub const generic_rv64 = CpuModel{
.name = "generic_rv64",
.llvm_name = "generic-rv64",
.features = featureSet(&[_]Feature{
.@"64bit",
}),
};
pub const rocket_rv32 = CpuModel{
.name = "rocket_rv32",
.llvm_name = "rocket-rv32",
.features = featureSet(&[_]Feature{}),
};
pub const rocket_rv64 = CpuModel{
.name = "rocket_rv64",
.llvm_name = "rocket-rv64",
.features = featureSet(&[_]Feature{
.@"64bit",
}),
};
pub const sifive_7_rv32 = CpuModel{
.name = "sifive_7_rv32",
.llvm_name = "sifive-7-rv32",
.features = featureSet(&[_]Feature{}),
};
pub const sifive_7_rv64 = CpuModel{
.name = "sifive_7_rv64",
.llvm_name = "sifive-7-rv64",
.features = featureSet(&[_]Feature{
.@"64bit",
}),
};
pub const sifive_e31 = CpuModel{
.name = "sifive_e31",
.llvm_name = "sifive-e31",
.features = featureSet(&[_]Feature{
.a,
.c,
.m,
}),
};
pub const sifive_e76 = CpuModel{
.name = "sifive_e76",
.llvm_name = "sifive-e76",
.features = featureSet(&[_]Feature{
.a,
.c,
.f,
.m,
}),
};
pub const sifive_u54 = CpuModel{
.name = "sifive_u54",
.llvm_name = "sifive-u54",
.features = featureSet(&[_]Feature{
.@"64bit",
.a,
.c,
.d,
.m,
}),
};
pub const sifive_u74 = CpuModel{
.name = "sifive_u74",
.llvm_name = "sifive-u74",
.features = featureSet(&[_]Feature{
.@"64bit",
.a,
.c,
.d,
.m,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/mips.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
abs2008,
cnmips,
cnmipsp,
crc,
dsp,
dspr2,
dspr3,
eva,
fp64,
fpxx,
ginv,
gp64,
long_calls,
micromips,
mips1,
mips16,
mips2,
mips3,
mips32,
mips32r2,
mips32r3,
mips32r5,
mips32r6,
mips3_32,
mips3_32r2,
mips3d,
mips4,
mips4_32,
mips4_32r2,
mips5,
mips5_32r2,
mips64,
mips64r2,
mips64r3,
mips64r5,
mips64r6,
msa,
mt,
nan2008,
noabicalls,
nomadd4,
nooddspreg,
p5600,
ptr64,
single_float,
soft_float,
sym32,
use_indirect_jump_hazard,
use_tcc_in_div,
vfpu,
virt,
xgot,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.abs2008)] = .{
.llvm_name = "abs2008",
.description = "Disable IEEE 754-2008 abs.fmt mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cnmips)] = .{
.llvm_name = "cnmips",
.description = "Octeon cnMIPS Support",
.dependencies = featureSet(&[_]Feature{
.mips64r2,
}),
};
result[@intFromEnum(Feature.cnmipsp)] = .{
.llvm_name = "cnmipsp",
.description = "Octeon+ cnMIPS Support",
.dependencies = featureSet(&[_]Feature{
.cnmips,
}),
};
result[@intFromEnum(Feature.crc)] = .{
.llvm_name = "crc",
.description = "Mips R6 CRC ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dsp)] = .{
.llvm_name = "dsp",
.description = "Mips DSP ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dspr2)] = .{
.llvm_name = "dspr2",
.description = "Mips DSP-R2 ASE",
.dependencies = featureSet(&[_]Feature{
.dsp,
}),
};
result[@intFromEnum(Feature.dspr3)] = .{
.llvm_name = "dspr3",
.description = "Mips DSP-R3 ASE",
.dependencies = featureSet(&[_]Feature{
.dspr2,
}),
};
result[@intFromEnum(Feature.eva)] = .{
.llvm_name = "eva",
.description = "Mips EVA ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fp64)] = .{
.llvm_name = "fp64",
.description = "Support 64-bit FP registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fpxx)] = .{
.llvm_name = "fpxx",
.description = "Support for FPXX",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ginv)] = .{
.llvm_name = "ginv",
.description = "Mips Global Invalidate ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gp64)] = .{
.llvm_name = "gp64",
.description = "General Purpose Registers are 64-bit wide",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.long_calls)] = .{
.llvm_name = "long-calls",
.description = "Disable use of the jal instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.micromips)] = .{
.llvm_name = "micromips",
.description = "microMips mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips1)] = .{
.llvm_name = "mips1",
.description = "Mips I ISA Support [highly experimental]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips16)] = .{
.llvm_name = "mips16",
.description = "Mips16 mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips2)] = .{
.llvm_name = "mips2",
.description = "Mips II ISA Support [highly experimental]",
.dependencies = featureSet(&[_]Feature{
.mips1,
}),
};
result[@intFromEnum(Feature.mips3)] = .{
.llvm_name = "mips3",
.description = "MIPS III ISA Support [highly experimental]",
.dependencies = featureSet(&[_]Feature{
.fp64,
.gp64,
.mips2,
.mips3_32,
.mips3_32r2,
}),
};
result[@intFromEnum(Feature.mips32)] = .{
.llvm_name = "mips32",
.description = "Mips32 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips2,
.mips3_32,
.mips4_32,
}),
};
result[@intFromEnum(Feature.mips32r2)] = .{
.llvm_name = "mips32r2",
.description = "Mips32r2 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32,
.mips3_32r2,
.mips4_32r2,
.mips5_32r2,
}),
};
result[@intFromEnum(Feature.mips32r3)] = .{
.llvm_name = "mips32r3",
.description = "Mips32r3 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32r2,
}),
};
result[@intFromEnum(Feature.mips32r5)] = .{
.llvm_name = "mips32r5",
.description = "Mips32r5 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32r3,
}),
};
result[@intFromEnum(Feature.mips32r6)] = .{
.llvm_name = "mips32r6",
.description = "Mips32r6 ISA Support [experimental]",
.dependencies = featureSet(&[_]Feature{
.abs2008,
.fp64,
.mips32r5,
.nan2008,
}),
};
result[@intFromEnum(Feature.mips3_32)] = .{
.llvm_name = "mips3_32",
.description = "Subset of MIPS-III that is also in MIPS32 [highly experimental]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips3_32r2)] = .{
.llvm_name = "mips3_32r2",
.description = "Subset of MIPS-III that is also in MIPS32r2 [highly experimental]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips3d)] = .{
.llvm_name = "mips3d",
.description = "Mips 3D ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips4)] = .{
.llvm_name = "mips4",
.description = "MIPS IV ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips3,
.mips4_32,
.mips4_32r2,
}),
};
result[@intFromEnum(Feature.mips4_32)] = .{
.llvm_name = "mips4_32",
.description = "Subset of MIPS-IV that is also in MIPS32 [highly experimental]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips4_32r2)] = .{
.llvm_name = "mips4_32r2",
.description = "Subset of MIPS-IV that is also in MIPS32r2 [highly experimental]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips5)] = .{
.llvm_name = "mips5",
.description = "MIPS V ISA Support [highly experimental]",
.dependencies = featureSet(&[_]Feature{
.mips4,
.mips5_32r2,
}),
};
result[@intFromEnum(Feature.mips5_32r2)] = .{
.llvm_name = "mips5_32r2",
.description = "Subset of MIPS-V that is also in MIPS32r2 [highly experimental]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mips64)] = .{
.llvm_name = "mips64",
.description = "Mips64 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32,
.mips5,
}),
};
result[@intFromEnum(Feature.mips64r2)] = .{
.llvm_name = "mips64r2",
.description = "Mips64r2 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32r2,
.mips64,
}),
};
result[@intFromEnum(Feature.mips64r3)] = .{
.llvm_name = "mips64r3",
.description = "Mips64r3 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32r3,
.mips64r2,
}),
};
result[@intFromEnum(Feature.mips64r5)] = .{
.llvm_name = "mips64r5",
.description = "Mips64r5 ISA Support",
.dependencies = featureSet(&[_]Feature{
.mips32r5,
.mips64r3,
}),
};
result[@intFromEnum(Feature.mips64r6)] = .{
.llvm_name = "mips64r6",
.description = "Mips64r6 ISA Support [experimental]",
.dependencies = featureSet(&[_]Feature{
.mips32r6,
.mips64r5,
}),
};
result[@intFromEnum(Feature.msa)] = .{
.llvm_name = "msa",
.description = "Mips MSA ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mt)] = .{
.llvm_name = "mt",
.description = "Mips MT ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nan2008)] = .{
.llvm_name = "nan2008",
.description = "IEEE 754-2008 NaN encoding",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.noabicalls)] = .{
.llvm_name = "noabicalls",
.description = "Disable SVR4-style position-independent code",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nomadd4)] = .{
.llvm_name = "nomadd4",
.description = "Disable 4-operand madd.fmt and related instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nooddspreg)] = .{
.llvm_name = "nooddspreg",
.description = "Disable odd numbered single-precision registers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.p5600)] = .{
.llvm_name = "p5600",
.description = "The P5600 Processor",
.dependencies = featureSet(&[_]Feature{
.mips32r5,
}),
};
result[@intFromEnum(Feature.ptr64)] = .{
.llvm_name = "ptr64",
.description = "Pointers are 64-bit wide",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.single_float)] = .{
.llvm_name = "single-float",
.description = "Only supports single precision float",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.soft_float)] = .{
.llvm_name = "soft-float",
.description = "Does not support floating point instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sym32)] = .{
.llvm_name = "sym32",
.description = "Symbols are 32 bit on Mips64",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_indirect_jump_hazard)] = .{
.llvm_name = "use-indirect-jump-hazard",
.description = "Use indirect jump guards to prevent certain speculation based attacks",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_tcc_in_div)] = .{
.llvm_name = "use-tcc-in-div",
.description = "Force the assembler to use trapping",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vfpu)] = .{
.llvm_name = "vfpu",
.description = "Enable vector FPU instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.virt)] = .{
.llvm_name = "virt",
.description = "Mips Virtualization ASE",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xgot)] = .{
.llvm_name = "xgot",
.description = "Assume 32-bit GOT",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.mips32,
}),
};
pub const mips1 = CpuModel{
.name = "mips1",
.llvm_name = "mips1",
.features = featureSet(&[_]Feature{
.mips1,
}),
};
pub const mips2 = CpuModel{
.name = "mips2",
.llvm_name = "mips2",
.features = featureSet(&[_]Feature{
.mips2,
}),
};
pub const mips3 = CpuModel{
.name = "mips3",
.llvm_name = "mips3",
.features = featureSet(&[_]Feature{
.mips3,
}),
};
pub const mips32 = CpuModel{
.name = "mips32",
.llvm_name = "mips32",
.features = featureSet(&[_]Feature{
.mips32,
}),
};
pub const mips32r2 = CpuModel{
.name = "mips32r2",
.llvm_name = "mips32r2",
.features = featureSet(&[_]Feature{
.mips32r2,
}),
};
pub const mips32r3 = CpuModel{
.name = "mips32r3",
.llvm_name = "mips32r3",
.features = featureSet(&[_]Feature{
.mips32r3,
}),
};
pub const mips32r5 = CpuModel{
.name = "mips32r5",
.llvm_name = "mips32r5",
.features = featureSet(&[_]Feature{
.mips32r5,
}),
};
pub const mips32r6 = CpuModel{
.name = "mips32r6",
.llvm_name = "mips32r6",
.features = featureSet(&[_]Feature{
.mips32r6,
}),
};
pub const mips4 = CpuModel{
.name = "mips4",
.llvm_name = "mips4",
.features = featureSet(&[_]Feature{
.mips4,
}),
};
pub const mips5 = CpuModel{
.name = "mips5",
.llvm_name = "mips5",
.features = featureSet(&[_]Feature{
.mips5,
}),
};
pub const mips64 = CpuModel{
.name = "mips64",
.llvm_name = "mips64",
.features = featureSet(&[_]Feature{
.mips64,
}),
};
pub const mips64r2 = CpuModel{
.name = "mips64r2",
.llvm_name = "mips64r2",
.features = featureSet(&[_]Feature{
.mips64r2,
}),
};
pub const mips64r3 = CpuModel{
.name = "mips64r3",
.llvm_name = "mips64r3",
.features = featureSet(&[_]Feature{
.mips64r3,
}),
};
pub const mips64r5 = CpuModel{
.name = "mips64r5",
.llvm_name = "mips64r5",
.features = featureSet(&[_]Feature{
.mips64r5,
}),
};
pub const mips64r6 = CpuModel{
.name = "mips64r6",
.llvm_name = "mips64r6",
.features = featureSet(&[_]Feature{
.mips64r6,
}),
};
pub const octeon = CpuModel{
.name = "octeon",
.llvm_name = "octeon",
.features = featureSet(&[_]Feature{
.cnmips,
}),
};
pub const @"octeon+" = CpuModel{
.name = "octeon+",
.llvm_name = "octeon+",
.features = featureSet(&[_]Feature{
.cnmipsp,
}),
};
pub const p5600 = CpuModel{
.name = "p5600",
.llvm_name = "p5600",
.features = featureSet(&[_]Feature{
.p5600,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/x86.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
@"16bit_mode",
@"32bit_mode",
@"3dnow",
@"3dnowa",
@"64bit",
adx,
aes,
amx_bf16,
amx_int8,
amx_tile,
avx,
avx2,
avx512bf16,
avx512bitalg,
avx512bw,
avx512cd,
avx512dq,
avx512er,
avx512f,
avx512ifma,
avx512pf,
avx512vbmi,
avx512vbmi2,
avx512vl,
avx512vnni,
avx512vp2intersect,
avx512vpopcntdq,
avxvnni,
bmi,
bmi2,
branchfusion,
cldemote,
clflushopt,
clwb,
clzero,
cmov,
cx16,
cx8,
enqcmd,
ermsb,
f16c,
false_deps_lzcnt_tzcnt,
false_deps_popcnt,
fast_11bytenop,
fast_15bytenop,
fast_7bytenop,
fast_bextr,
fast_gather,
fast_hops,
fast_lzcnt,
fast_movbe,
fast_scalar_fsqrt,
fast_scalar_shift_masks,
fast_shld_rotate,
fast_variable_crosslane_shuffle,
fast_variable_perlane_shuffle,
fast_vector_fsqrt,
fast_vector_shift_masks,
fma,
fma4,
fsgsbase,
fsrm,
fxsr,
gfni,
hreset,
idivl_to_divb,
idivq_to_divl,
invpcid,
kl,
lea_sp,
lea_uses_ag,
lvi_cfi,
lvi_load_hardening,
lwp,
lzcnt,
macrofusion,
mmx,
movbe,
movdir64b,
movdiri,
mwaitx,
nopl,
pad_short_functions,
pclmul,
pconfig,
pku,
popcnt,
prefer_128_bit,
prefer_256_bit,
prefer_mask_registers,
prefetchwt1,
prfchw,
ptwrite,
rdpid,
rdrnd,
rdseed,
retpoline,
retpoline_external_thunk,
retpoline_indirect_branches,
retpoline_indirect_calls,
rtm,
sahf,
serialize,
seses,
sgx,
sha,
shstk,
slow_3ops_lea,
slow_incdec,
slow_lea,
slow_pmaddwd,
slow_pmulld,
slow_shld,
slow_two_mem_ops,
slow_unaligned_mem_16,
slow_unaligned_mem_32,
soft_float,
sse,
sse2,
sse3,
sse4_1,
sse4_2,
sse4a,
sse_unaligned_mem,
ssse3,
tbm,
tsxldtrk,
uintr,
use_aa,
use_glm_div_sqrt_costs,
vaes,
vpclmulqdq,
vzeroupper,
waitpkg,
wbnoinvd,
widekl,
x87,
xop,
xsave,
xsavec,
xsaveopt,
xsaves,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"16bit_mode")] = .{
.llvm_name = "16bit-mode",
.description = "16-bit mode (i8086)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.@"32bit_mode")] = .{
.llvm_name = "32bit-mode",
.description = "32-bit mode (80386)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.@"3dnow")] = .{
.llvm_name = "3dnow",
.description = "Enable 3DNow! instructions",
.dependencies = featureSet(&[_]Feature{
.mmx,
}),
};
result[@intFromEnum(Feature.@"3dnowa")] = .{
.llvm_name = "3dnowa",
.description = "Enable 3DNow! Athlon instructions",
.dependencies = featureSet(&[_]Feature{
.@"3dnow",
}),
};
result[@intFromEnum(Feature.@"64bit")] = .{
.llvm_name = "64bit",
.description = "Support 64-bit instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.adx)] = .{
.llvm_name = "adx",
.description = "Support ADX instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.aes)] = .{
.llvm_name = "aes",
.description = "Enable AES instructions",
.dependencies = featureSet(&[_]Feature{
.sse2,
}),
};
result[@intFromEnum(Feature.amx_bf16)] = .{
.llvm_name = "amx-bf16",
.description = "Support AMX-BF16 instructions",
.dependencies = featureSet(&[_]Feature{
.amx_tile,
}),
};
result[@intFromEnum(Feature.amx_int8)] = .{
.llvm_name = "amx-int8",
.description = "Support AMX-INT8 instructions",
.dependencies = featureSet(&[_]Feature{
.amx_tile,
}),
};
result[@intFromEnum(Feature.amx_tile)] = .{
.llvm_name = "amx-tile",
.description = "Support AMX-TILE instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.avx)] = .{
.llvm_name = "avx",
.description = "Enable AVX instructions",
.dependencies = featureSet(&[_]Feature{
.sse4_2,
}),
};
result[@intFromEnum(Feature.avx2)] = .{
.llvm_name = "avx2",
.description = "Enable AVX2 instructions",
.dependencies = featureSet(&[_]Feature{
.avx,
}),
};
result[@intFromEnum(Feature.avx512bf16)] = .{
.llvm_name = "avx512bf16",
.description = "Support bfloat16 floating point",
.dependencies = featureSet(&[_]Feature{
.avx512bw,
}),
};
result[@intFromEnum(Feature.avx512bitalg)] = .{
.llvm_name = "avx512bitalg",
.description = "Enable AVX-512 Bit Algorithms",
.dependencies = featureSet(&[_]Feature{
.avx512bw,
}),
};
result[@intFromEnum(Feature.avx512bw)] = .{
.llvm_name = "avx512bw",
.description = "Enable AVX-512 Byte and Word Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512cd)] = .{
.llvm_name = "avx512cd",
.description = "Enable AVX-512 Conflict Detection Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512dq)] = .{
.llvm_name = "avx512dq",
.description = "Enable AVX-512 Doubleword and Quadword Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512er)] = .{
.llvm_name = "avx512er",
.description = "Enable AVX-512 Exponential and Reciprocal Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512f)] = .{
.llvm_name = "avx512f",
.description = "Enable AVX-512 instructions",
.dependencies = featureSet(&[_]Feature{
.avx2,
.f16c,
.fma,
}),
};
result[@intFromEnum(Feature.avx512ifma)] = .{
.llvm_name = "avx512ifma",
.description = "Enable AVX-512 Integer Fused Multiple-Add",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512pf)] = .{
.llvm_name = "avx512pf",
.description = "Enable AVX-512 PreFetch Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512vbmi)] = .{
.llvm_name = "avx512vbmi",
.description = "Enable AVX-512 Vector Byte Manipulation Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512bw,
}),
};
result[@intFromEnum(Feature.avx512vbmi2)] = .{
.llvm_name = "avx512vbmi2",
.description = "Enable AVX-512 further Vector Byte Manipulation Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512bw,
}),
};
result[@intFromEnum(Feature.avx512vl)] = .{
.llvm_name = "avx512vl",
.description = "Enable AVX-512 Vector Length eXtensions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512vnni)] = .{
.llvm_name = "avx512vnni",
.description = "Enable AVX-512 Vector Neural Network Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512vp2intersect)] = .{
.llvm_name = "avx512vp2intersect",
.description = "Enable AVX-512 vp2intersect",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avx512vpopcntdq)] = .{
.llvm_name = "avx512vpopcntdq",
.description = "Enable AVX-512 Population Count Instructions",
.dependencies = featureSet(&[_]Feature{
.avx512f,
}),
};
result[@intFromEnum(Feature.avxvnni)] = .{
.llvm_name = "avxvnni",
.description = "Support AVX_VNNI encoding",
.dependencies = featureSet(&[_]Feature{
.avx2,
}),
};
result[@intFromEnum(Feature.bmi)] = .{
.llvm_name = "bmi",
.description = "Support BMI instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.bmi2)] = .{
.llvm_name = "bmi2",
.description = "Support BMI2 instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.branchfusion)] = .{
.llvm_name = "branchfusion",
.description = "CMP/TEST can be fused with conditional branches",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cldemote)] = .{
.llvm_name = "cldemote",
.description = "Enable Cache Demote",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.clflushopt)] = .{
.llvm_name = "clflushopt",
.description = "Flush A Cache Line Optimized",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.clwb)] = .{
.llvm_name = "clwb",
.description = "Cache Line Write Back",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.clzero)] = .{
.llvm_name = "clzero",
.description = "Enable Cache Line Zero",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cmov)] = .{
.llvm_name = "cmov",
.description = "Enable conditional move instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cx16)] = .{
.llvm_name = "cx16",
.description = "64-bit with cmpxchg16b",
.dependencies = featureSet(&[_]Feature{
.cx8,
}),
};
result[@intFromEnum(Feature.cx8)] = .{
.llvm_name = "cx8",
.description = "Support CMPXCHG8B instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.enqcmd)] = .{
.llvm_name = "enqcmd",
.description = "Has ENQCMD instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ermsb)] = .{
.llvm_name = "ermsb",
.description = "REP MOVS/STOS are fast",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.f16c)] = .{
.llvm_name = "f16c",
.description = "Support 16-bit floating point conversion instructions",
.dependencies = featureSet(&[_]Feature{
.avx,
}),
};
result[@intFromEnum(Feature.false_deps_lzcnt_tzcnt)] = .{
.llvm_name = "false-deps-lzcnt-tzcnt",
.description = "LZCNT/TZCNT have a false dependency on dest register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.false_deps_popcnt)] = .{
.llvm_name = "false-deps-popcnt",
.description = "POPCNT has a false dependency on dest register",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_11bytenop)] = .{
.llvm_name = "fast-11bytenop",
.description = "Target can quickly decode up to 11 byte NOPs",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_15bytenop)] = .{
.llvm_name = "fast-15bytenop",
.description = "Target can quickly decode up to 15 byte NOPs",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_7bytenop)] = .{
.llvm_name = "fast-7bytenop",
.description = "Target can quickly decode up to 7 byte NOPs",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_bextr)] = .{
.llvm_name = "fast-bextr",
.description = "Indicates that the BEXTR instruction is implemented as a single uop with good throughput",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_gather)] = .{
.llvm_name = "fast-gather",
.description = "Indicates if gather is reasonably fast",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_hops)] = .{
.llvm_name = "fast-hops",
.description = "Prefer horizontal vector math instructions (haddp, phsub, etc.) over normal vector instructions with shuffles",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_lzcnt)] = .{
.llvm_name = "fast-lzcnt",
.description = "LZCNT instructions are as fast as most simple integer ops",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_movbe)] = .{
.llvm_name = "fast-movbe",
.description = "Prefer a movbe over a single-use load + bswap / single-use bswap + store",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_scalar_fsqrt)] = .{
.llvm_name = "fast-scalar-fsqrt",
.description = "Scalar SQRT is fast (disable Newton-Raphson)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_scalar_shift_masks)] = .{
.llvm_name = "fast-scalar-shift-masks",
.description = "Prefer a left/right scalar logical shift pair over a shift+and pair",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_shld_rotate)] = .{
.llvm_name = "fast-shld-rotate",
.description = "SHLD can be used as a faster rotate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_variable_crosslane_shuffle)] = .{
.llvm_name = "fast-variable-crosslane-shuffle",
.description = "Cross-lane shuffles with variable masks are fast",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_variable_perlane_shuffle)] = .{
.llvm_name = "fast-variable-perlane-shuffle",
.description = "Per-lane shuffles with variable masks are fast",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_vector_fsqrt)] = .{
.llvm_name = "fast-vector-fsqrt",
.description = "Vector SQRT is fast (disable Newton-Raphson)",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_vector_shift_masks)] = .{
.llvm_name = "fast-vector-shift-masks",
.description = "Prefer a left/right vector logical shift pair over a shift+and pair",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fma)] = .{
.llvm_name = "fma",
.description = "Enable three-operand fused multiple-add",
.dependencies = featureSet(&[_]Feature{
.avx,
}),
};
result[@intFromEnum(Feature.fma4)] = .{
.llvm_name = "fma4",
.description = "Enable four-operand fused multiple-add",
.dependencies = featureSet(&[_]Feature{
.avx,
.sse4a,
}),
};
result[@intFromEnum(Feature.fsgsbase)] = .{
.llvm_name = "fsgsbase",
.description = "Support FS/GS Base instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fsrm)] = .{
.llvm_name = "fsrm",
.description = "REP MOVSB of short lengths is faster",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fxsr)] = .{
.llvm_name = "fxsr",
.description = "Support fxsave/fxrestore instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.gfni)] = .{
.llvm_name = "gfni",
.description = "Enable Galois Field Arithmetic Instructions",
.dependencies = featureSet(&[_]Feature{
.sse2,
}),
};
result[@intFromEnum(Feature.hreset)] = .{
.llvm_name = "hreset",
.description = "Has hreset instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.idivl_to_divb)] = .{
.llvm_name = "idivl-to-divb",
.description = "Use 8-bit divide for positive values less than 256",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.idivq_to_divl)] = .{
.llvm_name = "idivq-to-divl",
.description = "Use 32-bit divide for positive values less than 2^32",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.invpcid)] = .{
.llvm_name = "invpcid",
.description = "Invalidate Process-Context Identifier",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.kl)] = .{
.llvm_name = "kl",
.description = "Support Key Locker kl Instructions",
.dependencies = featureSet(&[_]Feature{
.sse2,
}),
};
result[@intFromEnum(Feature.lea_sp)] = .{
.llvm_name = "lea-sp",
.description = "Use LEA for adjusting the stack pointer",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lea_uses_ag)] = .{
.llvm_name = "lea-uses-ag",
.description = "LEA instruction needs inputs at AG stage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lvi_cfi)] = .{
.llvm_name = "lvi-cfi",
.description = "Prevent indirect calls/branches from using a memory operand, and precede all indirect calls/branches from a register with an LFENCE instruction to serialize control flow. Also decompose RET instructions into a POP+LFENCE+JMP sequence.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lvi_load_hardening)] = .{
.llvm_name = "lvi-load-hardening",
.description = "Insert LFENCE instructions to prevent data speculatively injected into loads from being used maliciously.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lwp)] = .{
.llvm_name = "lwp",
.description = "Enable LWP instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lzcnt)] = .{
.llvm_name = "lzcnt",
.description = "Support LZCNT instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.macrofusion)] = .{
.llvm_name = "macrofusion",
.description = "Various instructions can be fused with conditional branches",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mmx)] = .{
.llvm_name = "mmx",
.description = "Enable MMX instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.movbe)] = .{
.llvm_name = "movbe",
.description = "Support MOVBE instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.movdir64b)] = .{
.llvm_name = "movdir64b",
.description = "Support movdir64b instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.movdiri)] = .{
.llvm_name = "movdiri",
.description = "Support movdiri instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mwaitx)] = .{
.llvm_name = "mwaitx",
.description = "Enable MONITORX/MWAITX timer functionality",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nopl)] = .{
.llvm_name = "nopl",
.description = "Enable NOPL instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pad_short_functions)] = .{
.llvm_name = "pad-short-functions",
.description = "Pad short functions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pclmul)] = .{
.llvm_name = "pclmul",
.description = "Enable packed carry-less multiplication instructions",
.dependencies = featureSet(&[_]Feature{
.sse2,
}),
};
result[@intFromEnum(Feature.pconfig)] = .{
.llvm_name = "pconfig",
.description = "platform configuration instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pku)] = .{
.llvm_name = "pku",
.description = "Enable protection keys",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.popcnt)] = .{
.llvm_name = "popcnt",
.description = "Support POPCNT instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefer_128_bit)] = .{
.llvm_name = "prefer-128-bit",
.description = "Prefer 128-bit AVX instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefer_256_bit)] = .{
.llvm_name = "prefer-256-bit",
.description = "Prefer 256-bit AVX instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefer_mask_registers)] = .{
.llvm_name = "prefer-mask-registers",
.description = "Prefer AVX512 mask registers over PTEST/MOVMSK",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefetchwt1)] = .{
.llvm_name = "prefetchwt1",
.description = "Prefetch with Intent to Write and T1 Hint",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prfchw)] = .{
.llvm_name = "prfchw",
.description = "Support PRFCHW instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ptwrite)] = .{
.llvm_name = "ptwrite",
.description = "Support ptwrite instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rdpid)] = .{
.llvm_name = "rdpid",
.description = "Support RDPID instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rdrnd)] = .{
.llvm_name = "rdrnd",
.description = "Support RDRAND instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rdseed)] = .{
.llvm_name = "rdseed",
.description = "Support RDSEED instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.retpoline)] = .{
.llvm_name = "retpoline",
.description = "Remove speculation of indirect branches from the generated code, either by avoiding them entirely or lowering them with a speculation blocking construct",
.dependencies = featureSet(&[_]Feature{
.retpoline_indirect_branches,
.retpoline_indirect_calls,
}),
};
result[@intFromEnum(Feature.retpoline_external_thunk)] = .{
.llvm_name = "retpoline-external-thunk",
.description = "When lowering an indirect call or branch using a `retpoline`, rely on the specified user provided thunk rather than emitting one ourselves. Only has effect when combined with some other retpoline feature",
.dependencies = featureSet(&[_]Feature{
.retpoline_indirect_calls,
}),
};
result[@intFromEnum(Feature.retpoline_indirect_branches)] = .{
.llvm_name = "retpoline-indirect-branches",
.description = "Remove speculation of indirect branches from the generated code",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.retpoline_indirect_calls)] = .{
.llvm_name = "retpoline-indirect-calls",
.description = "Remove speculation of indirect calls from the generated code",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rtm)] = .{
.llvm_name = "rtm",
.description = "Support RTM instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sahf)] = .{
.llvm_name = "sahf",
.description = "Support LAHF and SAHF instructions in 64-bit mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.serialize)] = .{
.llvm_name = "serialize",
.description = "Has serialize instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.seses)] = .{
.llvm_name = "seses",
.description = "Prevent speculative execution side channel timing attacks by inserting a speculation barrier before memory reads, memory writes, and conditional branches. Implies LVI Control Flow integrity.",
.dependencies = featureSet(&[_]Feature{
.lvi_cfi,
}),
};
result[@intFromEnum(Feature.sgx)] = .{
.llvm_name = "sgx",
.description = "Enable Software Guard Extensions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sha)] = .{
.llvm_name = "sha",
.description = "Enable SHA instructions",
.dependencies = featureSet(&[_]Feature{
.sse2,
}),
};
result[@intFromEnum(Feature.shstk)] = .{
.llvm_name = "shstk",
.description = "Support CET Shadow-Stack instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_3ops_lea)] = .{
.llvm_name = "slow-3ops-lea",
.description = "LEA instruction with 3 ops or certain registers is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_incdec)] = .{
.llvm_name = "slow-incdec",
.description = "INC and DEC instructions are slower than ADD and SUB",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_lea)] = .{
.llvm_name = "slow-lea",
.description = "LEA instruction with certain arguments is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_pmaddwd)] = .{
.llvm_name = "slow-pmaddwd",
.description = "PMADDWD is slower than PMULLD",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_pmulld)] = .{
.llvm_name = "slow-pmulld",
.description = "PMULLD instruction is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_shld)] = .{
.llvm_name = "slow-shld",
.description = "SHLD instruction is slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_two_mem_ops)] = .{
.llvm_name = "slow-two-mem-ops",
.description = "Two memory operand instructions are slow",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_unaligned_mem_16)] = .{
.llvm_name = "slow-unaligned-mem-16",
.description = "Slow unaligned 16-byte memory access",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_unaligned_mem_32)] = .{
.llvm_name = "slow-unaligned-mem-32",
.description = "Slow unaligned 32-byte memory access",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.soft_float)] = .{
.llvm_name = "soft-float",
.description = "Use software floating point features",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sse)] = .{
.llvm_name = "sse",
.description = "Enable SSE instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.sse2)] = .{
.llvm_name = "sse2",
.description = "Enable SSE2 instructions",
.dependencies = featureSet(&[_]Feature{
.sse,
}),
};
result[@intFromEnum(Feature.sse3)] = .{
.llvm_name = "sse3",
.description = "Enable SSE3 instructions",
.dependencies = featureSet(&[_]Feature{
.sse2,
}),
};
result[@intFromEnum(Feature.sse4_1)] = .{
.llvm_name = "sse4.1",
.description = "Enable SSE 4.1 instructions",
.dependencies = featureSet(&[_]Feature{
.ssse3,
}),
};
result[@intFromEnum(Feature.sse4_2)] = .{
.llvm_name = "sse4.2",
.description = "Enable SSE 4.2 instructions",
.dependencies = featureSet(&[_]Feature{
.sse4_1,
}),
};
result[@intFromEnum(Feature.sse4a)] = .{
.llvm_name = "sse4a",
.description = "Support SSE 4a instructions",
.dependencies = featureSet(&[_]Feature{
.sse3,
}),
};
result[@intFromEnum(Feature.sse_unaligned_mem)] = .{
.llvm_name = "sse-unaligned-mem",
.description = "Allow unaligned memory operands with SSE instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ssse3)] = .{
.llvm_name = "ssse3",
.description = "Enable SSSE3 instructions",
.dependencies = featureSet(&[_]Feature{
.sse3,
}),
};
result[@intFromEnum(Feature.tbm)] = .{
.llvm_name = "tbm",
.description = "Enable TBM instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.tsxldtrk)] = .{
.llvm_name = "tsxldtrk",
.description = "Support TSXLDTRK instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.uintr)] = .{
.llvm_name = "uintr",
.description = "Has UINTR Instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_aa)] = .{
.llvm_name = "use-aa",
.description = "Use alias analysis during codegen",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.use_glm_div_sqrt_costs)] = .{
.llvm_name = "use-glm-div-sqrt-costs",
.description = "Use Goldmont specific floating point div/sqrt costs",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vaes)] = .{
.llvm_name = "vaes",
.description = "Promote selected AES instructions to AVX512/AVX registers",
.dependencies = featureSet(&[_]Feature{
.aes,
.avx,
}),
};
result[@intFromEnum(Feature.vpclmulqdq)] = .{
.llvm_name = "vpclmulqdq",
.description = "Enable vpclmulqdq instructions",
.dependencies = featureSet(&[_]Feature{
.avx,
.pclmul,
}),
};
result[@intFromEnum(Feature.vzeroupper)] = .{
.llvm_name = "vzeroupper",
.description = "Should insert vzeroupper instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.waitpkg)] = .{
.llvm_name = "waitpkg",
.description = "Wait and pause enhancements",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.wbnoinvd)] = .{
.llvm_name = "wbnoinvd",
.description = "Write Back No Invalidate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.widekl)] = .{
.llvm_name = "widekl",
.description = "Support Key Locker wide Instructions",
.dependencies = featureSet(&[_]Feature{
.kl,
}),
};
result[@intFromEnum(Feature.x87)] = .{
.llvm_name = "x87",
.description = "Enable X87 float instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xop)] = .{
.llvm_name = "xop",
.description = "Enable XOP instructions",
.dependencies = featureSet(&[_]Feature{
.fma4,
}),
};
result[@intFromEnum(Feature.xsave)] = .{
.llvm_name = "xsave",
.description = "Support xsave instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.xsavec)] = .{
.llvm_name = "xsavec",
.description = "Support xsavec instructions",
.dependencies = featureSet(&[_]Feature{
.xsave,
}),
};
result[@intFromEnum(Feature.xsaveopt)] = .{
.llvm_name = "xsaveopt",
.description = "Support xsaveopt instructions",
.dependencies = featureSet(&[_]Feature{
.xsave,
}),
};
result[@intFromEnum(Feature.xsaves)] = .{
.llvm_name = "xsaves",
.description = "Support xsaves instructions",
.dependencies = featureSet(&[_]Feature{
.xsave,
}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const _i386 = CpuModel{
.name = "_i386",
.llvm_name = "i386",
.features = featureSet(&[_]Feature{
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const _i486 = CpuModel{
.name = "_i486",
.llvm_name = "i486",
.features = featureSet(&[_]Feature{
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const _i586 = CpuModel{
.name = "_i586",
.llvm_name = "i586",
.features = featureSet(&[_]Feature{
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const _i686 = CpuModel{
.name = "_i686",
.llvm_name = "i686",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const alderlake = CpuModel{
.name = "alderlake",
.llvm_name = "alderlake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avxvnni,
.bmi,
.bmi2,
.cldemote,
.clflushopt,
.clwb,
.cmov,
.cx16,
.f16c,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fma,
.fsgsbase,
.fxsr,
.gfni,
.hreset,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.movdir64b,
.movdiri,
.nopl,
.pconfig,
.pku,
.popcnt,
.prfchw,
.ptwrite,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.serialize,
.sha,
.shstk,
.slow_3ops_lea,
.vaes,
.vpclmulqdq,
.vzeroupper,
.waitpkg,
.widekl,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const amdfam10 = CpuModel{
.name = "amdfam10",
.llvm_name = "amdfam10",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx16,
.fast_scalar_shift_masks,
.fxsr,
.lzcnt,
.nopl,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.sse4a,
.vzeroupper,
.x87,
}),
};
pub const athlon = CpuModel{
.name = "athlon",
.llvm_name = "athlon",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.cmov,
.cx8,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const athlon64 = CpuModel{
.name = "athlon64",
.llvm_name = "athlon64",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx8,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const athlon64_sse3 = CpuModel{
.name = "athlon64_sse3",
.llvm_name = "athlon64-sse3",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx16,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse3,
.vzeroupper,
.x87,
}),
};
pub const athlon_4 = CpuModel{
.name = "athlon_4",
.llvm_name = "athlon-4",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.cmov,
.cx8,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse,
.vzeroupper,
.x87,
}),
};
pub const athlon_fx = CpuModel{
.name = "athlon_fx",
.llvm_name = "athlon-fx",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx8,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const athlon_mp = CpuModel{
.name = "athlon_mp",
.llvm_name = "athlon-mp",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.cmov,
.cx8,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse,
.vzeroupper,
.x87,
}),
};
pub const athlon_tbird = CpuModel{
.name = "athlon_tbird",
.llvm_name = "athlon-tbird",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.cmov,
.cx8,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const athlon_xp = CpuModel{
.name = "athlon_xp",
.llvm_name = "athlon-xp",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.cmov,
.cx8,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse,
.vzeroupper,
.x87,
}),
};
pub const atom = CpuModel{
.name = "atom",
.llvm_name = "atom",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.idivl_to_divb,
.idivq_to_divl,
.lea_sp,
.lea_uses_ag,
.mmx,
.movbe,
.nopl,
.pad_short_functions,
.sahf,
.slow_two_mem_ops,
.slow_unaligned_mem_16,
.ssse3,
.vzeroupper,
.x87,
}),
};
pub const barcelona = CpuModel{
.name = "barcelona",
.llvm_name = "barcelona",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx16,
.fast_scalar_shift_masks,
.fxsr,
.lzcnt,
.nopl,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.sse4a,
.vzeroupper,
.x87,
}),
};
pub const bdver1 = CpuModel{
.name = "bdver1",
.llvm_name = "bdver1",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.branchfusion,
.cmov,
.cx16,
.fast_11bytenop,
.fast_scalar_shift_masks,
.fxsr,
.lwp,
.lzcnt,
.mmx,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.vzeroupper,
.x87,
.xop,
.xsave,
}),
};
pub const bdver2 = CpuModel{
.name = "bdver2",
.llvm_name = "bdver2",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.bmi,
.branchfusion,
.cmov,
.cx16,
.f16c,
.fast_11bytenop,
.fast_bextr,
.fast_movbe,
.fast_scalar_shift_masks,
.fma,
.fxsr,
.lwp,
.lzcnt,
.mmx,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.tbm,
.vzeroupper,
.x87,
.xop,
.xsave,
}),
};
pub const bdver3 = CpuModel{
.name = "bdver3",
.llvm_name = "bdver3",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.bmi,
.branchfusion,
.cmov,
.cx16,
.f16c,
.fast_11bytenop,
.fast_bextr,
.fast_movbe,
.fast_scalar_shift_masks,
.fma,
.fsgsbase,
.fxsr,
.lwp,
.lzcnt,
.mmx,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.tbm,
.vzeroupper,
.x87,
.xop,
.xsaveopt,
}),
};
pub const bdver4 = CpuModel{
.name = "bdver4",
.llvm_name = "bdver4",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.avx2,
.bmi,
.bmi2,
.branchfusion,
.cmov,
.cx16,
.f16c,
.fast_11bytenop,
.fast_bextr,
.fast_movbe,
.fast_scalar_shift_masks,
.fma,
.fsgsbase,
.fxsr,
.lwp,
.lzcnt,
.mmx,
.movbe,
.mwaitx,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.sahf,
.slow_shld,
.tbm,
.vzeroupper,
.x87,
.xop,
.xsaveopt,
}),
};
pub const bonnell = CpuModel{
.name = "bonnell",
.llvm_name = "bonnell",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.idivl_to_divb,
.idivq_to_divl,
.lea_sp,
.lea_uses_ag,
.mmx,
.movbe,
.nopl,
.pad_short_functions,
.sahf,
.slow_two_mem_ops,
.slow_unaligned_mem_16,
.ssse3,
.vzeroupper,
.x87,
}),
};
pub const broadwell = CpuModel{
.name = "broadwell",
.llvm_name = "broadwell",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avx2,
.bmi,
.bmi2,
.cmov,
.cx16,
.ermsb,
.f16c,
.false_deps_lzcnt_tzcnt,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fma,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const btver1 = CpuModel{
.name = "btver1",
.llvm_name = "btver1",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fast_15bytenop,
.fast_scalar_shift_masks,
.fast_vector_shift_masks,
.fxsr,
.lzcnt,
.mmx,
.nopl,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.sse4a,
.ssse3,
.vzeroupper,
.x87,
}),
};
pub const btver2 = CpuModel{
.name = "btver2",
.llvm_name = "btver2",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.bmi,
.cmov,
.cx16,
.f16c,
.fast_15bytenop,
.fast_bextr,
.fast_hops,
.fast_lzcnt,
.fast_movbe,
.fast_scalar_shift_masks,
.fast_vector_shift_masks,
.fxsr,
.lzcnt,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.sahf,
.slow_shld,
.sse4a,
.x87,
.xsaveopt,
}),
};
pub const c3 = CpuModel{
.name = "c3",
.llvm_name = "c3",
.features = featureSet(&[_]Feature{
.@"3dnow",
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const c3_2 = CpuModel{
.name = "c3_2",
.llvm_name = "c3-2",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.slow_unaligned_mem_16,
.sse,
.vzeroupper,
.x87,
}),
};
pub const cannonlake = CpuModel{
.name = "cannonlake",
.llvm_name = "cannonlake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512cd,
.avx512dq,
.avx512ifma,
.avx512vbmi,
.avx512vl,
.bmi,
.bmi2,
.clflushopt,
.cmov,
.cx16,
.ermsb,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const cascadelake = CpuModel{
.name = "cascadelake",
.llvm_name = "cascadelake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512bw,
.avx512cd,
.avx512dq,
.avx512vl,
.avx512vnni,
.bmi,
.bmi2,
.clflushopt,
.clwb,
.cmov,
.cx16,
.ermsb,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const cooperlake = CpuModel{
.name = "cooperlake",
.llvm_name = "cooperlake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512bf16,
.avx512cd,
.avx512dq,
.avx512vl,
.avx512vnni,
.bmi,
.bmi2,
.clflushopt,
.clwb,
.cmov,
.cx16,
.ermsb,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const core2 = CpuModel{
.name = "core2",
.llvm_name = "core2",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.macrofusion,
.mmx,
.nopl,
.sahf,
.slow_unaligned_mem_16,
.ssse3,
.vzeroupper,
.x87,
}),
};
pub const core_avx2 = CpuModel{
.name = "core_avx2",
.llvm_name = "core-avx2",
.features = featureSet(&[_]Feature{
.@"64bit",
.avx2,
.bmi,
.bmi2,
.cmov,
.cx16,
.ermsb,
.f16c,
.false_deps_lzcnt_tzcnt,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fma,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.rdrnd,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const core_avx_i = CpuModel{
.name = "core_avx_i",
.llvm_name = "core-avx-i",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.f16c,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.macrofusion,
.mmx,
.nopl,
.pclmul,
.popcnt,
.rdrnd,
.sahf,
.slow_3ops_lea,
.slow_unaligned_mem_32,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const corei7 = CpuModel{
.name = "corei7",
.llvm_name = "corei7",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.macrofusion,
.mmx,
.nopl,
.popcnt,
.sahf,
.sse4_2,
.vzeroupper,
.x87,
}),
};
pub const corei7_avx = CpuModel{
.name = "corei7_avx",
.llvm_name = "corei7-avx",
.features = featureSet(&[_]Feature{
.@"64bit",
.avx,
.cmov,
.cx16,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fxsr,
.idivq_to_divl,
.macrofusion,
.mmx,
.nopl,
.pclmul,
.popcnt,
.sahf,
.slow_3ops_lea,
.slow_unaligned_mem_32,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.@"64bit",
.cx8,
.idivq_to_divl,
.macrofusion,
.slow_3ops_lea,
.slow_incdec,
.vzeroupper,
.x87,
}),
};
pub const geode = CpuModel{
.name = "geode",
.llvm_name = "geode",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const goldmont = CpuModel{
.name = "goldmont",
.llvm_name = "goldmont",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.clflushopt,
.cmov,
.cx16,
.false_deps_popcnt,
.fast_movbe,
.fsgsbase,
.fxsr,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_incdec,
.slow_lea,
.slow_two_mem_ops,
.sse4_2,
.use_glm_div_sqrt_costs,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const goldmont_plus = CpuModel{
.name = "goldmont_plus",
.llvm_name = "goldmont-plus",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.clflushopt,
.cmov,
.cx16,
.fast_movbe,
.fsgsbase,
.fxsr,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.ptwrite,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_incdec,
.slow_lea,
.slow_two_mem_ops,
.sse4_2,
.use_glm_div_sqrt_costs,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const haswell = CpuModel{
.name = "haswell",
.llvm_name = "haswell",
.features = featureSet(&[_]Feature{
.@"64bit",
.avx2,
.bmi,
.bmi2,
.cmov,
.cx16,
.ermsb,
.f16c,
.false_deps_lzcnt_tzcnt,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fma,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.rdrnd,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const icelake_client = CpuModel{
.name = "icelake_client",
.llvm_name = "icelake-client",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avx512bitalg,
.avx512cd,
.avx512dq,
.avx512ifma,
.avx512vbmi,
.avx512vbmi2,
.avx512vl,
.avx512vnni,
.avx512vpopcntdq,
.bmi,
.bmi2,
.clflushopt,
.cmov,
.cx16,
.ermsb,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fsrm,
.fxsr,
.gfni,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_3ops_lea,
.vaes,
.vpclmulqdq,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const icelake_server = CpuModel{
.name = "icelake_server",
.llvm_name = "icelake-server",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avx512bitalg,
.avx512cd,
.avx512dq,
.avx512ifma,
.avx512vbmi,
.avx512vbmi2,
.avx512vl,
.avx512vnni,
.avx512vpopcntdq,
.bmi,
.bmi2,
.clflushopt,
.clwb,
.cmov,
.cx16,
.ermsb,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fsrm,
.fxsr,
.gfni,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pconfig,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_3ops_lea,
.vaes,
.vpclmulqdq,
.vzeroupper,
.wbnoinvd,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const ivybridge = CpuModel{
.name = "ivybridge",
.llvm_name = "ivybridge",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.f16c,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.macrofusion,
.mmx,
.nopl,
.pclmul,
.popcnt,
.rdrnd,
.sahf,
.slow_3ops_lea,
.slow_unaligned_mem_32,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const k6 = CpuModel{
.name = "k6",
.llvm_name = "k6",
.features = featureSet(&[_]Feature{
.cx8,
.mmx,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const k6_2 = CpuModel{
.name = "k6_2",
.llvm_name = "k6-2",
.features = featureSet(&[_]Feature{
.@"3dnow",
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const k6_3 = CpuModel{
.name = "k6_3",
.llvm_name = "k6-3",
.features = featureSet(&[_]Feature{
.@"3dnow",
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const k8 = CpuModel{
.name = "k8",
.llvm_name = "k8",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx8,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const k8_sse3 = CpuModel{
.name = "k8_sse3",
.llvm_name = "k8-sse3",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx16,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse3,
.vzeroupper,
.x87,
}),
};
pub const knl = CpuModel{
.name = "knl",
.llvm_name = "knl",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512cd,
.avx512er,
.avx512pf,
.bmi,
.bmi2,
.cmov,
.cx16,
.fast_gather,
.fast_movbe,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.lzcnt,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prefer_mask_registers,
.prefetchwt1,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.slow_incdec,
.slow_pmaddwd,
.slow_two_mem_ops,
.x87,
.xsaveopt,
}),
};
pub const knm = CpuModel{
.name = "knm",
.llvm_name = "knm",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512cd,
.avx512er,
.avx512pf,
.avx512vpopcntdq,
.bmi,
.bmi2,
.cmov,
.cx16,
.fast_gather,
.fast_movbe,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.lzcnt,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prefer_mask_registers,
.prefetchwt1,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.slow_incdec,
.slow_pmaddwd,
.slow_two_mem_ops,
.x87,
.xsaveopt,
}),
};
pub const lakemont = CpuModel{
.name = "lakemont",
.llvm_name = "lakemont",
.features = featureSet(&[_]Feature{
.cx8,
.slow_unaligned_mem_16,
.soft_float,
.vzeroupper,
}),
};
pub const nehalem = CpuModel{
.name = "nehalem",
.llvm_name = "nehalem",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.macrofusion,
.mmx,
.nopl,
.popcnt,
.sahf,
.sse4_2,
.vzeroupper,
.x87,
}),
};
pub const nocona = CpuModel{
.name = "nocona",
.llvm_name = "nocona",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse3,
.vzeroupper,
.x87,
}),
};
pub const opteron = CpuModel{
.name = "opteron",
.llvm_name = "opteron",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx8,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const opteron_sse3 = CpuModel{
.name = "opteron_sse3",
.llvm_name = "opteron-sse3",
.features = featureSet(&[_]Feature{
.@"3dnowa",
.@"64bit",
.cmov,
.cx16,
.fast_scalar_shift_masks,
.fxsr,
.nopl,
.slow_shld,
.slow_unaligned_mem_16,
.sse3,
.vzeroupper,
.x87,
}),
};
pub const penryn = CpuModel{
.name = "penryn",
.llvm_name = "penryn",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.macrofusion,
.mmx,
.nopl,
.sahf,
.slow_unaligned_mem_16,
.sse4_1,
.vzeroupper,
.x87,
}),
};
pub const pentium = CpuModel{
.name = "pentium",
.llvm_name = "pentium",
.features = featureSet(&[_]Feature{
.cx8,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const pentium2 = CpuModel{
.name = "pentium2",
.llvm_name = "pentium2",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const pentium3 = CpuModel{
.name = "pentium3",
.llvm_name = "pentium3",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse,
.vzeroupper,
.x87,
}),
};
pub const pentium3m = CpuModel{
.name = "pentium3m",
.llvm_name = "pentium3m",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse,
.vzeroupper,
.x87,
}),
};
pub const pentium4 = CpuModel{
.name = "pentium4",
.llvm_name = "pentium4",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const pentium4m = CpuModel{
.name = "pentium4m",
.llvm_name = "pentium4m",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const pentium_m = CpuModel{
.name = "pentium_m",
.llvm_name = "pentium-m",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const pentium_mmx = CpuModel{
.name = "pentium_mmx",
.llvm_name = "pentium-mmx",
.features = featureSet(&[_]Feature{
.cx8,
.mmx,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const pentiumpro = CpuModel{
.name = "pentiumpro",
.llvm_name = "pentiumpro",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.nopl,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const prescott = CpuModel{
.name = "prescott",
.llvm_name = "prescott",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse3,
.vzeroupper,
.x87,
}),
};
pub const rocketlake = CpuModel{
.name = "rocketlake",
.llvm_name = "rocketlake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avx512bitalg,
.avx512cd,
.avx512dq,
.avx512ifma,
.avx512vbmi,
.avx512vbmi2,
.avx512vl,
.avx512vnni,
.avx512vpopcntdq,
.bmi,
.bmi2,
.clflushopt,
.cmov,
.cx16,
.ermsb,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fsrm,
.fxsr,
.gfni,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_3ops_lea,
.vaes,
.vpclmulqdq,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const sandybridge = CpuModel{
.name = "sandybridge",
.llvm_name = "sandybridge",
.features = featureSet(&[_]Feature{
.@"64bit",
.avx,
.cmov,
.cx16,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fxsr,
.idivq_to_divl,
.macrofusion,
.mmx,
.nopl,
.pclmul,
.popcnt,
.sahf,
.slow_3ops_lea,
.slow_unaligned_mem_32,
.vzeroupper,
.x87,
.xsaveopt,
}),
};
pub const sapphirerapids = CpuModel{
.name = "sapphirerapids",
.llvm_name = "sapphirerapids",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.amx_bf16,
.amx_int8,
.avx512bf16,
.avx512bitalg,
.avx512cd,
.avx512dq,
.avx512ifma,
.avx512vbmi,
.avx512vbmi2,
.avx512vl,
.avx512vnni,
.avx512vp2intersect,
.avx512vpopcntdq,
.avxvnni,
.bmi,
.bmi2,
.cldemote,
.clflushopt,
.clwb,
.cmov,
.cx16,
.enqcmd,
.ermsb,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fsrm,
.fxsr,
.gfni,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.movdir64b,
.movdiri,
.nopl,
.pconfig,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.ptwrite,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.serialize,
.sha,
.shstk,
.slow_3ops_lea,
.tsxldtrk,
.uintr,
.vaes,
.vpclmulqdq,
.vzeroupper,
.waitpkg,
.wbnoinvd,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const silvermont = CpuModel{
.name = "silvermont",
.llvm_name = "silvermont",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.false_deps_popcnt,
.fast_7bytenop,
.fast_movbe,
.fxsr,
.idivq_to_divl,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.sahf,
.slow_incdec,
.slow_lea,
.slow_pmulld,
.slow_two_mem_ops,
.sse4_2,
.vzeroupper,
.x87,
}),
};
pub const skx = CpuModel{
.name = "skx",
.llvm_name = "skx",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512bw,
.avx512cd,
.avx512dq,
.avx512vl,
.bmi,
.bmi2,
.clflushopt,
.clwb,
.cmov,
.cx16,
.ermsb,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const skylake = CpuModel{
.name = "skylake",
.llvm_name = "skylake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx2,
.bmi,
.bmi2,
.clflushopt,
.cmov,
.cx16,
.ermsb,
.f16c,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fma,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const skylake_avx512 = CpuModel{
.name = "skylake_avx512",
.llvm_name = "skylake-avx512",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx512bw,
.avx512cd,
.avx512dq,
.avx512vl,
.bmi,
.bmi2,
.clflushopt,
.clwb,
.cmov,
.cx16,
.ermsb,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fxsr,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.pclmul,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const slm = CpuModel{
.name = "slm",
.llvm_name = "slm",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.false_deps_popcnt,
.fast_7bytenop,
.fast_movbe,
.fxsr,
.idivq_to_divl,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.sahf,
.slow_incdec,
.slow_lea,
.slow_pmulld,
.slow_two_mem_ops,
.sse4_2,
.vzeroupper,
.x87,
}),
};
pub const tigerlake = CpuModel{
.name = "tigerlake",
.llvm_name = "tigerlake",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avx512bitalg,
.avx512cd,
.avx512dq,
.avx512ifma,
.avx512vbmi,
.avx512vbmi2,
.avx512vl,
.avx512vnni,
.avx512vp2intersect,
.avx512vpopcntdq,
.bmi,
.bmi2,
.clflushopt,
.clwb,
.cmov,
.cx16,
.ermsb,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fsgsbase,
.fsrm,
.fxsr,
.gfni,
.idivq_to_divl,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.movdir64b,
.movdiri,
.nopl,
.pku,
.popcnt,
.prefer_256_bit,
.prfchw,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.shstk,
.slow_3ops_lea,
.vaes,
.vpclmulqdq,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const tremont = CpuModel{
.name = "tremont",
.llvm_name = "tremont",
.features = featureSet(&[_]Feature{
.@"64bit",
.aes,
.clflushopt,
.clwb,
.cmov,
.cx16,
.fast_movbe,
.fsgsbase,
.fxsr,
.gfni,
.mmx,
.movbe,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.ptwrite,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_incdec,
.slow_lea,
.slow_two_mem_ops,
.sse4_2,
.use_glm_div_sqrt_costs,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const westmere = CpuModel{
.name = "westmere",
.llvm_name = "westmere",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.fxsr,
.macrofusion,
.mmx,
.nopl,
.pclmul,
.popcnt,
.sahf,
.sse4_2,
.vzeroupper,
.x87,
}),
};
pub const winchip2 = CpuModel{
.name = "winchip2",
.llvm_name = "winchip2",
.features = featureSet(&[_]Feature{
.@"3dnow",
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const winchip_c6 = CpuModel{
.name = "winchip_c6",
.llvm_name = "winchip-c6",
.features = featureSet(&[_]Feature{
.mmx,
.slow_unaligned_mem_16,
.vzeroupper,
.x87,
}),
};
pub const x86_64 = CpuModel{
.name = "x86_64",
.llvm_name = "x86-64",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx8,
.fxsr,
.idivq_to_divl,
.macrofusion,
.mmx,
.nopl,
.slow_3ops_lea,
.slow_incdec,
.sse2,
.vzeroupper,
.x87,
}),
};
pub const x86_64_v2 = CpuModel{
.name = "x86_64_v2",
.llvm_name = "x86-64-v2",
.features = featureSet(&[_]Feature{
.@"64bit",
.cmov,
.cx16,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fxsr,
.idivq_to_divl,
.macrofusion,
.mmx,
.nopl,
.popcnt,
.sahf,
.slow_3ops_lea,
.slow_unaligned_mem_32,
.sse4_2,
.vzeroupper,
.x87,
}),
};
pub const x86_64_v3 = CpuModel{
.name = "x86_64_v3",
.llvm_name = "x86-64-v3",
.features = featureSet(&[_]Feature{
.@"64bit",
.avx2,
.bmi,
.bmi2,
.cmov,
.cx16,
.f16c,
.false_deps_lzcnt_tzcnt,
.false_deps_popcnt,
.fast_15bytenop,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fma,
.fxsr,
.idivq_to_divl,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.popcnt,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsave,
}),
};
pub const x86_64_v4 = CpuModel{
.name = "x86_64_v4",
.llvm_name = "x86-64-v4",
.features = featureSet(&[_]Feature{
.@"64bit",
.avx512bw,
.avx512cd,
.avx512dq,
.avx512vl,
.bmi,
.bmi2,
.cmov,
.cx16,
.false_deps_popcnt,
.fast_15bytenop,
.fast_gather,
.fast_scalar_fsqrt,
.fast_shld_rotate,
.fast_variable_crosslane_shuffle,
.fast_variable_perlane_shuffle,
.fast_vector_fsqrt,
.fxsr,
.idivq_to_divl,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.nopl,
.popcnt,
.prefer_256_bit,
.sahf,
.slow_3ops_lea,
.vzeroupper,
.x87,
.xsave,
}),
};
pub const yonah = CpuModel{
.name = "yonah",
.llvm_name = "yonah",
.features = featureSet(&[_]Feature{
.cmov,
.cx8,
.fxsr,
.mmx,
.nopl,
.slow_unaligned_mem_16,
.sse3,
.vzeroupper,
.x87,
}),
};
pub const znver1 = CpuModel{
.name = "znver1",
.llvm_name = "znver1",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx2,
.bmi,
.bmi2,
.branchfusion,
.clflushopt,
.clzero,
.cmov,
.cx16,
.f16c,
.fast_15bytenop,
.fast_bextr,
.fast_lzcnt,
.fast_movbe,
.fast_scalar_shift_masks,
.fma,
.fsgsbase,
.fxsr,
.lzcnt,
.mmx,
.movbe,
.mwaitx,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_shld,
.sse4a,
.vzeroupper,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const znver2 = CpuModel{
.name = "znver2",
.llvm_name = "znver2",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.aes,
.avx2,
.bmi,
.bmi2,
.branchfusion,
.clflushopt,
.clwb,
.clzero,
.cmov,
.cx16,
.f16c,
.fast_15bytenop,
.fast_bextr,
.fast_lzcnt,
.fast_movbe,
.fast_scalar_shift_masks,
.fma,
.fsgsbase,
.fxsr,
.lzcnt,
.mmx,
.movbe,
.mwaitx,
.nopl,
.pclmul,
.popcnt,
.prfchw,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_shld,
.sse4a,
.vzeroupper,
.wbnoinvd,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
pub const znver3 = CpuModel{
.name = "znver3",
.llvm_name = "znver3",
.features = featureSet(&[_]Feature{
.@"64bit",
.adx,
.avx2,
.bmi,
.bmi2,
.branchfusion,
.clflushopt,
.clwb,
.clzero,
.cmov,
.cx16,
.f16c,
.fast_15bytenop,
.fast_bextr,
.fast_lzcnt,
.fast_movbe,
.fast_scalar_shift_masks,
.fast_variable_perlane_shuffle,
.fma,
.fsgsbase,
.fsrm,
.fxsr,
.invpcid,
.lzcnt,
.macrofusion,
.mmx,
.movbe,
.mwaitx,
.nopl,
.pku,
.popcnt,
.prfchw,
.rdpid,
.rdrnd,
.rdseed,
.sahf,
.sha,
.slow_shld,
.sse4a,
.vaes,
.vpclmulqdq,
.vzeroupper,
.wbnoinvd,
.x87,
.xsavec,
.xsaveopt,
.xsaves,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/systemz.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
bear_enhancement,
deflate_conversion,
dfp_packed_conversion,
dfp_zoned_conversion,
distinct_ops,
enhanced_dat_2,
enhanced_sort,
execution_hint,
fast_serialization,
fp_extension,
guarded_storage,
high_word,
insert_reference_bits_multiple,
interlocked_access1,
load_and_trap,
load_and_zero_rightmost_byte,
load_store_on_cond,
load_store_on_cond_2,
message_security_assist_extension3,
message_security_assist_extension4,
message_security_assist_extension5,
message_security_assist_extension7,
message_security_assist_extension8,
message_security_assist_extension9,
miscellaneous_extensions,
miscellaneous_extensions_2,
miscellaneous_extensions_3,
nnp_assist,
population_count,
processor_activity_instrumentation,
processor_assist,
reset_dat_protection,
reset_reference_bits_multiple,
soft_float,
transactional_execution,
vector,
vector_enhancements_1,
vector_enhancements_2,
vector_packed_decimal,
vector_packed_decimal_enhancement,
vector_packed_decimal_enhancement_2,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.bear_enhancement)] = .{
.llvm_name = "bear-enhancement",
.description = "Assume that the BEAR-enhancement facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.deflate_conversion)] = .{
.llvm_name = "deflate-conversion",
.description = "Assume that the deflate-conversion facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dfp_packed_conversion)] = .{
.llvm_name = "dfp-packed-conversion",
.description = "Assume that the DFP packed-conversion facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.dfp_zoned_conversion)] = .{
.llvm_name = "dfp-zoned-conversion",
.description = "Assume that the DFP zoned-conversion facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.distinct_ops)] = .{
.llvm_name = "distinct-ops",
.description = "Assume that the distinct-operands facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.enhanced_dat_2)] = .{
.llvm_name = "enhanced-dat-2",
.description = "Assume that the enhanced-DAT facility 2 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.enhanced_sort)] = .{
.llvm_name = "enhanced-sort",
.description = "Assume that the enhanced-sort facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.execution_hint)] = .{
.llvm_name = "execution-hint",
.description = "Assume that the execution-hint facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fast_serialization)] = .{
.llvm_name = "fast-serialization",
.description = "Assume that the fast-serialization facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fp_extension)] = .{
.llvm_name = "fp-extension",
.description = "Assume that the floating-point extension facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.guarded_storage)] = .{
.llvm_name = "guarded-storage",
.description = "Assume that the guarded-storage facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.high_word)] = .{
.llvm_name = "high-word",
.description = "Assume that the high-word facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.insert_reference_bits_multiple)] = .{
.llvm_name = "insert-reference-bits-multiple",
.description = "Assume that the insert-reference-bits-multiple facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.interlocked_access1)] = .{
.llvm_name = "interlocked-access1",
.description = "Assume that interlocked-access facility 1 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.load_and_trap)] = .{
.llvm_name = "load-and-trap",
.description = "Assume that the load-and-trap facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.load_and_zero_rightmost_byte)] = .{
.llvm_name = "load-and-zero-rightmost-byte",
.description = "Assume that the load-and-zero-rightmost-byte facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.load_store_on_cond)] = .{
.llvm_name = "load-store-on-cond",
.description = "Assume that the load/store-on-condition facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.load_store_on_cond_2)] = .{
.llvm_name = "load-store-on-cond-2",
.description = "Assume that the load/store-on-condition facility 2 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.message_security_assist_extension3)] = .{
.llvm_name = "message-security-assist-extension3",
.description = "Assume that the message-security-assist extension facility 3 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.message_security_assist_extension4)] = .{
.llvm_name = "message-security-assist-extension4",
.description = "Assume that the message-security-assist extension facility 4 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.message_security_assist_extension5)] = .{
.llvm_name = "message-security-assist-extension5",
.description = "Assume that the message-security-assist extension facility 5 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.message_security_assist_extension7)] = .{
.llvm_name = "message-security-assist-extension7",
.description = "Assume that the message-security-assist extension facility 7 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.message_security_assist_extension8)] = .{
.llvm_name = "message-security-assist-extension8",
.description = "Assume that the message-security-assist extension facility 8 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.message_security_assist_extension9)] = .{
.llvm_name = "message-security-assist-extension9",
.description = "Assume that the message-security-assist extension facility 9 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.miscellaneous_extensions)] = .{
.llvm_name = "miscellaneous-extensions",
.description = "Assume that the miscellaneous-extensions facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.miscellaneous_extensions_2)] = .{
.llvm_name = "miscellaneous-extensions-2",
.description = "Assume that the miscellaneous-extensions facility 2 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.miscellaneous_extensions_3)] = .{
.llvm_name = "miscellaneous-extensions-3",
.description = "Assume that the miscellaneous-extensions facility 3 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.nnp_assist)] = .{
.llvm_name = "nnp-assist",
.description = "Assume that the NNP-assist facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.population_count)] = .{
.llvm_name = "population-count",
.description = "Assume that the population-count facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.processor_activity_instrumentation)] = .{
.llvm_name = "processor-activity-instrumentation",
.description = "Assume that the processor-activity-instrumentation facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.processor_assist)] = .{
.llvm_name = "processor-assist",
.description = "Assume that the processor-assist facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reset_dat_protection)] = .{
.llvm_name = "reset-dat-protection",
.description = "Assume that the reset-DAT-protection facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.reset_reference_bits_multiple)] = .{
.llvm_name = "reset-reference-bits-multiple",
.description = "Assume that the reset-reference-bits-multiple facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.soft_float)] = .{
.llvm_name = "soft-float",
.description = "Use software emulation for floating point",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.transactional_execution)] = .{
.llvm_name = "transactional-execution",
.description = "Assume that the transactional-execution facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vector)] = .{
.llvm_name = "vector",
.description = "Assume that the vectory facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vector_enhancements_1)] = .{
.llvm_name = "vector-enhancements-1",
.description = "Assume that the vector enhancements facility 1 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vector_enhancements_2)] = .{
.llvm_name = "vector-enhancements-2",
.description = "Assume that the vector enhancements facility 2 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vector_packed_decimal)] = .{
.llvm_name = "vector-packed-decimal",
.description = "Assume that the vector packed decimal facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vector_packed_decimal_enhancement)] = .{
.llvm_name = "vector-packed-decimal-enhancement",
.description = "Assume that the vector packed decimal enhancement facility is installed",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vector_packed_decimal_enhancement_2)] = .{
.llvm_name = "vector-packed-decimal-enhancement-2",
.description = "Assume that the vector packed decimal enhancement facility 2 is installed",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const arch10 = CpuModel{
.name = "arch10",
.llvm_name = "arch10",
.features = featureSet(&[_]Feature{
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.execution_hint,
.fast_serialization,
.fp_extension,
.high_word,
.interlocked_access1,
.load_and_trap,
.load_store_on_cond,
.message_security_assist_extension3,
.message_security_assist_extension4,
.miscellaneous_extensions,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
}),
};
pub const arch11 = CpuModel{
.name = "arch11",
.llvm_name = "arch11",
.features = featureSet(&[_]Feature{
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.execution_hint,
.fast_serialization,
.fp_extension,
.high_word,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.miscellaneous_extensions,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
}),
};
pub const arch12 = CpuModel{
.name = "arch12",
.llvm_name = "arch12",
.features = featureSet(&[_]Feature{
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.execution_hint,
.fast_serialization,
.fp_extension,
.guarded_storage,
.high_word,
.insert_reference_bits_multiple,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.message_security_assist_extension7,
.message_security_assist_extension8,
.miscellaneous_extensions,
.miscellaneous_extensions_2,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
.vector_enhancements_1,
.vector_packed_decimal,
}),
};
pub const arch13 = CpuModel{
.name = "arch13",
.llvm_name = "arch13",
.features = featureSet(&[_]Feature{
.deflate_conversion,
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.enhanced_sort,
.execution_hint,
.fast_serialization,
.fp_extension,
.guarded_storage,
.high_word,
.insert_reference_bits_multiple,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.message_security_assist_extension7,
.message_security_assist_extension8,
.message_security_assist_extension9,
.miscellaneous_extensions,
.miscellaneous_extensions_2,
.miscellaneous_extensions_3,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
.vector_enhancements_1,
.vector_enhancements_2,
.vector_packed_decimal,
.vector_packed_decimal_enhancement,
}),
};
pub const arch14 = CpuModel{
.name = "arch14",
.llvm_name = "arch14",
.features = featureSet(&[_]Feature{
.bear_enhancement,
.deflate_conversion,
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.enhanced_sort,
.execution_hint,
.fast_serialization,
.fp_extension,
.guarded_storage,
.high_word,
.insert_reference_bits_multiple,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.message_security_assist_extension7,
.message_security_assist_extension8,
.message_security_assist_extension9,
.miscellaneous_extensions,
.miscellaneous_extensions_2,
.miscellaneous_extensions_3,
.nnp_assist,
.population_count,
.processor_activity_instrumentation,
.processor_assist,
.reset_dat_protection,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
.vector_enhancements_1,
.vector_enhancements_2,
.vector_packed_decimal,
.vector_packed_decimal_enhancement,
.vector_packed_decimal_enhancement_2,
}),
};
pub const arch8 = CpuModel{
.name = "arch8",
.llvm_name = "arch8",
.features = featureSet(&[_]Feature{}),
};
pub const arch9 = CpuModel{
.name = "arch9",
.llvm_name = "arch9",
.features = featureSet(&[_]Feature{
.distinct_ops,
.fast_serialization,
.fp_extension,
.high_word,
.interlocked_access1,
.load_store_on_cond,
.message_security_assist_extension3,
.message_security_assist_extension4,
.population_count,
.reset_reference_bits_multiple,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
pub const z10 = CpuModel{
.name = "z10",
.llvm_name = "z10",
.features = featureSet(&[_]Feature{}),
};
pub const z13 = CpuModel{
.name = "z13",
.llvm_name = "z13",
.features = featureSet(&[_]Feature{
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.execution_hint,
.fast_serialization,
.fp_extension,
.high_word,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.miscellaneous_extensions,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
}),
};
pub const z14 = CpuModel{
.name = "z14",
.llvm_name = "z14",
.features = featureSet(&[_]Feature{
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.execution_hint,
.fast_serialization,
.fp_extension,
.guarded_storage,
.high_word,
.insert_reference_bits_multiple,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.message_security_assist_extension7,
.message_security_assist_extension8,
.miscellaneous_extensions,
.miscellaneous_extensions_2,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
.vector_enhancements_1,
.vector_packed_decimal,
}),
};
pub const z15 = CpuModel{
.name = "z15",
.llvm_name = "z15",
.features = featureSet(&[_]Feature{
.deflate_conversion,
.dfp_packed_conversion,
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.enhanced_sort,
.execution_hint,
.fast_serialization,
.fp_extension,
.guarded_storage,
.high_word,
.insert_reference_bits_multiple,
.interlocked_access1,
.load_and_trap,
.load_and_zero_rightmost_byte,
.load_store_on_cond,
.load_store_on_cond_2,
.message_security_assist_extension3,
.message_security_assist_extension4,
.message_security_assist_extension5,
.message_security_assist_extension7,
.message_security_assist_extension8,
.message_security_assist_extension9,
.miscellaneous_extensions,
.miscellaneous_extensions_2,
.miscellaneous_extensions_3,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
.vector,
.vector_enhancements_1,
.vector_enhancements_2,
.vector_packed_decimal,
.vector_packed_decimal_enhancement,
}),
};
pub const z196 = CpuModel{
.name = "z196",
.llvm_name = "z196",
.features = featureSet(&[_]Feature{
.distinct_ops,
.fast_serialization,
.fp_extension,
.high_word,
.interlocked_access1,
.load_store_on_cond,
.message_security_assist_extension3,
.message_security_assist_extension4,
.population_count,
.reset_reference_bits_multiple,
}),
};
pub const zEC12 = CpuModel{
.name = "zEC12",
.llvm_name = "zEC12",
.features = featureSet(&[_]Feature{
.dfp_zoned_conversion,
.distinct_ops,
.enhanced_dat_2,
.execution_hint,
.fast_serialization,
.fp_extension,
.high_word,
.interlocked_access1,
.load_and_trap,
.load_store_on_cond,
.message_security_assist_extension3,
.message_security_assist_extension4,
.miscellaneous_extensions,
.population_count,
.processor_assist,
.reset_reference_bits_multiple,
.transactional_execution,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/powerpc.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
@"64bit",
@"64bitregs",
aix,
allow_unaligned_fp_access,
altivec,
booke,
bpermd,
cmpb,
crbits,
crypto,
direct_move,
e500,
efpu2,
extdiv,
fcpsgn,
float128,
fpcvt,
fprnd,
fpu,
fre,
fres,
frsqrte,
frsqrtes,
fsqrt,
fuse_addi_load,
fuse_addis_load,
fuse_store,
fusion,
hard_float,
htm,
icbt,
invariant_function_descriptors,
isa_v207_instructions,
isa_v30_instructions,
isa_v31_instructions,
isel,
ldbrx,
lfiwax,
longcall,
mfocrf,
mma,
modern_aix_as,
msync,
paired_vector_memops,
partword_atomics,
pcrelative_memops,
popcntd,
power10_vector,
power8_altivec,
power8_vector,
power9_altivec,
power9_vector,
ppc4xx,
ppc6xx,
ppc_postra_sched,
ppc_prera_sched,
predictable_select_expensive,
prefix_instrs,
privileged,
quadword_atomics,
recipprec,
rop_protect,
secure_plt,
slow_popcntd,
spe,
stfiwx,
two_const_nr,
vectors_use_two_units,
vsx,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.@"64bit")] = .{
.llvm_name = "64bit",
.description = "Enable 64-bit instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.@"64bitregs")] = .{
.llvm_name = "64bitregs",
.description = "Enable 64-bit registers usage for ppc32 [beta]",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.aix)] = .{
.llvm_name = "aix",
.description = "AIX OS",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.allow_unaligned_fp_access)] = .{
.llvm_name = "allow-unaligned-fp-access",
.description = "CPU does not trap on unaligned FP access",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.altivec)] = .{
.llvm_name = "altivec",
.description = "Enable Altivec instructions",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.booke)] = .{
.llvm_name = "booke",
.description = "Enable Book E instructions",
.dependencies = featureSet(&[_]Feature{
.icbt,
}),
};
result[@intFromEnum(Feature.bpermd)] = .{
.llvm_name = "bpermd",
.description = "Enable the bpermd instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.cmpb)] = .{
.llvm_name = "cmpb",
.description = "Enable the cmpb instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.crbits)] = .{
.llvm_name = "crbits",
.description = "Use condition-register bits individually",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.crypto)] = .{
.llvm_name = "crypto",
.description = "Enable POWER8 Crypto instructions",
.dependencies = featureSet(&[_]Feature{
.power8_altivec,
}),
};
result[@intFromEnum(Feature.direct_move)] = .{
.llvm_name = "direct-move",
.description = "Enable Power8 direct move instructions",
.dependencies = featureSet(&[_]Feature{
.vsx,
}),
};
result[@intFromEnum(Feature.e500)] = .{
.llvm_name = "e500",
.description = "Enable E500/E500mc instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.efpu2)] = .{
.llvm_name = "efpu2",
.description = "Enable Embedded Floating-Point APU 2 instructions",
.dependencies = featureSet(&[_]Feature{
.spe,
}),
};
result[@intFromEnum(Feature.extdiv)] = .{
.llvm_name = "extdiv",
.description = "Enable extended divide instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.fcpsgn)] = .{
.llvm_name = "fcpsgn",
.description = "Enable the fcpsgn instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.float128)] = .{
.llvm_name = "float128",
.description = "Enable the __float128 data type for IEEE-754R Binary128.",
.dependencies = featureSet(&[_]Feature{
.vsx,
}),
};
result[@intFromEnum(Feature.fpcvt)] = .{
.llvm_name = "fpcvt",
.description = "Enable fc[ft]* (unsigned and single-precision) and lfiwzx instructions",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.fprnd)] = .{
.llvm_name = "fprnd",
.description = "Enable the fri[mnpz] instructions",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.fpu)] = .{
.llvm_name = "fpu",
.description = "Enable classic FPU instructions",
.dependencies = featureSet(&[_]Feature{
.hard_float,
}),
};
result[@intFromEnum(Feature.fre)] = .{
.llvm_name = "fre",
.description = "Enable the fre instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.fres)] = .{
.llvm_name = "fres",
.description = "Enable the fres instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.frsqrte)] = .{
.llvm_name = "frsqrte",
.description = "Enable the frsqrte instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.frsqrtes)] = .{
.llvm_name = "frsqrtes",
.description = "Enable the frsqrtes instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.fsqrt)] = .{
.llvm_name = "fsqrt",
.description = "Enable the fsqrt instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.fuse_addi_load)] = .{
.llvm_name = "fuse-addi-load",
.description = "Power8 Addi-Load fusion",
.dependencies = featureSet(&[_]Feature{
.fusion,
}),
};
result[@intFromEnum(Feature.fuse_addis_load)] = .{
.llvm_name = "fuse-addis-load",
.description = "Power8 Addis-Load fusion",
.dependencies = featureSet(&[_]Feature{
.fusion,
}),
};
result[@intFromEnum(Feature.fuse_store)] = .{
.llvm_name = "fuse-store",
.description = "Target supports store clustering",
.dependencies = featureSet(&[_]Feature{
.fusion,
}),
};
result[@intFromEnum(Feature.fusion)] = .{
.llvm_name = "fusion",
.description = "Target supports instruction fusion",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.hard_float)] = .{
.llvm_name = "hard-float",
.description = "Enable floating-point instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.htm)] = .{
.llvm_name = "htm",
.description = "Enable Hardware Transactional Memory instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.icbt)] = .{
.llvm_name = "icbt",
.description = "Enable icbt instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.invariant_function_descriptors)] = .{
.llvm_name = "invariant-function-descriptors",
.description = "Assume function descriptors are invariant",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.isa_v207_instructions)] = .{
.llvm_name = "isa-v207-instructions",
.description = "Enable instructions in ISA 2.07.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.isa_v30_instructions)] = .{
.llvm_name = "isa-v30-instructions",
.description = "Enable instructions in ISA 3.0.",
.dependencies = featureSet(&[_]Feature{
.isa_v207_instructions,
}),
};
result[@intFromEnum(Feature.isa_v31_instructions)] = .{
.llvm_name = "isa-v31-instructions",
.description = "Enable instructions in ISA 3.1.",
.dependencies = featureSet(&[_]Feature{
.isa_v30_instructions,
}),
};
result[@intFromEnum(Feature.isel)] = .{
.llvm_name = "isel",
.description = "Enable the isel instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ldbrx)] = .{
.llvm_name = "ldbrx",
.description = "Enable the ldbrx instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.lfiwax)] = .{
.llvm_name = "lfiwax",
.description = "Enable the lfiwax instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.longcall)] = .{
.llvm_name = "longcall",
.description = "Always use indirect calls",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mfocrf)] = .{
.llvm_name = "mfocrf",
.description = "Enable the MFOCRF instruction",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.mma)] = .{
.llvm_name = "mma",
.description = "Enable MMA instructions",
.dependencies = featureSet(&[_]Feature{
.paired_vector_memops,
.power8_vector,
.power9_altivec,
}),
};
result[@intFromEnum(Feature.modern_aix_as)] = .{
.llvm_name = "modern-aix-as",
.description = "AIX system assembler is modern enough to support new mnes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.msync)] = .{
.llvm_name = "msync",
.description = "Has only the msync instruction instead of sync",
.dependencies = featureSet(&[_]Feature{
.booke,
}),
};
result[@intFromEnum(Feature.paired_vector_memops)] = .{
.llvm_name = "paired-vector-memops",
.description = "32Byte load and store instructions",
.dependencies = featureSet(&[_]Feature{
.isa_v30_instructions,
}),
};
result[@intFromEnum(Feature.partword_atomics)] = .{
.llvm_name = "partword-atomics",
.description = "Enable l[bh]arx and st[bh]cx.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.pcrelative_memops)] = .{
.llvm_name = "pcrelative-memops",
.description = "Enable PC relative Memory Ops",
.dependencies = featureSet(&[_]Feature{
.prefix_instrs,
}),
};
result[@intFromEnum(Feature.popcntd)] = .{
.llvm_name = "popcntd",
.description = "Enable the popcnt[dw] instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.power10_vector)] = .{
.llvm_name = "power10-vector",
.description = "Enable POWER10 vector instructions",
.dependencies = featureSet(&[_]Feature{
.isa_v31_instructions,
.power9_vector,
}),
};
result[@intFromEnum(Feature.power8_altivec)] = .{
.llvm_name = "power8-altivec",
.description = "Enable POWER8 Altivec instructions",
.dependencies = featureSet(&[_]Feature{
.altivec,
}),
};
result[@intFromEnum(Feature.power8_vector)] = .{
.llvm_name = "power8-vector",
.description = "Enable POWER8 vector instructions",
.dependencies = featureSet(&[_]Feature{
.power8_altivec,
.vsx,
}),
};
result[@intFromEnum(Feature.power9_altivec)] = .{
.llvm_name = "power9-altivec",
.description = "Enable POWER9 Altivec instructions",
.dependencies = featureSet(&[_]Feature{
.isa_v30_instructions,
.power8_altivec,
}),
};
result[@intFromEnum(Feature.power9_vector)] = .{
.llvm_name = "power9-vector",
.description = "Enable POWER9 vector instructions",
.dependencies = featureSet(&[_]Feature{
.power8_vector,
.power9_altivec,
}),
};
result[@intFromEnum(Feature.ppc4xx)] = .{
.llvm_name = "ppc4xx",
.description = "Enable PPC 4xx instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ppc6xx)] = .{
.llvm_name = "ppc6xx",
.description = "Enable PPC 6xx instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ppc_postra_sched)] = .{
.llvm_name = "ppc-postra-sched",
.description = "Use PowerPC post-RA scheduling strategy",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ppc_prera_sched)] = .{
.llvm_name = "ppc-prera-sched",
.description = "Use PowerPC pre-RA scheduling strategy",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.predictable_select_expensive)] = .{
.llvm_name = "predictable-select-expensive",
.description = "Prefer likely predicted branches over selects",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.prefix_instrs)] = .{
.llvm_name = "prefix-instrs",
.description = "Enable prefixed instructions",
.dependencies = featureSet(&[_]Feature{
.power8_vector,
.power9_altivec,
}),
};
result[@intFromEnum(Feature.privileged)] = .{
.llvm_name = "privileged",
.description = "Add privileged instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.quadword_atomics)] = .{
.llvm_name = "quadword-atomics",
.description = "Enable lqarx and stqcx.",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.recipprec)] = .{
.llvm_name = "recipprec",
.description = "Assume higher precision reciprocal estimates",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.rop_protect)] = .{
.llvm_name = "rop-protect",
.description = "Add ROP protect",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.secure_plt)] = .{
.llvm_name = "secure-plt",
.description = "Enable secure plt mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.slow_popcntd)] = .{
.llvm_name = "slow-popcntd",
.description = "Has slow popcnt[dw] instructions",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.spe)] = .{
.llvm_name = "spe",
.description = "Enable SPE instructions",
.dependencies = featureSet(&[_]Feature{
.hard_float,
}),
};
result[@intFromEnum(Feature.stfiwx)] = .{
.llvm_name = "stfiwx",
.description = "Enable the stfiwx instruction",
.dependencies = featureSet(&[_]Feature{
.fpu,
}),
};
result[@intFromEnum(Feature.two_const_nr)] = .{
.llvm_name = "two-const-nr",
.description = "Requires two constant Newton-Raphson computation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vectors_use_two_units)] = .{
.llvm_name = "vectors-use-two-units",
.description = "Vectors use two units",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.vsx)] = .{
.llvm_name = "vsx",
.description = "Enable VSX instructions",
.dependencies = featureSet(&[_]Feature{
.altivec,
}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const @"440" = CpuModel{
.name = "440",
.llvm_name = "440",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
.isel,
.msync,
}),
};
pub const @"450" = CpuModel{
.name = "450",
.llvm_name = "450",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
.isel,
.msync,
}),
};
pub const @"601" = CpuModel{
.name = "601",
.llvm_name = "601",
.features = featureSet(&[_]Feature{
.fpu,
}),
};
pub const @"602" = CpuModel{
.name = "602",
.llvm_name = "602",
.features = featureSet(&[_]Feature{
.fpu,
}),
};
pub const @"603" = CpuModel{
.name = "603",
.llvm_name = "603",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"603e" = CpuModel{
.name = "603e",
.llvm_name = "603e",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"603ev" = CpuModel{
.name = "603ev",
.llvm_name = "603ev",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"604" = CpuModel{
.name = "604",
.llvm_name = "604",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"604e" = CpuModel{
.name = "604e",
.llvm_name = "604e",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"620" = CpuModel{
.name = "620",
.llvm_name = "620",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"7400" = CpuModel{
.name = "7400",
.llvm_name = "7400",
.features = featureSet(&[_]Feature{
.altivec,
.fres,
.frsqrte,
}),
};
pub const @"7450" = CpuModel{
.name = "7450",
.llvm_name = "7450",
.features = featureSet(&[_]Feature{
.altivec,
.fres,
.frsqrte,
}),
};
pub const @"750" = CpuModel{
.name = "750",
.llvm_name = "750",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const @"970" = CpuModel{
.name = "970",
.llvm_name = "970",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fres,
.frsqrte,
.fsqrt,
.mfocrf,
.stfiwx,
}),
};
pub const a2 = CpuModel{
.name = "a2",
.llvm_name = "a2",
.features = featureSet(&[_]Feature{
.@"64bit",
.booke,
.cmpb,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.recipprec,
.slow_popcntd,
.stfiwx,
}),
};
pub const e500 = CpuModel{
.name = "e500",
.llvm_name = "e500",
.features = featureSet(&[_]Feature{
.isel,
.msync,
.spe,
}),
};
pub const e500mc = CpuModel{
.name = "e500mc",
.llvm_name = "e500mc",
.features = featureSet(&[_]Feature{
.booke,
.isel,
.stfiwx,
}),
};
pub const e5500 = CpuModel{
.name = "e5500",
.llvm_name = "e5500",
.features = featureSet(&[_]Feature{
.@"64bit",
.booke,
.isel,
.mfocrf,
.stfiwx,
}),
};
pub const future = CpuModel{
.name = "future",
.llvm_name = "future",
.features = featureSet(&[_]Feature{
.@"64bit",
.allow_unaligned_fp_access,
.bpermd,
.cmpb,
.crypto,
.direct_move,
.extdiv,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.fuse_store,
.htm,
.icbt,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.mma,
.partword_atomics,
.pcrelative_memops,
.popcntd,
.power10_vector,
.ppc_postra_sched,
.ppc_prera_sched,
.predictable_select_expensive,
.quadword_atomics,
.recipprec,
.stfiwx,
.two_const_nr,
}),
};
pub const g3 = CpuModel{
.name = "g3",
.llvm_name = "g3",
.features = featureSet(&[_]Feature{
.fres,
.frsqrte,
}),
};
pub const g4 = CpuModel{
.name = "g4",
.llvm_name = "g4",
.features = featureSet(&[_]Feature{
.altivec,
.fres,
.frsqrte,
}),
};
pub const @"g4+" = CpuModel{
.name = "g4+",
.llvm_name = "g4+",
.features = featureSet(&[_]Feature{
.altivec,
.fres,
.frsqrte,
}),
};
pub const g5 = CpuModel{
.name = "g5",
.llvm_name = "g5",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fres,
.frsqrte,
.fsqrt,
.mfocrf,
.stfiwx,
}),
};
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{
.hard_float,
}),
};
pub const ppc = CpuModel{
.name = "ppc",
.llvm_name = "ppc",
.features = featureSet(&[_]Feature{
.hard_float,
}),
};
pub const ppc64 = CpuModel{
.name = "ppc64",
.llvm_name = "ppc64",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fres,
.frsqrte,
.fsqrt,
.mfocrf,
.stfiwx,
}),
};
pub const ppc64le = CpuModel{
.name = "ppc64le",
.llvm_name = "ppc64le",
.features = featureSet(&[_]Feature{
.@"64bit",
.allow_unaligned_fp_access,
.bpermd,
.cmpb,
.crypto,
.direct_move,
.extdiv,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.fuse_addi_load,
.fuse_addis_load,
.htm,
.icbt,
.isa_v207_instructions,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.partword_atomics,
.popcntd,
.power8_vector,
.predictable_select_expensive,
.quadword_atomics,
.recipprec,
.stfiwx,
.two_const_nr,
}),
};
pub const pwr10 = CpuModel{
.name = "pwr10",
.llvm_name = "pwr10",
.features = featureSet(&[_]Feature{
.@"64bit",
.allow_unaligned_fp_access,
.bpermd,
.cmpb,
.crypto,
.direct_move,
.extdiv,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.fuse_store,
.htm,
.icbt,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.mma,
.partword_atomics,
.pcrelative_memops,
.popcntd,
.power10_vector,
.ppc_postra_sched,
.ppc_prera_sched,
.predictable_select_expensive,
.quadword_atomics,
.recipprec,
.stfiwx,
.two_const_nr,
}),
};
pub const pwr3 = CpuModel{
.name = "pwr3",
.llvm_name = "pwr3",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fres,
.frsqrte,
.mfocrf,
.stfiwx,
}),
};
pub const pwr4 = CpuModel{
.name = "pwr4",
.llvm_name = "pwr4",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fres,
.frsqrte,
.fsqrt,
.mfocrf,
.stfiwx,
}),
};
pub const pwr5 = CpuModel{
.name = "pwr5",
.llvm_name = "pwr5",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.mfocrf,
.stfiwx,
}),
};
pub const pwr5x = CpuModel{
.name = "pwr5x",
.llvm_name = "pwr5x",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.mfocrf,
.stfiwx,
}),
};
pub const pwr6 = CpuModel{
.name = "pwr6",
.llvm_name = "pwr6",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.cmpb,
.fcpsgn,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.lfiwax,
.mfocrf,
.recipprec,
.stfiwx,
}),
};
pub const pwr6x = CpuModel{
.name = "pwr6x",
.llvm_name = "pwr6x",
.features = featureSet(&[_]Feature{
.@"64bit",
.altivec,
.cmpb,
.fcpsgn,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.lfiwax,
.mfocrf,
.recipprec,
.stfiwx,
}),
};
pub const pwr7 = CpuModel{
.name = "pwr7",
.llvm_name = "pwr7",
.features = featureSet(&[_]Feature{
.@"64bit",
.allow_unaligned_fp_access,
.bpermd,
.cmpb,
.extdiv,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.popcntd,
.recipprec,
.stfiwx,
.two_const_nr,
.vsx,
}),
};
pub const pwr8 = CpuModel{
.name = "pwr8",
.llvm_name = "pwr8",
.features = featureSet(&[_]Feature{
.@"64bit",
.allow_unaligned_fp_access,
.bpermd,
.cmpb,
.crypto,
.direct_move,
.extdiv,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.fuse_addi_load,
.fuse_addis_load,
.htm,
.icbt,
.isa_v207_instructions,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.partword_atomics,
.popcntd,
.power8_vector,
.predictable_select_expensive,
.quadword_atomics,
.recipprec,
.stfiwx,
.two_const_nr,
}),
};
pub const pwr9 = CpuModel{
.name = "pwr9",
.llvm_name = "pwr9",
.features = featureSet(&[_]Feature{
.@"64bit",
.allow_unaligned_fp_access,
.bpermd,
.cmpb,
.crypto,
.direct_move,
.extdiv,
.fcpsgn,
.fpcvt,
.fprnd,
.fre,
.fres,
.frsqrte,
.frsqrtes,
.fsqrt,
.htm,
.icbt,
.isel,
.ldbrx,
.lfiwax,
.mfocrf,
.partword_atomics,
.popcntd,
.power9_vector,
.ppc_postra_sched,
.ppc_prera_sched,
.predictable_select_expensive,
.quadword_atomics,
.recipprec,
.stfiwx,
.two_const_nr,
.vectors_use_two_units,
}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/spirv.zig | //! This file is auto-generated by tools/update_spirv_features.zig.
//! TODO: Dependencies of capabilities on extensions.
//! TODO: Dependencies of extensions on extensions.
//! TODO: Dependencies of extensions on versions.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
v1_1,
v1_2,
v1_3,
v1_4,
v1_5,
SPV_AMD_shader_fragment_mask,
SPV_AMD_gpu_shader_int16,
SPV_AMD_gpu_shader_half_float,
SPV_AMD_texture_gather_bias_lod,
SPV_AMD_shader_ballot,
SPV_AMD_gcn_shader,
SPV_AMD_shader_image_load_store_lod,
SPV_AMD_shader_explicit_vertex_parameter,
SPV_AMD_shader_trinary_minmax,
SPV_AMD_gpu_shader_half_float_fetch,
SPV_GOOGLE_hlsl_functionality1,
SPV_GOOGLE_user_type,
SPV_GOOGLE_decorate_string,
SPV_EXT_demote_to_helper_invocation,
SPV_EXT_descriptor_indexing,
SPV_EXT_fragment_fully_covered,
SPV_EXT_shader_stencil_export,
SPV_EXT_physical_storage_buffer,
SPV_EXT_shader_atomic_float_add,
SPV_EXT_shader_atomic_float_min_max,
SPV_EXT_shader_image_int64,
SPV_EXT_fragment_shader_interlock,
SPV_EXT_fragment_invocation_density,
SPV_EXT_shader_viewport_index_layer,
SPV_INTEL_loop_fuse,
SPV_INTEL_fpga_dsp_control,
SPV_INTEL_fpga_reg,
SPV_INTEL_fpga_memory_accesses,
SPV_INTEL_fpga_loop_controls,
SPV_INTEL_io_pipes,
SPV_INTEL_unstructured_loop_controls,
SPV_INTEL_blocking_pipes,
SPV_INTEL_device_side_avc_motion_estimation,
SPV_INTEL_fpga_memory_attributes,
SPV_INTEL_fp_fast_math_mode,
SPV_INTEL_media_block_io,
SPV_INTEL_shader_integer_functions2,
SPV_INTEL_subgroups,
SPV_INTEL_fpga_cluster_attributes,
SPV_INTEL_kernel_attributes,
SPV_INTEL_arbitrary_precision_integers,
SPV_KHR_8bit_storage,
SPV_KHR_shader_clock,
SPV_KHR_device_group,
SPV_KHR_16bit_storage,
SPV_KHR_variable_pointers,
SPV_KHR_no_integer_wrap_decoration,
SPV_KHR_subgroup_vote,
SPV_KHR_multiview,
SPV_KHR_shader_ballot,
SPV_KHR_vulkan_memory_model,
SPV_KHR_physical_storage_buffer,
SPV_KHR_workgroup_memory_explicit_layout,
SPV_KHR_fragment_shading_rate,
SPV_KHR_shader_atomic_counter_ops,
SPV_KHR_shader_draw_parameters,
SPV_KHR_storage_buffer_storage_class,
SPV_KHR_linkonce_odr,
SPV_KHR_terminate_invocation,
SPV_KHR_non_semantic_info,
SPV_KHR_post_depth_coverage,
SPV_KHR_expect_assume,
SPV_KHR_ray_tracing,
SPV_KHR_ray_query,
SPV_KHR_float_controls,
SPV_NV_viewport_array2,
SPV_NV_shader_subgroup_partitioned,
SPV_NVX_multiview_per_view_attributes,
SPV_NV_ray_tracing,
SPV_NV_shader_image_footprint,
SPV_NV_shading_rate,
SPV_NV_stereo_view_rendering,
SPV_NV_compute_shader_derivatives,
SPV_NV_shader_sm_builtins,
SPV_NV_mesh_shader,
SPV_NV_geometry_shader_passthrough,
SPV_NV_fragment_shader_barycentric,
SPV_NV_cooperative_matrix,
SPV_NV_sample_mask_override_coverage,
Matrix,
Shader,
Geometry,
Tessellation,
Addresses,
Linkage,
Kernel,
Vector16,
Float16Buffer,
Float16,
Float64,
Int64,
Int64Atomics,
ImageBasic,
ImageReadWrite,
ImageMipmap,
Pipes,
Groups,
DeviceEnqueue,
LiteralSampler,
AtomicStorage,
Int16,
TessellationPointSize,
GeometryPointSize,
ImageGatherExtended,
StorageImageMultisample,
UniformBufferArrayDynamicIndexing,
SampledImageArrayDynamicIndexing,
StorageBufferArrayDynamicIndexing,
StorageImageArrayDynamicIndexing,
ClipDistance,
CullDistance,
ImageCubeArray,
SampleRateShading,
ImageRect,
SampledRect,
GenericPointer,
Int8,
InputAttachment,
SparseResidency,
MinLod,
Sampled1D,
Image1D,
SampledCubeArray,
SampledBuffer,
ImageBuffer,
ImageMSArray,
StorageImageExtendedFormats,
ImageQuery,
DerivativeControl,
InterpolationFunction,
TransformFeedback,
GeometryStreams,
StorageImageReadWithoutFormat,
StorageImageWriteWithoutFormat,
MultiViewport,
SubgroupDispatch,
NamedBarrier,
PipeStorage,
GroupNonUniform,
GroupNonUniformVote,
GroupNonUniformArithmetic,
GroupNonUniformBallot,
GroupNonUniformShuffle,
GroupNonUniformShuffleRelative,
GroupNonUniformClustered,
GroupNonUniformQuad,
ShaderLayer,
ShaderViewportIndex,
FragmentShadingRateKHR,
SubgroupBallotKHR,
DrawParameters,
WorkgroupMemoryExplicitLayoutKHR,
WorkgroupMemoryExplicitLayout8BitAccessKHR,
WorkgroupMemoryExplicitLayout16BitAccessKHR,
SubgroupVoteKHR,
StorageBuffer16BitAccess,
StorageUniformBufferBlock16,
UniformAndStorageBuffer16BitAccess,
StorageUniform16,
StoragePushConstant16,
StorageInputOutput16,
DeviceGroup,
MultiView,
VariablePointersStorageBuffer,
VariablePointers,
AtomicStorageOps,
SampleMaskPostDepthCoverage,
StorageBuffer8BitAccess,
UniformAndStorageBuffer8BitAccess,
StoragePushConstant8,
DenormPreserve,
DenormFlushToZero,
SignedZeroInfNanPreserve,
RoundingModeRTE,
RoundingModeRTZ,
RayQueryProvisionalKHR,
RayQueryKHR,
RayTraversalPrimitiveCullingKHR,
RayTracingKHR,
Float16ImageAMD,
ImageGatherBiasLodAMD,
FragmentMaskAMD,
StencilExportEXT,
ImageReadWriteLodAMD,
Int64ImageEXT,
ShaderClockKHR,
SampleMaskOverrideCoverageNV,
GeometryShaderPassthroughNV,
ShaderViewportIndexLayerEXT,
ShaderViewportIndexLayerNV,
ShaderViewportMaskNV,
ShaderStereoViewNV,
PerViewAttributesNV,
FragmentFullyCoveredEXT,
MeshShadingNV,
ImageFootprintNV,
FragmentBarycentricNV,
ComputeDerivativeGroupQuadsNV,
FragmentDensityEXT,
ShadingRateNV,
GroupNonUniformPartitionedNV,
ShaderNonUniform,
ShaderNonUniformEXT,
RuntimeDescriptorArray,
RuntimeDescriptorArrayEXT,
InputAttachmentArrayDynamicIndexing,
InputAttachmentArrayDynamicIndexingEXT,
UniformTexelBufferArrayDynamicIndexing,
UniformTexelBufferArrayDynamicIndexingEXT,
StorageTexelBufferArrayDynamicIndexing,
StorageTexelBufferArrayDynamicIndexingEXT,
UniformBufferArrayNonUniformIndexing,
UniformBufferArrayNonUniformIndexingEXT,
SampledImageArrayNonUniformIndexing,
SampledImageArrayNonUniformIndexingEXT,
StorageBufferArrayNonUniformIndexing,
StorageBufferArrayNonUniformIndexingEXT,
StorageImageArrayNonUniformIndexing,
StorageImageArrayNonUniformIndexingEXT,
InputAttachmentArrayNonUniformIndexing,
InputAttachmentArrayNonUniformIndexingEXT,
UniformTexelBufferArrayNonUniformIndexing,
UniformTexelBufferArrayNonUniformIndexingEXT,
StorageTexelBufferArrayNonUniformIndexing,
StorageTexelBufferArrayNonUniformIndexingEXT,
RayTracingNV,
VulkanMemoryModel,
VulkanMemoryModelKHR,
VulkanMemoryModelDeviceScope,
VulkanMemoryModelDeviceScopeKHR,
PhysicalStorageBufferAddresses,
PhysicalStorageBufferAddressesEXT,
ComputeDerivativeGroupLinearNV,
RayTracingProvisionalKHR,
CooperativeMatrixNV,
FragmentShaderSampleInterlockEXT,
FragmentShaderShadingRateInterlockEXT,
ShaderSMBuiltinsNV,
FragmentShaderPixelInterlockEXT,
DemoteToHelperInvocationEXT,
SubgroupShuffleINTEL,
SubgroupBufferBlockIOINTEL,
SubgroupImageBlockIOINTEL,
SubgroupImageMediaBlockIOINTEL,
RoundToInfinityINTEL,
FloatingPointModeINTEL,
IntegerFunctions2INTEL,
FunctionPointersINTEL,
IndirectReferencesINTEL,
AsmINTEL,
AtomicFloat32MinMaxEXT,
AtomicFloat64MinMaxEXT,
AtomicFloat16MinMaxEXT,
VectorComputeINTEL,
VectorAnyINTEL,
ExpectAssumeKHR,
SubgroupAvcMotionEstimationINTEL,
SubgroupAvcMotionEstimationIntraINTEL,
SubgroupAvcMotionEstimationChromaINTEL,
VariableLengthArrayINTEL,
FunctionFloatControlINTEL,
FPGAMemoryAttributesINTEL,
FPFastMathModeINTEL,
ArbitraryPrecisionIntegersINTEL,
UnstructuredLoopControlsINTEL,
FPGALoopControlsINTEL,
KernelAttributesINTEL,
FPGAKernelAttributesINTEL,
FPGAMemoryAccessesINTEL,
FPGAClusterAttributesINTEL,
LoopFuseINTEL,
FPGABufferLocationINTEL,
USMStorageClassesINTEL,
IOPipesINTEL,
BlockingPipesINTEL,
FPGARegINTEL,
AtomicFloat32AddEXT,
AtomicFloat64AddEXT,
LongConstantCompositeINTEL,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
@setEvalBranchQuota(2000);
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.v1_1)] = .{
.llvm_name = null,
.description = "SPIR-V version 1.1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.v1_2)] = .{
.llvm_name = null,
.description = "SPIR-V version 1.2",
.dependencies = featureSet(&[_]Feature{
.v1_1,
}),
};
result[@intFromEnum(Feature.v1_3)] = .{
.llvm_name = null,
.description = "SPIR-V version 1.3",
.dependencies = featureSet(&[_]Feature{
.v1_2,
}),
};
result[@intFromEnum(Feature.v1_4)] = .{
.llvm_name = null,
.description = "SPIR-V version 1.4",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.v1_5)] = .{
.llvm_name = null,
.description = "SPIR-V version 1.5",
.dependencies = featureSet(&[_]Feature{
.v1_4,
}),
};
result[@intFromEnum(Feature.SPV_AMD_shader_fragment_mask)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_shader_fragment_mask",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_gpu_shader_int16)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_gpu_shader_int16",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_gpu_shader_half_float)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_gpu_shader_half_float",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_texture_gather_bias_lod)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_texture_gather_bias_lod",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_shader_ballot)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_shader_ballot",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_gcn_shader)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_gcn_shader",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_shader_image_load_store_lod)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_shader_image_load_store_lod",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_shader_explicit_vertex_parameter)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_shader_explicit_vertex_parameter",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_shader_trinary_minmax)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_shader_trinary_minmax",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_AMD_gpu_shader_half_float_fetch)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_AMD_gpu_shader_half_float_fetch",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_GOOGLE_hlsl_functionality1)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_GOOGLE_hlsl_functionality1",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_GOOGLE_user_type)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_GOOGLE_user_type",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_GOOGLE_decorate_string)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_GOOGLE_decorate_string",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_demote_to_helper_invocation)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_demote_to_helper_invocation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_descriptor_indexing)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_descriptor_indexing",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_fragment_fully_covered)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_fragment_fully_covered",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_shader_stencil_export)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_shader_stencil_export",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_physical_storage_buffer)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_physical_storage_buffer",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float_add)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_shader_atomic_float_add",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_shader_atomic_float_min_max)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_shader_atomic_float_min_max",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_shader_image_int64)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_shader_image_int64",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_fragment_shader_interlock)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_fragment_shader_interlock",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_fragment_invocation_density)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_fragment_invocation_density",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_EXT_shader_viewport_index_layer)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_EXT_shader_viewport_index_layer",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_loop_fuse)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_loop_fuse",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fpga_dsp_control)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fpga_dsp_control",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fpga_reg)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fpga_reg",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fpga_memory_accesses)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fpga_memory_accesses",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fpga_loop_controls)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fpga_loop_controls",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_io_pipes)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_io_pipes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_unstructured_loop_controls)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_unstructured_loop_controls",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_blocking_pipes)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_blocking_pipes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_device_side_avc_motion_estimation)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_device_side_avc_motion_estimation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fpga_memory_attributes)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fpga_memory_attributes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fp_fast_math_mode)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fp_fast_math_mode",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_media_block_io)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_media_block_io",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_shader_integer_functions2)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_shader_integer_functions2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_subgroups)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_subgroups",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_fpga_cluster_attributes)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_fpga_cluster_attributes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_kernel_attributes)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_kernel_attributes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_INTEL_arbitrary_precision_integers)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_INTEL_arbitrary_precision_integers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_8bit_storage)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_8bit_storage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_shader_clock)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_shader_clock",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_device_group)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_device_group",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_16bit_storage)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_16bit_storage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_variable_pointers)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_variable_pointers",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_no_integer_wrap_decoration)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_no_integer_wrap_decoration",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_subgroup_vote)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_subgroup_vote",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_multiview)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_multiview",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_shader_ballot)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_shader_ballot",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_vulkan_memory_model)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_vulkan_memory_model",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_physical_storage_buffer)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_physical_storage_buffer",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_workgroup_memory_explicit_layout)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_workgroup_memory_explicit_layout",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_fragment_shading_rate)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_fragment_shading_rate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_shader_atomic_counter_ops)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_shader_atomic_counter_ops",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_shader_draw_parameters)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_shader_draw_parameters",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_storage_buffer_storage_class)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_storage_buffer_storage_class",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_linkonce_odr)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_linkonce_odr",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_terminate_invocation)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_terminate_invocation",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_non_semantic_info)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_non_semantic_info",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_post_depth_coverage)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_post_depth_coverage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_expect_assume)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_expect_assume",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_ray_tracing)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_ray_tracing",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_ray_query)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_ray_query",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_KHR_float_controls)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_KHR_float_controls",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_viewport_array2)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_viewport_array2",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_shader_subgroup_partitioned)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_shader_subgroup_partitioned",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NVX_multiview_per_view_attributes)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NVX_multiview_per_view_attributes",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_ray_tracing)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_ray_tracing",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_shader_image_footprint)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_shader_image_footprint",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_shading_rate)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_shading_rate",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_stereo_view_rendering)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_stereo_view_rendering",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_compute_shader_derivatives)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_compute_shader_derivatives",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_shader_sm_builtins)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_shader_sm_builtins",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_mesh_shader)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_mesh_shader",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_geometry_shader_passthrough)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_geometry_shader_passthrough",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_fragment_shader_barycentric)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_fragment_shader_barycentric",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_cooperative_matrix)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_cooperative_matrix",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SPV_NV_sample_mask_override_coverage)] = .{
.llvm_name = null,
.description = "SPIR-V extension SPV_NV_sample_mask_override_coverage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Matrix)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Matrix",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Shader)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Shader",
.dependencies = featureSet(&[_]Feature{
.Matrix,
}),
};
result[@intFromEnum(Feature.Geometry)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Geometry",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.Tessellation)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Tessellation",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.Addresses)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Addresses",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Linkage)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Linkage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Kernel)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Kernel",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Vector16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Vector16",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.Float16Buffer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Float16Buffer",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.Float16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Float16",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Float64)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Float64",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Int64)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int64",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Int64Atomics)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int64Atomics",
.dependencies = featureSet(&[_]Feature{
.Int64,
}),
};
result[@intFromEnum(Feature.ImageBasic)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageBasic",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.ImageReadWrite)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageReadWrite",
.dependencies = featureSet(&[_]Feature{
.ImageBasic,
}),
};
result[@intFromEnum(Feature.ImageMipmap)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageMipmap",
.dependencies = featureSet(&[_]Feature{
.ImageBasic,
}),
};
result[@intFromEnum(Feature.Pipes)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Pipes",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.Groups)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Groups",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.DeviceEnqueue)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DeviceEnqueue",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.LiteralSampler)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability LiteralSampler",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.AtomicStorage)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicStorage",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.Int16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int16",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.TessellationPointSize)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability TessellationPointSize",
.dependencies = featureSet(&[_]Feature{
.Tessellation,
}),
};
result[@intFromEnum(Feature.GeometryPointSize)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GeometryPointSize",
.dependencies = featureSet(&[_]Feature{
.Geometry,
}),
};
result[@intFromEnum(Feature.ImageGatherExtended)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageGatherExtended",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.StorageImageMultisample)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageMultisample",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.UniformBufferArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformBufferArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SampledImageArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledImageArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.StorageBufferArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageBufferArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.StorageImageArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ClipDistance)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ClipDistance",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.CullDistance)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability CullDistance",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ImageCubeArray)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageCubeArray",
.dependencies = featureSet(&[_]Feature{
.SampledCubeArray,
}),
};
result[@intFromEnum(Feature.SampleRateShading)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampleRateShading",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ImageRect)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageRect",
.dependencies = featureSet(&[_]Feature{
.SampledRect,
}),
};
result[@intFromEnum(Feature.SampledRect)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledRect",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.GenericPointer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GenericPointer",
.dependencies = featureSet(&[_]Feature{
.Addresses,
}),
};
result[@intFromEnum(Feature.Int8)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int8",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.InputAttachment)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability InputAttachment",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SparseResidency)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SparseResidency",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.MinLod)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability MinLod",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.Sampled1D)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Sampled1D",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.Image1D)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Image1D",
.dependencies = featureSet(&[_]Feature{
.Sampled1D,
}),
};
result[@intFromEnum(Feature.SampledCubeArray)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledCubeArray",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SampledBuffer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledBuffer",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ImageBuffer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageBuffer",
.dependencies = featureSet(&[_]Feature{
.SampledBuffer,
}),
};
result[@intFromEnum(Feature.ImageMSArray)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageMSArray",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.StorageImageExtendedFormats)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageExtendedFormats",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ImageQuery)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageQuery",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.DerivativeControl)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DerivativeControl",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.InterpolationFunction)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability InterpolationFunction",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.TransformFeedback)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability TransformFeedback",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.GeometryStreams)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GeometryStreams",
.dependencies = featureSet(&[_]Feature{
.Geometry,
}),
};
result[@intFromEnum(Feature.StorageImageReadWithoutFormat)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageReadWithoutFormat",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.StorageImageWriteWithoutFormat)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageWriteWithoutFormat",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.MultiViewport)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability MultiViewport",
.dependencies = featureSet(&[_]Feature{
.Geometry,
}),
};
result[@intFromEnum(Feature.SubgroupDispatch)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupDispatch",
.dependencies = featureSet(&[_]Feature{
.v1_1,
.DeviceEnqueue,
}),
};
result[@intFromEnum(Feature.NamedBarrier)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability NamedBarrier",
.dependencies = featureSet(&[_]Feature{
.v1_1,
.Kernel,
}),
};
result[@intFromEnum(Feature.PipeStorage)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability PipeStorage",
.dependencies = featureSet(&[_]Feature{
.v1_1,
.Pipes,
}),
};
result[@intFromEnum(Feature.GroupNonUniform)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniform",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.GroupNonUniformVote)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformVote",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.GroupNonUniformArithmetic)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformArithmetic",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.GroupNonUniformBallot)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformBallot",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.GroupNonUniformShuffle)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformShuffle",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.GroupNonUniformShuffleRelative)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformShuffleRelative",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.GroupNonUniformClustered)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformClustered",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.GroupNonUniformQuad)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformQuad",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.GroupNonUniform,
}),
};
result[@intFromEnum(Feature.ShaderLayer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderLayer",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.ShaderViewportIndex)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderViewportIndex",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.FragmentShadingRateKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentShadingRateKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SubgroupBallotKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupBallotKHR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.DrawParameters)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DrawParameters",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.Shader,
}),
};
result[@intFromEnum(Feature.WorkgroupMemoryExplicitLayoutKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayoutKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.WorkgroupMemoryExplicitLayout8BitAccessKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayout8BitAccessKHR",
.dependencies = featureSet(&[_]Feature{
.WorkgroupMemoryExplicitLayoutKHR,
}),
};
result[@intFromEnum(Feature.WorkgroupMemoryExplicitLayout16BitAccessKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability WorkgroupMemoryExplicitLayout16BitAccessKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SubgroupVoteKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupVoteKHR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.StorageBuffer16BitAccess)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageBuffer16BitAccess",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.StorageUniformBufferBlock16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageUniformBufferBlock16",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.UniformAndStorageBuffer16BitAccess)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformAndStorageBuffer16BitAccess",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.StorageBuffer16BitAccess,
.StorageUniformBufferBlock16,
}),
};
result[@intFromEnum(Feature.StorageUniform16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageUniform16",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.StorageBuffer16BitAccess,
.StorageUniformBufferBlock16,
}),
};
result[@intFromEnum(Feature.StoragePushConstant16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StoragePushConstant16",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.StorageInputOutput16)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageInputOutput16",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.DeviceGroup)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DeviceGroup",
.dependencies = featureSet(&[_]Feature{
.v1_3,
}),
};
result[@intFromEnum(Feature.MultiView)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability MultiView",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.Shader,
}),
};
result[@intFromEnum(Feature.VariablePointersStorageBuffer)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VariablePointersStorageBuffer",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.Shader,
}),
};
result[@intFromEnum(Feature.VariablePointers)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VariablePointers",
.dependencies = featureSet(&[_]Feature{
.v1_3,
.VariablePointersStorageBuffer,
}),
};
result[@intFromEnum(Feature.AtomicStorageOps)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicStorageOps",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SampleMaskPostDepthCoverage)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampleMaskPostDepthCoverage",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.StorageBuffer8BitAccess)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageBuffer8BitAccess",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.UniformAndStorageBuffer8BitAccess)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformAndStorageBuffer8BitAccess",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.StorageBuffer8BitAccess,
}),
};
result[@intFromEnum(Feature.StoragePushConstant8)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StoragePushConstant8",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.DenormPreserve)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DenormPreserve",
.dependencies = featureSet(&[_]Feature{
.v1_4,
}),
};
result[@intFromEnum(Feature.DenormFlushToZero)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DenormFlushToZero",
.dependencies = featureSet(&[_]Feature{
.v1_4,
}),
};
result[@intFromEnum(Feature.SignedZeroInfNanPreserve)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SignedZeroInfNanPreserve",
.dependencies = featureSet(&[_]Feature{
.v1_4,
}),
};
result[@intFromEnum(Feature.RoundingModeRTE)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RoundingModeRTE",
.dependencies = featureSet(&[_]Feature{
.v1_4,
}),
};
result[@intFromEnum(Feature.RoundingModeRTZ)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RoundingModeRTZ",
.dependencies = featureSet(&[_]Feature{
.v1_4,
}),
};
result[@intFromEnum(Feature.RayQueryProvisionalKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RayQueryProvisionalKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.RayQueryKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RayQueryKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.RayTraversalPrimitiveCullingKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RayTraversalPrimitiveCullingKHR",
.dependencies = featureSet(&[_]Feature{
.RayQueryKHR,
.RayTracingKHR,
}),
};
result[@intFromEnum(Feature.RayTracingKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RayTracingKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.Float16ImageAMD)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Float16ImageAMD",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ImageGatherBiasLodAMD)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageGatherBiasLodAMD",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.FragmentMaskAMD)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentMaskAMD",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.StencilExportEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StencilExportEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ImageReadWriteLodAMD)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageReadWriteLodAMD",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.Int64ImageEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability Int64ImageEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ShaderClockKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderClockKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SampleMaskOverrideCoverageNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampleMaskOverrideCoverageNV",
.dependencies = featureSet(&[_]Feature{
.SampleRateShading,
}),
};
result[@intFromEnum(Feature.GeometryShaderPassthroughNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GeometryShaderPassthroughNV",
.dependencies = featureSet(&[_]Feature{
.Geometry,
}),
};
result[@intFromEnum(Feature.ShaderViewportIndexLayerEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderViewportIndexLayerEXT",
.dependencies = featureSet(&[_]Feature{
.MultiViewport,
}),
};
result[@intFromEnum(Feature.ShaderViewportIndexLayerNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderViewportIndexLayerNV",
.dependencies = featureSet(&[_]Feature{
.MultiViewport,
}),
};
result[@intFromEnum(Feature.ShaderViewportMaskNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderViewportMaskNV",
.dependencies = featureSet(&[_]Feature{
.ShaderViewportIndexLayerNV,
}),
};
result[@intFromEnum(Feature.ShaderStereoViewNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderStereoViewNV",
.dependencies = featureSet(&[_]Feature{
.ShaderViewportMaskNV,
}),
};
result[@intFromEnum(Feature.PerViewAttributesNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability PerViewAttributesNV",
.dependencies = featureSet(&[_]Feature{
.MultiView,
}),
};
result[@intFromEnum(Feature.FragmentFullyCoveredEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentFullyCoveredEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.MeshShadingNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability MeshShadingNV",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ImageFootprintNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ImageFootprintNV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FragmentBarycentricNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentBarycentricNV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ComputeDerivativeGroupQuadsNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ComputeDerivativeGroupQuadsNV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FragmentDensityEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentDensityEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ShadingRateNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShadingRateNV",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.GroupNonUniformPartitionedNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability GroupNonUniformPartitionedNV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ShaderNonUniform)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderNonUniform",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.Shader,
}),
};
result[@intFromEnum(Feature.ShaderNonUniformEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderNonUniformEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.Shader,
}),
};
result[@intFromEnum(Feature.RuntimeDescriptorArray)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RuntimeDescriptorArray",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.Shader,
}),
};
result[@intFromEnum(Feature.RuntimeDescriptorArrayEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RuntimeDescriptorArrayEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.Shader,
}),
};
result[@intFromEnum(Feature.InputAttachmentArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability InputAttachmentArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.InputAttachment,
}),
};
result[@intFromEnum(Feature.InputAttachmentArrayDynamicIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability InputAttachmentArrayDynamicIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.InputAttachment,
}),
};
result[@intFromEnum(Feature.UniformTexelBufferArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformTexelBufferArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.SampledBuffer,
}),
};
result[@intFromEnum(Feature.UniformTexelBufferArrayDynamicIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformTexelBufferArrayDynamicIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.SampledBuffer,
}),
};
result[@intFromEnum(Feature.StorageTexelBufferArrayDynamicIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageTexelBufferArrayDynamicIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ImageBuffer,
}),
};
result[@intFromEnum(Feature.StorageTexelBufferArrayDynamicIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageTexelBufferArrayDynamicIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ImageBuffer,
}),
};
result[@intFromEnum(Feature.UniformBufferArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformBufferArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.UniformBufferArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformBufferArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.SampledImageArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledImageArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.SampledImageArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SampledImageArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.StorageBufferArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageBufferArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.StorageBufferArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageBufferArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.StorageImageArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.StorageImageArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageImageArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.InputAttachmentArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability InputAttachmentArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.InputAttachment,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.InputAttachmentArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability InputAttachmentArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.InputAttachment,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.UniformTexelBufferArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformTexelBufferArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.SampledBuffer,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.UniformTexelBufferArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UniformTexelBufferArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.SampledBuffer,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.StorageTexelBufferArrayNonUniformIndexing)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageTexelBufferArrayNonUniformIndexing",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ImageBuffer,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.StorageTexelBufferArrayNonUniformIndexingEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability StorageTexelBufferArrayNonUniformIndexingEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.ImageBuffer,
.ShaderNonUniform,
}),
};
result[@intFromEnum(Feature.RayTracingNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RayTracingNV",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.VulkanMemoryModel)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VulkanMemoryModel",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.VulkanMemoryModelKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VulkanMemoryModelKHR",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.VulkanMemoryModelDeviceScope)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VulkanMemoryModelDeviceScope",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.VulkanMemoryModelDeviceScopeKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VulkanMemoryModelDeviceScopeKHR",
.dependencies = featureSet(&[_]Feature{
.v1_5,
}),
};
result[@intFromEnum(Feature.PhysicalStorageBufferAddresses)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability PhysicalStorageBufferAddresses",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.Shader,
}),
};
result[@intFromEnum(Feature.PhysicalStorageBufferAddressesEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability PhysicalStorageBufferAddressesEXT",
.dependencies = featureSet(&[_]Feature{
.v1_5,
.Shader,
}),
};
result[@intFromEnum(Feature.ComputeDerivativeGroupLinearNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ComputeDerivativeGroupLinearNV",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.RayTracingProvisionalKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RayTracingProvisionalKHR",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.CooperativeMatrixNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability CooperativeMatrixNV",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.FragmentShaderSampleInterlockEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentShaderSampleInterlockEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.FragmentShaderShadingRateInterlockEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentShaderShadingRateInterlockEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.ShaderSMBuiltinsNV)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ShaderSMBuiltinsNV",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.FragmentShaderPixelInterlockEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FragmentShaderPixelInterlockEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.DemoteToHelperInvocationEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability DemoteToHelperInvocationEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.SubgroupShuffleINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupShuffleINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SubgroupBufferBlockIOINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupBufferBlockIOINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SubgroupImageBlockIOINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupImageBlockIOINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SubgroupImageMediaBlockIOINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupImageMediaBlockIOINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.RoundToInfinityINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability RoundToInfinityINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FloatingPointModeINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FloatingPointModeINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.IntegerFunctions2INTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability IntegerFunctions2INTEL",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.FunctionPointersINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FunctionPointersINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.IndirectReferencesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability IndirectReferencesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.AsmINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AsmINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.AtomicFloat32MinMaxEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat32MinMaxEXT",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.AtomicFloat64MinMaxEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat64MinMaxEXT",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.AtomicFloat16MinMaxEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat16MinMaxEXT",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.VectorComputeINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VectorComputeINTEL",
.dependencies = featureSet(&[_]Feature{
.VectorAnyINTEL,
}),
};
result[@intFromEnum(Feature.VectorAnyINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VectorAnyINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.ExpectAssumeKHR)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ExpectAssumeKHR",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SubgroupAvcMotionEstimationINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupAvcMotionEstimationINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SubgroupAvcMotionEstimationIntraINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupAvcMotionEstimationIntraINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.SubgroupAvcMotionEstimationChromaINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability SubgroupAvcMotionEstimationChromaINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.VariableLengthArrayINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability VariableLengthArrayINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FunctionFloatControlINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FunctionFloatControlINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGAMemoryAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAMemoryAttributesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPFastMathModeINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPFastMathModeINTEL",
.dependencies = featureSet(&[_]Feature{
.Kernel,
}),
};
result[@intFromEnum(Feature.ArbitraryPrecisionIntegersINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability ArbitraryPrecisionIntegersINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.UnstructuredLoopControlsINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability UnstructuredLoopControlsINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGALoopControlsINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGALoopControlsINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.KernelAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability KernelAttributesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGAKernelAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAKernelAttributesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGAMemoryAccessesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAMemoryAccessesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGAClusterAttributesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGAClusterAttributesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.LoopFuseINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability LoopFuseINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGABufferLocationINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGABufferLocationINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.USMStorageClassesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability USMStorageClassesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.IOPipesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability IOPipesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.BlockingPipesINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability BlockingPipesINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.FPGARegINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability FPGARegINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
result[@intFromEnum(Feature.AtomicFloat32AddEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat32AddEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.AtomicFloat64AddEXT)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability AtomicFloat64AddEXT",
.dependencies = featureSet(&[_]Feature{
.Shader,
}),
};
result[@intFromEnum(Feature.LongConstantCompositeINTEL)] = .{
.llvm_name = null,
.description = "Enable SPIR-V capability LongConstantCompositeINTEL",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/target/ve.zig | //! This file is auto-generated by tools/update_cpu_features.zig.
const std = @import("../std.zig");
const CpuFeature = std.Target.Cpu.Feature;
const CpuModel = std.Target.Cpu.Model;
pub const Feature = enum {
vpu,
};
pub const featureSet = CpuFeature.feature_set_fns(Feature).featureSet;
pub const featureSetHas = CpuFeature.feature_set_fns(Feature).featureSetHas;
pub const featureSetHasAny = CpuFeature.feature_set_fns(Feature).featureSetHasAny;
pub const featureSetHasAll = CpuFeature.feature_set_fns(Feature).featureSetHasAll;
pub const all_features = blk: {
const len = @typeInfo(Feature).Enum.fields.len;
std.debug.assert(len <= CpuFeature.Set.needed_bit_count);
var result: [len]CpuFeature = undefined;
result[@intFromEnum(Feature.vpu)] = .{
.llvm_name = "vpu",
.description = "Enable the VPU",
.dependencies = featureSet(&[_]Feature{}),
};
const ti = @typeInfo(Feature);
for (result, 0..) |*elem, i| {
elem.index = i;
elem.name = ti.Enum.fields[i].name;
}
break :blk result;
};
pub const cpu = struct {
pub const generic = CpuModel{
.name = "generic",
.llvm_name = "generic",
.features = featureSet(&[_]Feature{}),
};
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/testing/failing_allocator.zig | const std = @import("../std.zig");
const mem = std.mem;
/// Allocator that fails after N allocations, useful for making sure out of
/// memory conditions are handled correctly.
///
/// To use this, first initialize it and get an allocator with
///
/// `const failing_allocator = &FailingAllocator.init(<allocator>,
/// <fail_index>).allocator;`
///
/// Then use `failing_allocator` anywhere you would have used a
/// different allocator.
pub const FailingAllocator = struct {
allocator: mem.Allocator,
index: usize,
fail_index: usize,
internal_allocator: *mem.Allocator,
allocated_bytes: usize,
freed_bytes: usize,
allocations: usize,
deallocations: usize,
/// `fail_index` is the number of successful allocations you can
/// expect from this allocator. The next allocation will fail.
/// For example, if this is called with `fail_index` equal to 2,
/// the following test will pass:
///
/// var a = try failing_alloc.create(i32);
/// var b = try failing_alloc.create(i32);
/// testing.expectError(error.OutOfMemory, failing_alloc.create(i32));
pub fn init(allocator: *mem.Allocator, fail_index: usize) FailingAllocator {
return FailingAllocator{
.internal_allocator = allocator,
.fail_index = fail_index,
.index = 0,
.allocated_bytes = 0,
.freed_bytes = 0,
.allocations = 0,
.deallocations = 0,
.allocator = mem.Allocator{
.allocFn = alloc,
.resizeFn = resize,
},
};
}
fn alloc(
allocator: *std.mem.Allocator,
len: usize,
ptr_align: u29,
len_align: u29,
return_address: usize,
) error{OutOfMemory}![]u8 {
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
if (self.index == self.fail_index) {
return error.OutOfMemory;
}
const result = try self.internal_allocator.allocFn(self.internal_allocator, len, ptr_align, len_align, return_address);
self.allocated_bytes += result.len;
self.allocations += 1;
self.index += 1;
return result;
}
fn resize(
allocator: *std.mem.Allocator,
old_mem: []u8,
old_align: u29,
new_len: usize,
len_align: u29,
ra: usize,
) error{OutOfMemory}!usize {
const self = @fieldParentPtr(FailingAllocator, "allocator", allocator);
const r = self.internal_allocator.resizeFn(self.internal_allocator, old_mem, old_align, new_len, len_align, ra) catch |e| {
std.debug.assert(new_len > old_mem.len);
return e;
};
if (new_len == 0) {
self.deallocations += 1;
self.freed_bytes += old_mem.len;
} else if (r < old_mem.len) {
self.freed_bytes += old_mem.len - r;
} else {
self.allocated_bytes += r - old_mem.len;
}
return r;
}
};
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/mem/Allocator.zig | //! The standard memory allocation interface.
const std = @import("../std.zig");
const assert = std.debug.assert;
const math = std.math;
const mem = std.mem;
const Allocator = @This();
pub const Error = error{OutOfMemory};
/// Attempt to allocate at least `len` bytes aligned to `ptr_align`.
///
/// If `len_align` is `0`, then the length returned MUST be exactly `len` bytes,
/// otherwise, the length must be aligned to `len_align`.
///
/// `len` must be greater than or equal to `len_align` and must be aligned by `len_align`.
///
/// `ret_addr` is optionally provided as the first return address of the allocation call stack.
/// If the value is `0` it means no return address has been provided.
allocFn: fn (self: *Allocator, len: usize, ptr_align: u29, len_align: u29, ret_addr: usize) Error![]u8,
/// Attempt to expand or shrink memory in place. `buf.len` must equal the most recent
/// length returned by `allocFn` or `resizeFn`. `buf_align` must equal the same value
/// that was passed as the `ptr_align` parameter to the original `allocFn` call.
///
/// Passing a `new_len` of 0 frees and invalidates the buffer such that it can no
/// longer be passed to `resizeFn`.
///
/// error.OutOfMemory can only be returned if `new_len` is greater than `buf.len`.
/// If `buf` cannot be expanded to accommodate `new_len`, then the allocation MUST be
/// unmodified and error.OutOfMemory MUST be returned.
///
/// If `len_align` is `0`, then the length returned MUST be exactly `len` bytes,
/// otherwise, the length must be aligned to `len_align`. Note that `len_align` does *not*
/// provide a way to modify the alignment of a pointer. Rather it provides an API for
/// accepting more bytes of memory from the allocator than requested.
///
/// `new_len` must be greater than or equal to `len_align` and must be aligned by `len_align`.
///
/// `ret_addr` is optionally provided as the first return address of the allocation call stack.
/// If the value is `0` it means no return address has been provided.
resizeFn: fn (self: *Allocator, buf: []u8, buf_align: u29, new_len: usize, len_align: u29, ret_addr: usize) Error!usize,
/// Set to resizeFn if in-place resize is not supported.
pub fn noResize(
self: *Allocator,
buf: []u8,
buf_align: u29,
new_len: usize,
len_align: u29,
ret_addr: usize,
) Error!usize {
_ = self;
_ = buf_align;
_ = len_align;
_ = ret_addr;
if (new_len > buf.len)
return error.OutOfMemory;
return new_len;
}
/// Realloc is used to modify the size or alignment of an existing allocation,
/// as well as to provide the allocator with an opportunity to move an allocation
/// to a better location.
/// When the size/alignment is greater than the previous allocation, this function
/// returns `error.OutOfMemory` when the requested new allocation could not be granted.
/// When the size/alignment is less than or equal to the previous allocation,
/// this function returns `error.OutOfMemory` when the allocator decides the client
/// would be better off keeping the extra alignment/size. Clients will call
/// `resizeFn` when they require the allocator to track a new alignment/size,
/// and so this function should only return success when the allocator considers
/// the reallocation desirable from the allocator's perspective.
/// As an example, `std.ArrayList` tracks a "capacity", and therefore can handle
/// reallocation failure, even when `new_n` <= `old_mem.len`. A `FixedBufferAllocator`
/// would always return `error.OutOfMemory` for `reallocFn` when the size/alignment
/// is less than or equal to the old allocation, because it cannot reclaim the memory,
/// and thus the `std.ArrayList` would be better off retaining its capacity.
/// When `reallocFn` returns,
/// `return_value[0..min(old_mem.len, new_byte_count)]` must be the same
/// as `old_mem` was when `reallocFn` is called. The bytes of
/// `return_value[old_mem.len..]` have undefined values.
/// The returned slice must have its pointer aligned at least to `new_alignment` bytes.
fn reallocBytes(
self: *Allocator,
/// Guaranteed to be the same as what was returned from most recent call to
/// `allocFn` or `resizeFn`.
/// If `old_mem.len == 0` then this is a new allocation and `new_byte_count`
/// is guaranteed to be >= 1.
old_mem: []u8,
/// If `old_mem.len == 0` then this is `undefined`, otherwise:
/// Guaranteed to be the same as what was passed to `allocFn`.
/// Guaranteed to be >= 1.
/// Guaranteed to be a power of 2.
old_alignment: u29,
/// If `new_byte_count` is 0 then this is a free and it is guaranteed that
/// `old_mem.len != 0`.
new_byte_count: usize,
/// Guaranteed to be >= 1.
/// Guaranteed to be a power of 2.
/// Returned slice's pointer must have this alignment.
new_alignment: u29,
/// 0 indicates the length of the slice returned MUST match `new_byte_count` exactly
/// non-zero means the length of the returned slice must be aligned by `len_align`
/// `new_len` must be aligned by `len_align`
len_align: u29,
return_address: usize,
) Error![]u8 {
if (old_mem.len == 0) {
const new_mem = try self.allocFn(self, new_byte_count, new_alignment, len_align, return_address);
// TODO: https://github.com/ziglang/zig/issues/4298
@memset(new_mem[0..new_byte_count], undefined);
return new_mem;
}
if (mem.isAligned(@intFromPtr(old_mem.ptr), new_alignment)) {
if (new_byte_count <= old_mem.len) {
const shrunk_len = self.shrinkBytes(old_mem, old_alignment, new_byte_count, len_align, return_address);
return old_mem.ptr[0..shrunk_len];
}
if (self.resizeFn(self, old_mem, old_alignment, new_byte_count, len_align, return_address)) |resized_len| {
assert(resized_len >= new_byte_count);
// TODO: https://github.com/ziglang/zig/issues/4298
@memset(old_mem[new_byte_count..], undefined);
return old_mem.ptr[0..resized_len];
} else |_| {}
}
if (new_byte_count <= old_mem.len and new_alignment <= old_alignment) {
return error.OutOfMemory;
}
return self.moveBytes(old_mem, old_alignment, new_byte_count, new_alignment, len_align, return_address);
}
/// Move the given memory to a new location in the given allocator to accommodate a new
/// size and alignment.
fn moveBytes(
self: *Allocator,
old_mem: []u8,
old_align: u29,
new_len: usize,
new_alignment: u29,
len_align: u29,
return_address: usize,
) Error![]u8 {
assert(old_mem.len > 0);
assert(new_len > 0);
const new_mem = try self.allocFn(self, new_len, new_alignment, len_align, return_address);
@memcpy(new_mem[0..], old_mem[0..]);
// TODO https://github.com/ziglang/zig/issues/4298
@memset(old_mem[0..], undefined);
_ = self.shrinkBytes(old_mem, old_align, 0, 0, return_address);
return new_mem;
}
/// Returns a pointer to undefined memory.
/// Call `destroy` with the result to free the memory.
pub fn create(self: *Allocator, comptime T: type) Error!*T {
if (@sizeOf(T) == 0) return @as(*T, undefined);
const slice = try self.allocAdvancedWithRetAddr(T, null, 1, .exact, @returnAddress());
return &slice[0];
}
/// `ptr` should be the return value of `create`, or otherwise
/// have the same address and alignment property.
pub fn destroy(self: *Allocator, ptr: anytype) void {
const info = @typeInfo(@TypeOf(ptr)).Pointer;
const T = info.child;
if (@sizeOf(T) == 0) return;
const non_const_ptr = @as([*]u8, @ptrFromInt(@intFromPtr(ptr)));
_ = self.shrinkBytes(non_const_ptr[0..@sizeOf(T)], info.alignment, 0, 0, @returnAddress());
}
/// Allocates an array of `n` items of type `T` and sets all the
/// items to `undefined`. Depending on the Allocator
/// implementation, it may be required to call `free` once the
/// memory is no longer needed, to avoid a resource leak. If the
/// `Allocator` implementation is unknown, then correct code will
/// call `free` when done.
///
/// For allocating a single item, see `create`.
pub fn alloc(self: *Allocator, comptime T: type, n: usize) Error![]T {
return self.allocAdvancedWithRetAddr(T, null, n, .exact, @returnAddress());
}
pub fn allocWithOptions(
self: *Allocator,
comptime Elem: type,
n: usize,
/// null means naturally aligned
comptime optional_alignment: ?u29,
comptime optional_sentinel: ?Elem,
) Error!AllocWithOptionsPayload(Elem, optional_alignment, optional_sentinel) {
return self.allocWithOptionsRetAddr(Elem, n, optional_alignment, optional_sentinel, @returnAddress());
}
pub fn allocWithOptionsRetAddr(
self: *Allocator,
comptime Elem: type,
n: usize,
/// null means naturally aligned
comptime optional_alignment: ?u29,
comptime optional_sentinel: ?Elem,
return_address: usize,
) Error!AllocWithOptionsPayload(Elem, optional_alignment, optional_sentinel) {
if (optional_sentinel) |sentinel| {
const ptr = try self.allocAdvancedWithRetAddr(Elem, optional_alignment, n + 1, .exact, return_address);
ptr[n] = sentinel;
return ptr[0..n :sentinel];
} else {
return self.allocAdvancedWithRetAddr(Elem, optional_alignment, n, .exact, return_address);
}
}
fn AllocWithOptionsPayload(comptime Elem: type, comptime alignment: ?u29, comptime sentinel: ?Elem) type {
if (sentinel) |s| {
return [:s]align(alignment orelse @alignOf(Elem)) Elem;
} else {
return []align(alignment orelse @alignOf(Elem)) Elem;
}
}
/// Allocates an array of `n + 1` items of type `T` and sets the first `n`
/// items to `undefined` and the last item to `sentinel`. Depending on the
/// Allocator implementation, it may be required to call `free` once the
/// memory is no longer needed, to avoid a resource leak. If the
/// `Allocator` implementation is unknown, then correct code will
/// call `free` when done.
///
/// For allocating a single item, see `create`.
pub fn allocSentinel(
self: *Allocator,
comptime Elem: type,
n: usize,
comptime sentinel: Elem,
) Error![:sentinel]Elem {
return self.allocWithOptionsRetAddr(Elem, n, null, sentinel, @returnAddress());
}
/// Deprecated: use `allocAdvanced`
pub fn alignedAlloc(
self: *Allocator,
comptime T: type,
/// null means naturally aligned
comptime alignment: ?u29,
n: usize,
) Error![]align(alignment orelse @alignOf(T)) T {
return self.allocAdvancedWithRetAddr(T, alignment, n, .exact, @returnAddress());
}
pub fn allocAdvanced(
self: *Allocator,
comptime T: type,
/// null means naturally aligned
comptime alignment: ?u29,
n: usize,
exact: Exact,
) Error![]align(alignment orelse @alignOf(T)) T {
return self.allocAdvancedWithRetAddr(T, alignment, n, exact, @returnAddress());
}
pub const Exact = enum { exact, at_least };
pub fn allocAdvancedWithRetAddr(
self: *Allocator,
comptime T: type,
/// null means naturally aligned
comptime alignment: ?u29,
n: usize,
exact: Exact,
return_address: usize,
) Error![]align(alignment orelse @alignOf(T)) T {
const a = if (alignment) |a| blk: {
if (a == @alignOf(T)) return allocAdvancedWithRetAddr(self, T, null, n, exact, return_address);
break :blk a;
} else @alignOf(T);
if (n == 0) {
return @as([*]align(a) T, undefined)[0..0];
}
const byte_count = math.mul(usize, @sizeOf(T), n) catch return Error.OutOfMemory;
// TODO The `if (alignment == null)` blocks are workarounds for zig not being able to
// access certain type information about T without creating a circular dependency in async
// functions that heap-allocate their own frame with @Frame(func).
const size_of_T = if (alignment == null) @as(u29, @intCast(@divExact(byte_count, n))) else @sizeOf(T);
const len_align: u29 = switch (exact) {
.exact => 0,
.at_least => size_of_T,
};
const byte_slice = try self.allocFn(self, byte_count, a, len_align, return_address);
switch (exact) {
.exact => assert(byte_slice.len == byte_count),
.at_least => assert(byte_slice.len >= byte_count),
}
// TODO: https://github.com/ziglang/zig/issues/4298
@memset(byte_slice[0..], undefined);
if (alignment == null) {
// This if block is a workaround (see comment above)
return @as([*]T, @ptrFromInt(@intFromPtr(byte_slice.ptr)))[0..@divExact(byte_slice.len, @sizeOf(T))];
} else {
return mem.bytesAsSlice(T, @alignCast(byte_slice));
}
}
/// Increases or decreases the size of an allocation. It is guaranteed to not move the pointer.
pub fn resize(self: *Allocator, old_mem: anytype, new_n: usize) Error!@TypeOf(old_mem) {
const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
const T = Slice.child;
if (new_n == 0) {
self.free(old_mem);
return &[0]T{};
}
const old_byte_slice = mem.sliceAsBytes(old_mem);
const new_byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory;
const rc = try self.resizeFn(self, old_byte_slice, Slice.alignment, new_byte_count, 0, @returnAddress());
assert(rc == new_byte_count);
const new_byte_slice = old_byte_slice.ptr[0..new_byte_count];
return mem.bytesAsSlice(T, new_byte_slice);
}
/// This function requests a new byte size for an existing allocation,
/// which can be larger, smaller, or the same size as the old memory
/// allocation.
/// This function is preferred over `shrink`, because it can fail, even
/// when shrinking. This gives the allocator a chance to perform a
/// cheap shrink operation if possible, or otherwise return OutOfMemory,
/// indicating that the caller should keep their capacity, for example
/// in `std.ArrayList.shrink`.
/// If you need guaranteed success, call `shrink`.
/// If `new_n` is 0, this is the same as `free` and it always succeeds.
pub fn realloc(self: *Allocator, old_mem: anytype, new_n: usize) t: {
const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
break :t Error![]align(Slice.alignment) Slice.child;
} {
const old_alignment = @typeInfo(@TypeOf(old_mem)).Pointer.alignment;
return self.reallocAdvancedWithRetAddr(old_mem, old_alignment, new_n, .exact, @returnAddress());
}
pub fn reallocAtLeast(self: *Allocator, old_mem: anytype, new_n: usize) t: {
const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
break :t Error![]align(Slice.alignment) Slice.child;
} {
const old_alignment = @typeInfo(@TypeOf(old_mem)).Pointer.alignment;
return self.reallocAdvancedWithRetAddr(old_mem, old_alignment, new_n, .at_least, @returnAddress());
}
/// This is the same as `realloc`, except caller may additionally request
/// a new alignment, which can be larger, smaller, or the same as the old
/// allocation.
pub fn reallocAdvanced(
self: *Allocator,
old_mem: anytype,
comptime new_alignment: u29,
new_n: usize,
exact: Exact,
) Error![]align(new_alignment) @typeInfo(@TypeOf(old_mem)).Pointer.child {
return self.reallocAdvancedWithRetAddr(old_mem, new_alignment, new_n, exact, @returnAddress());
}
pub fn reallocAdvancedWithRetAddr(
self: *Allocator,
old_mem: anytype,
comptime new_alignment: u29,
new_n: usize,
exact: Exact,
return_address: usize,
) Error![]align(new_alignment) @typeInfo(@TypeOf(old_mem)).Pointer.child {
const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
const T = Slice.child;
if (old_mem.len == 0) {
return self.allocAdvancedWithRetAddr(T, new_alignment, new_n, exact, return_address);
}
if (new_n == 0) {
self.free(old_mem);
return @as([*]align(new_alignment) T, undefined)[0..0];
}
const old_byte_slice = mem.sliceAsBytes(old_mem);
const byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory;
// Note: can't set shrunk memory to undefined as memory shouldn't be modified on realloc failure
const len_align: u29 = switch (exact) {
.exact => 0,
.at_least => @sizeOf(T),
};
const new_byte_slice = try self.reallocBytes(old_byte_slice, Slice.alignment, byte_count, new_alignment, len_align, return_address);
return mem.bytesAsSlice(T, @alignCast(new_byte_slice));
}
/// Prefer calling realloc to shrink if you can tolerate failure, such as
/// in an ArrayList data structure with a storage capacity.
/// Shrink always succeeds, and `new_n` must be <= `old_mem.len`.
/// Returned slice has same alignment as old_mem.
/// Shrinking to 0 is the same as calling `free`.
pub fn shrink(self: *Allocator, old_mem: anytype, new_n: usize) t: {
const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
break :t []align(Slice.alignment) Slice.child;
} {
const old_alignment = @typeInfo(@TypeOf(old_mem)).Pointer.alignment;
return self.alignedShrinkWithRetAddr(old_mem, old_alignment, new_n, @returnAddress());
}
/// This is the same as `shrink`, except caller may additionally request
/// a new alignment, which must be smaller or the same as the old
/// allocation.
pub fn alignedShrink(
self: *Allocator,
old_mem: anytype,
comptime new_alignment: u29,
new_n: usize,
) []align(new_alignment) @typeInfo(@TypeOf(old_mem)).Pointer.child {
return self.alignedShrinkWithRetAddr(old_mem, new_alignment, new_n, @returnAddress());
}
/// This is the same as `alignedShrink`, except caller may additionally pass
/// the return address of the first stack frame, which may be relevant for
/// allocators which collect stack traces.
pub fn alignedShrinkWithRetAddr(
self: *Allocator,
old_mem: anytype,
comptime new_alignment: u29,
new_n: usize,
return_address: usize,
) []align(new_alignment) @typeInfo(@TypeOf(old_mem)).Pointer.child {
const Slice = @typeInfo(@TypeOf(old_mem)).Pointer;
const T = Slice.child;
if (new_n == old_mem.len)
return old_mem;
assert(new_n < old_mem.len);
assert(new_alignment <= Slice.alignment);
// Here we skip the overflow checking on the multiplication because
// new_n <= old_mem.len and the multiplication didn't overflow for that operation.
const byte_count = @sizeOf(T) * new_n;
const old_byte_slice = mem.sliceAsBytes(old_mem);
// TODO: https://github.com/ziglang/zig/issues/4298
@memset(old_byte_slice[byte_count..], undefined);
_ = self.shrinkBytes(old_byte_slice, Slice.alignment, byte_count, 0, return_address);
return old_mem[0..new_n];
}
/// Free an array allocated with `alloc`. To free a single item,
/// see `destroy`.
pub fn free(self: *Allocator, memory: anytype) void {
const Slice = @typeInfo(@TypeOf(memory)).Pointer;
const bytes = mem.sliceAsBytes(memory);
const bytes_len = bytes.len + if (Slice.sentinel != null) @sizeOf(Slice.child) else 0;
if (bytes_len == 0) return;
const non_const_ptr = @as([*]u8, @ptrFromInt(@intFromPtr(bytes.ptr)));
// TODO: https://github.com/ziglang/zig/issues/4298
@memset(non_const_ptr[0..], undefined);
_ = self.shrinkBytes(non_const_ptr[0..bytes_len], Slice.alignment, 0, 0, @returnAddress());
}
/// Copies `m` to newly allocated memory. Caller owns the memory.
pub fn dupe(allocator: *Allocator, comptime T: type, m: []const T) ![]T {
const new_buf = try allocator.alloc(T, m.len);
mem.copy(T, new_buf, m);
return new_buf;
}
/// Copies `m` to newly allocated memory, with a null-terminated element. Caller owns the memory.
pub fn dupeZ(allocator: *Allocator, comptime T: type, m: []const T) ![:0]T {
const new_buf = try allocator.alloc(T, m.len + 1);
mem.copy(T, new_buf, m);
new_buf[m.len] = 0;
return new_buf[0..m.len :0];
}
/// Call `resizeFn`, but caller guarantees that `new_len` <= `buf.len` meaning
/// error.OutOfMemory should be impossible.
/// This function allows a runtime `buf_align` value. Callers should generally prefer
/// to call `shrink` directly.
pub fn shrinkBytes(
self: *Allocator,
buf: []u8,
buf_align: u29,
new_len: usize,
len_align: u29,
return_address: usize,
) usize {
assert(new_len <= buf.len);
return self.resizeFn(self, buf, buf_align, new_len, len_align, return_address) catch unreachable;
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/fmt/parse_float.zig | // Adapted from https://github.com/grzegorz-kraszewski/stringtofloat.
// MIT License
//
// Copyright (c) 2016 Grzegorz Kraszewski
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Be aware that this implementation has the following limitations:
//
// - Is not round-trip accurate for all values
// - Only supports round-to-zero
// - Does not handle denormals
const std = @import("std");
const ascii = std.ascii;
// The mantissa field in FloatRepr is 64bit wide and holds only 19 digits
// without overflowing
const max_digits = 19;
const f64_plus_zero: u64 = 0x0000000000000000;
const f64_minus_zero: u64 = 0x8000000000000000;
const f64_plus_infinity: u64 = 0x7FF0000000000000;
const f64_minus_infinity: u64 = 0xFFF0000000000000;
const Z96 = struct {
d0: u32,
d1: u32,
d2: u32,
// d = s >> 1
inline fn shiftRight1(d: *Z96, s: Z96) void {
d.d0 = (s.d0 >> 1) | ((s.d1 & 1) << 31);
d.d1 = (s.d1 >> 1) | ((s.d2 & 1) << 31);
d.d2 = s.d2 >> 1;
}
// d = s << 1
inline fn shiftLeft1(d: *Z96, s: Z96) void {
d.d2 = (s.d2 << 1) | ((s.d1 & (1 << 31)) >> 31);
d.d1 = (s.d1 << 1) | ((s.d0 & (1 << 31)) >> 31);
d.d0 = s.d0 << 1;
}
// d += s
inline fn add(d: *Z96, s: Z96) void {
var w = @as(u64, d.d0) + @as(u64, s.d0);
d.d0 = @as(u32, @truncate(w));
w >>= 32;
w += @as(u64, d.d1) + @as(u64, s.d1);
d.d1 = @as(u32, @truncate(w));
w >>= 32;
w += @as(u64, d.d2) + @as(u64, s.d2);
d.d2 = @as(u32, @truncate(w));
}
// d -= s
inline fn sub(d: *Z96, s: Z96) void {
var w = @as(u64, d.d0) -% @as(u64, s.d0);
d.d0 = @as(u32, @truncate(w));
w >>= 32;
w += @as(u64, d.d1) -% @as(u64, s.d1);
d.d1 = @as(u32, @truncate(w));
w >>= 32;
w += @as(u64, d.d2) -% @as(u64, s.d2);
d.d2 = @as(u32, @truncate(w));
}
};
const FloatRepr = struct {
negative: bool,
exponent: i32,
mantissa: u64,
};
fn convertRepr(comptime T: type, n: FloatRepr) T {
const mask28: u32 = 0xf << 28;
var s: Z96 = undefined;
var q: Z96 = undefined;
var r: Z96 = undefined;
s.d0 = @as(u32, @truncate(n.mantissa));
s.d1 = @as(u32, @truncate(n.mantissa >> 32));
s.d2 = 0;
var binary_exponent: i32 = 92;
var exp = n.exponent;
while (exp > 0) : (exp -= 1) {
q.shiftLeft1(s); // q = p << 1
r.shiftLeft1(q); // r = p << 2
s.shiftLeft1(r); // p = p << 3
s.add(q); // p = (p << 3) + (p << 1)
while (s.d2 & mask28 != 0) {
q.shiftRight1(s);
binary_exponent += 1;
s = q;
}
}
while (exp < 0) {
while (s.d2 & (1 << 31) == 0) {
q.shiftLeft1(s);
binary_exponent -= 1;
s = q;
}
q.d2 = s.d2 / 10;
r.d1 = s.d2 % 10;
r.d2 = (s.d1 >> 8) | (r.d1 << 24);
q.d1 = r.d2 / 10;
r.d1 = r.d2 % 10;
r.d2 = ((s.d1 & 0xff) << 16) | (s.d0 >> 16) | (r.d1 << 24);
r.d0 = r.d2 / 10;
r.d1 = r.d2 % 10;
q.d1 = (q.d1 << 8) | ((r.d0 & 0x00ff0000) >> 16);
q.d0 = r.d0 << 16;
r.d2 = (s.d0 *% 0xffff) | (r.d1 << 16);
q.d0 |= r.d2 / 10;
s = q;
exp += 1;
}
if (s.d0 != 0 or s.d1 != 0 or s.d2 != 0) {
while (s.d2 & mask28 == 0) {
q.shiftLeft1(s);
binary_exponent -= 1;
s = q;
}
}
binary_exponent += 1023;
const repr: u64 = blk: {
if (binary_exponent > 2046) {
break :blk if (n.negative) f64_minus_infinity else f64_plus_infinity;
} else if (binary_exponent < 1) {
break :blk if (n.negative) f64_minus_zero else f64_plus_zero;
} else if (s.d2 != 0) {
const binexs2 = @as(u64, @intCast(binary_exponent)) << 52;
const rr = (@as(u64, s.d2 & ~mask28) << 24) | ((@as(u64, s.d1) + 128) >> 8) | binexs2;
break :blk if (n.negative) rr | (1 << 63) else rr;
} else {
break :blk 0;
}
};
const f = @as(f64, @bitCast(repr));
return @as(T, @floatCast(f));
}
const State = enum {
MaybeSign,
LeadingMantissaZeros,
LeadingFractionalZeros,
MantissaIntegral,
MantissaFractional,
ExponentSign,
LeadingExponentZeros,
Exponent,
};
const ParseResult = enum {
Ok,
PlusZero,
MinusZero,
PlusInf,
MinusInf,
};
fn parseRepr(s: []const u8, n: *FloatRepr) !ParseResult {
var digit_index: usize = 0;
var negative_exp = false;
var exponent: i32 = 0;
var state = State.MaybeSign;
var i: usize = 0;
while (i < s.len) {
const c = s[i];
switch (state) {
.MaybeSign => {
state = .LeadingMantissaZeros;
if (c == '+') {
i += 1;
} else if (c == '-') {
n.negative = true;
i += 1;
} else if (ascii.isDigit(c) or c == '.') {
// continue
} else {
return error.InvalidCharacter;
}
},
.LeadingMantissaZeros => {
if (c == '0') {
i += 1;
} else if (c == '.') {
i += 1;
state = .LeadingFractionalZeros;
} else if (c == '_') {
i += 1;
} else {
state = .MantissaIntegral;
}
},
.LeadingFractionalZeros => {
if (c == '0') {
i += 1;
if (n.exponent > std.math.minInt(i32)) {
n.exponent -= 1;
}
} else {
state = .MantissaFractional;
}
},
.MantissaIntegral => {
if (ascii.isDigit(c)) {
if (digit_index < max_digits) {
n.mantissa *%= 10;
n.mantissa += c - '0';
digit_index += 1;
} else if (n.exponent < std.math.maxInt(i32)) {
n.exponent += 1;
}
i += 1;
} else if (c == '.') {
i += 1;
state = .MantissaFractional;
} else if (c == '_') {
i += 1;
} else {
state = .MantissaFractional;
}
},
.MantissaFractional => {
if (ascii.isDigit(c)) {
if (digit_index < max_digits) {
n.mantissa *%= 10;
n.mantissa += c - '0';
n.exponent -%= 1;
digit_index += 1;
}
i += 1;
} else if (c == 'e' or c == 'E') {
i += 1;
state = .ExponentSign;
} else if (c == '_') {
i += 1;
} else {
state = .ExponentSign;
}
},
.ExponentSign => {
if (c == '+') {
i += 1;
} else if (c == '_') {
return error.InvalidCharacter;
} else if (c == '-') {
negative_exp = true;
i += 1;
}
state = .LeadingExponentZeros;
},
.LeadingExponentZeros => {
if (c == '0') {
i += 1;
} else if (c == '_') {
i += 1;
} else {
state = .Exponent;
}
},
.Exponent => {
if (ascii.isDigit(c)) {
if (exponent < std.math.maxInt(i32) / 10) {
exponent *= 10;
exponent += @as(i32, @intCast(c - '0'));
}
i += 1;
} else if (c == '_') {
i += 1;
} else {
return error.InvalidCharacter;
}
},
}
}
if (negative_exp) exponent = -exponent;
n.exponent += exponent;
if (n.mantissa == 0) {
return if (n.negative) .MinusZero else .PlusZero;
} else if (n.exponent > 309) {
return if (n.negative) .MinusInf else .PlusInf;
} else if (n.exponent < -328) {
return if (n.negative) .MinusZero else .PlusZero;
}
return .Ok;
}
fn caseInEql(a: []const u8, b: []const u8) bool {
if (a.len != b.len) return false;
for (a, 0..) |_, i| {
if (ascii.toUpper(a[i]) != ascii.toUpper(b[i])) {
return false;
}
}
return true;
}
pub const ParseFloatError = error{InvalidCharacter};
pub fn parseFloat(comptime T: type, s: []const u8) ParseFloatError!T {
if (s.len == 0 or (s.len == 1 and (s[0] == '+' or s[0] == '-'))) {
return error.InvalidCharacter;
}
if (caseInEql(s, "nan")) {
return std.math.nan(T);
} else if (caseInEql(s, "inf") or caseInEql(s, "+inf")) {
return std.math.inf(T);
} else if (caseInEql(s, "-inf")) {
return -std.math.inf(T);
}
var r = FloatRepr{
.negative = false,
.exponent = 0,
.mantissa = 0,
};
return switch (try parseRepr(s, &r)) {
.Ok => convertRepr(T, r),
.PlusZero => 0.0,
.MinusZero => -@as(T, 0.0),
.PlusInf => std.math.inf(T),
.MinusInf => -std.math.inf(T),
};
}
test "fmt.parseFloat" {
const testing = std.testing;
const expect = testing.expect;
const expectEqual = testing.expectEqual;
const approxEqAbs = std.math.approxEqAbs;
const epsilon = 1e-7;
inline for ([_]type{ f16, f32, f64, f128 }) |T| {
const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
try testing.expectError(error.InvalidCharacter, parseFloat(T, ""));
try testing.expectError(error.InvalidCharacter, parseFloat(T, " 1"));
try testing.expectError(error.InvalidCharacter, parseFloat(T, "1abc"));
try testing.expectError(error.InvalidCharacter, parseFloat(T, "+"));
try testing.expectError(error.InvalidCharacter, parseFloat(T, "-"));
try expectEqual(try parseFloat(T, "0"), 0.0);
try expectEqual(try parseFloat(T, "0"), 0.0);
try expectEqual(try parseFloat(T, "+0"), 0.0);
try expectEqual(try parseFloat(T, "-0"), 0.0);
try expectEqual(try parseFloat(T, "0e0"), 0);
try expectEqual(try parseFloat(T, "2e3"), 2000.0);
try expectEqual(try parseFloat(T, "1e0"), 1.0);
try expectEqual(try parseFloat(T, "-2e3"), -2000.0);
try expectEqual(try parseFloat(T, "-1e0"), -1.0);
try expectEqual(try parseFloat(T, "1.234e3"), 1234);
try expect(approxEqAbs(T, try parseFloat(T, "3.141"), 3.141, epsilon));
try expect(approxEqAbs(T, try parseFloat(T, "-3.141"), -3.141, epsilon));
try expectEqual(try parseFloat(T, "1e-700"), 0);
try expectEqual(try parseFloat(T, "1e+700"), std.math.inf(T));
try expectEqual(@as(Z, @bitCast(try parseFloat(T, "nAn"))), @as(Z, @bitCast(std.math.nan(T))));
try expectEqual(try parseFloat(T, "inF"), std.math.inf(T));
try expectEqual(try parseFloat(T, "-INF"), -std.math.inf(T));
try expectEqual(try parseFloat(T, "0.4e0066999999999999999999999999999999999999999999999999999"), std.math.inf(T));
try expect(approxEqAbs(T, try parseFloat(T, "0_1_2_3_4_5_6.7_8_9_0_0_0e0_0_1_0"), @as(T, 123456.789000e10), epsilon));
if (T != f16) {
try expect(approxEqAbs(T, try parseFloat(T, "1e-2"), 0.01, epsilon));
try expect(approxEqAbs(T, try parseFloat(T, "1234e-2"), 12.34, epsilon));
try expect(approxEqAbs(T, try parseFloat(T, "123142.1"), 123142.1, epsilon));
try expect(approxEqAbs(T, try parseFloat(T, "-123142.1124"), @as(T, -123142.1124), epsilon));
try expect(approxEqAbs(T, try parseFloat(T, "0.7062146892655368"), @as(T, 0.7062146892655368), epsilon));
try expect(approxEqAbs(T, try parseFloat(T, "2.71828182845904523536"), @as(T, 2.718281828459045), epsilon));
}
}
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/fmt/parse_hex_float.zig | // The rounding logic is inspired by LLVM's APFloat and Go's atofHex
// implementation.
const std = @import("std");
const ascii = std.ascii;
const fmt = std.fmt;
const math = std.math;
const testing = std.testing;
const assert = std.debug.assert;
pub fn parseHexFloat(comptime T: type, s: []const u8) !T {
assert(@typeInfo(T) == .Float);
const IntT = std.meta.Int(.unsigned, @typeInfo(T).Float.bits);
const mantissa_bits = math.floatMantissaBits(T);
const exponent_bits = math.floatExponentBits(T);
const sign_shift = mantissa_bits + exponent_bits;
const exponent_bias = (1 << (exponent_bits - 1)) - 1;
const exponent_min = 1 - exponent_bias;
const exponent_max = exponent_bias;
if (s.len == 0)
return error.InvalidCharacter;
if (ascii.eqlIgnoreCase(s, "nan")) {
return math.nan(T);
} else if (ascii.eqlIgnoreCase(s, "inf") or ascii.eqlIgnoreCase(s, "+inf")) {
return math.inf(T);
} else if (ascii.eqlIgnoreCase(s, "-inf")) {
return -math.inf(T);
}
var negative: bool = false;
var exp_negative: bool = false;
var mantissa: u128 = 0;
var exponent: i16 = 0;
var frac_scale: i16 = 0;
const State = enum {
MaybeSign,
Prefix,
LeadingIntegerDigit,
IntegerDigit,
MaybeDot,
LeadingFractionDigit,
FractionDigit,
ExpPrefix,
MaybeExpSign,
ExpDigit,
};
var state = State.MaybeSign;
var i: usize = 0;
while (i < s.len) {
const c = s[i];
switch (state) {
.MaybeSign => {
state = .Prefix;
if (c == '+') {
i += 1;
} else if (c == '-') {
negative = true;
i += 1;
}
},
.Prefix => {
state = .LeadingIntegerDigit;
// Match both 0x and 0X.
if (i + 2 > s.len or s[i] != '0' or s[i + 1] | 32 != 'x')
return error.InvalidCharacter;
i += 2;
},
.LeadingIntegerDigit => {
if (c == '0') {
// Skip leading zeros.
i += 1;
} else if (c == '_') {
return error.InvalidCharacter;
} else {
state = .IntegerDigit;
}
},
.IntegerDigit => {
if (ascii.isXDigit(c)) {
if (mantissa >= math.maxInt(u128) / 16)
return error.Overflow;
mantissa *%= 16;
mantissa += try fmt.charToDigit(c, 16);
i += 1;
} else if (c == '_') {
i += 1;
} else {
state = .MaybeDot;
}
},
.MaybeDot => {
if (c == '.') {
state = .LeadingFractionDigit;
i += 1;
} else state = .ExpPrefix;
},
.LeadingFractionDigit => {
if (c == '_') {
return error.InvalidCharacter;
} else state = .FractionDigit;
},
.FractionDigit => {
if (ascii.isXDigit(c)) {
if (mantissa < math.maxInt(u128) / 16) {
mantissa *%= 16;
mantissa +%= try fmt.charToDigit(c, 16);
frac_scale += 1;
} else if (c != '0') {
return error.Overflow;
}
i += 1;
} else if (c == '_') {
i += 1;
} else {
state = .ExpPrefix;
}
},
.ExpPrefix => {
state = .MaybeExpSign;
// Match both p and P.
if (c | 32 != 'p')
return error.InvalidCharacter;
i += 1;
},
.MaybeExpSign => {
state = .ExpDigit;
if (c == '+') {
i += 1;
} else if (c == '-') {
exp_negative = true;
i += 1;
}
},
.ExpDigit => {
if (ascii.isXDigit(c)) {
if (exponent >= math.maxInt(i16) / 10)
return error.Overflow;
exponent *%= 10;
exponent +%= try fmt.charToDigit(c, 10);
i += 1;
} else if (c == '_') {
i += 1;
} else {
return error.InvalidCharacter;
}
},
}
}
if (exp_negative)
exponent *= -1;
// Bring the decimal part to the left side of the decimal dot.
exponent -= frac_scale * 4;
if (mantissa == 0) {
// Signed zero.
return if (negative) -0.0 else 0.0;
}
// Divide by 2^mantissa_bits to right-align the mantissa in the fractional
// part.
exponent += mantissa_bits;
// Keep around two extra bits to correctly round any value that doesn't fit
// the available mantissa bits. The result LSB serves as Guard bit, the
// following one is the Round bit and the last one is the Sticky bit,
// computed by OR-ing all the dropped bits.
// Normalize by aligning the implicit one bit.
while (mantissa >> (mantissa_bits + 2) == 0) {
mantissa <<= 1;
exponent -= 1;
}
// Normalize again by dropping the excess precision.
// Note that the discarded bits are folded into the Sticky bit.
while (mantissa >> (mantissa_bits + 2 + 1) != 0) {
mantissa = mantissa >> 1 | (mantissa & 1);
exponent += 1;
}
// Very small numbers can be possibly represented as denormals, reduce the
// exponent as much as possible.
while (mantissa != 0 and exponent < exponent_min - 2) {
mantissa = mantissa >> 1 | (mantissa & 1);
exponent += 1;
}
// There are two cases to handle:
// - We've truncated more than 0.5ULP (R=S=1), increase the mantissa.
// - We've truncated exactly 0.5ULP (R=1 S=0), increase the mantissa if the
// result is odd (G=1).
// The two checks can be neatly folded as follows.
mantissa |= @intFromBool(mantissa & 0b100 != 0);
mantissa += 1;
mantissa >>= 2;
exponent += 2;
if (mantissa & (1 << (mantissa_bits + 1)) != 0) {
// Renormalize, if the exponent overflows we'll catch that below.
mantissa >>= 1;
exponent += 1;
}
if (mantissa >> mantissa_bits == 0) {
// This is a denormal number, the biased exponent is zero.
exponent = -exponent_bias;
}
if (exponent > exponent_max) {
// Overflow, return +inf.
return math.inf(T);
}
// Remove the implicit bit.
mantissa &= @as(u128, (1 << mantissa_bits) - 1);
const raw: IntT =
(if (negative) @as(IntT, 1) << sign_shift else 0) |
@as(IntT, @as(u16, @bitCast(exponent + exponent_bias))) << mantissa_bits |
@as(IntT, @truncate(mantissa));
return @as(T, @bitCast(raw));
}
test "special" {
try testing.expect(math.isNan(try parseHexFloat(f32, "nAn")));
try testing.expect(math.isPositiveInf(try parseHexFloat(f32, "iNf")));
try testing.expect(math.isPositiveInf(try parseHexFloat(f32, "+Inf")));
try testing.expect(math.isNegativeInf(try parseHexFloat(f32, "-iNf")));
}
test "zero" {
try testing.expectEqual(@as(f32, 0.0), try parseHexFloat(f32, "0x0"));
try testing.expectEqual(@as(f32, 0.0), try parseHexFloat(f32, "-0x0"));
try testing.expectEqual(@as(f32, 0.0), try parseHexFloat(f32, "0x0p42"));
try testing.expectEqual(@as(f32, 0.0), try parseHexFloat(f32, "-0x0.00000p42"));
try testing.expectEqual(@as(f32, 0.0), try parseHexFloat(f32, "0x0.00000p666"));
}
test "f16" {
const Case = struct { s: []const u8, v: f16 };
const cases: []const Case = &[_]Case{
.{ .s = "0x1p0", .v = 1.0 },
.{ .s = "-0x1p-1", .v = -0.5 },
.{ .s = "0x10p+10", .v = 16384.0 },
.{ .s = "0x10p-10", .v = 0.015625 },
// Max normalized value.
.{ .s = "0x1.ffcp+15", .v = math.f16_max },
.{ .s = "-0x1.ffcp+15", .v = -math.f16_max },
// Min normalized value.
.{ .s = "0x1p-14", .v = math.f16_min },
.{ .s = "-0x1p-14", .v = -math.f16_min },
// Min denormal value.
.{ .s = "0x1p-24", .v = math.f16_true_min },
.{ .s = "-0x1p-24", .v = -math.f16_true_min },
};
for (cases) |case| {
try testing.expectEqual(case.v, try parseHexFloat(f16, case.s));
}
}
test "f32" {
const Case = struct { s: []const u8, v: f32 };
const cases: []const Case = &[_]Case{
.{ .s = "0x1p0", .v = 1.0 },
.{ .s = "-0x1p-1", .v = -0.5 },
.{ .s = "0x10p+10", .v = 16384.0 },
.{ .s = "0x10p-10", .v = 0.015625 },
.{ .s = "0x0.ffffffp128", .v = 0x0.ffffffp128 },
.{ .s = "0x0.1234570p-125", .v = 0x0.1234570p-125 },
// Max normalized value.
.{ .s = "0x1.fffffeP+127", .v = math.f32_max },
.{ .s = "-0x1.fffffeP+127", .v = -math.f32_max },
// Min normalized value.
.{ .s = "0x1p-126", .v = math.f32_min },
.{ .s = "-0x1p-126", .v = -math.f32_min },
// Min denormal value.
.{ .s = "0x1P-149", .v = math.f32_true_min },
.{ .s = "-0x1P-149", .v = -math.f32_true_min },
};
for (cases) |case| {
try testing.expectEqual(case.v, try parseHexFloat(f32, case.s));
}
}
test "f64" {
const Case = struct { s: []const u8, v: f64 };
const cases: []const Case = &[_]Case{
.{ .s = "0x1p0", .v = 1.0 },
.{ .s = "-0x1p-1", .v = -0.5 },
.{ .s = "0x10p+10", .v = 16384.0 },
.{ .s = "0x10p-10", .v = 0.015625 },
// Max normalized value.
.{ .s = "0x1.fffffffffffffp+1023", .v = math.f64_max },
.{ .s = "-0x1.fffffffffffffp1023", .v = -math.f64_max },
// Min normalized value.
.{ .s = "0x1p-1022", .v = math.f64_min },
.{ .s = "-0x1p-1022", .v = -math.f64_min },
// Min denormalized value.
.{ .s = "0x1p-1074", .v = math.f64_true_min },
.{ .s = "-0x1p-1074", .v = -math.f64_true_min },
};
for (cases) |case| {
try testing.expectEqual(case.v, try parseHexFloat(f64, case.s));
}
}
test "f128" {
const Case = struct { s: []const u8, v: f128 };
const cases: []const Case = &[_]Case{
.{ .s = "0x1p0", .v = 1.0 },
.{ .s = "-0x1p-1", .v = -0.5 },
.{ .s = "0x10p+10", .v = 16384.0 },
.{ .s = "0x10p-10", .v = 0.015625 },
// Max normalized value.
.{ .s = "0xf.fffffffffffffffffffffffffff8p+16380", .v = math.f128_max },
.{ .s = "-0xf.fffffffffffffffffffffffffff8p+16380", .v = -math.f128_max },
// Min normalized value.
.{ .s = "0x1p-16382", .v = math.f128_min },
.{ .s = "-0x1p-16382", .v = -math.f128_min },
// // Min denormalized value.
.{ .s = "0x1p-16494", .v = math.f128_true_min },
.{ .s = "-0x1p-16494", .v = -math.f128_true_min },
};
for (cases) |case| {
try testing.expectEqual(@as(u128, @bitCast(case.v)), @as(u128, @bitCast(try parseHexFloat(f128, case.s))));
}
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir | repos/gotta-go-fast/src/self-hosted-parser/input_dir/fmt/errol.zig | const std = @import("../std.zig");
const enum3 = @import("errol/enum3.zig").enum3;
const enum3_data = @import("errol/enum3.zig").enum3_data;
const lookup_table = @import("errol/lookup.zig").lookup_table;
const HP = @import("errol/lookup.zig").HP;
const math = std.math;
const mem = std.mem;
const assert = std.debug.assert;
pub const FloatDecimal = struct {
digits: []u8,
exp: i32,
};
pub const RoundMode = enum {
// Round only the fractional portion (e.g. 1234.23 has precision 2)
Decimal,
// Round the entire whole/fractional portion (e.g. 1.23423e3 has precision 5)
Scientific,
};
/// Round a FloatDecimal as returned by errol3 to the specified fractional precision.
/// All digits after the specified precision should be considered invalid.
pub fn roundToPrecision(float_decimal: *FloatDecimal, precision: usize, mode: RoundMode) void {
// The round digit refers to the index which we should look at to determine
// whether we need to round to match the specified precision.
var round_digit: usize = 0;
switch (mode) {
RoundMode.Decimal => {
if (float_decimal.exp >= 0) {
round_digit = precision + @as(usize, @intCast(float_decimal.exp));
} else {
// if a small negative exp, then adjust we need to offset by the number
// of leading zeros that will occur.
const min_exp_required = @as(usize, @intCast(-float_decimal.exp));
if (precision > min_exp_required) {
round_digit = precision - min_exp_required;
}
}
},
RoundMode.Scientific => {
round_digit = 1 + precision;
},
}
// It suffices to look at just this digit. We don't round and propagate say 0.04999 to 0.05
// first, and then to 0.1 in the case of a {.1} single precision.
// Find the digit which will signify the round point and start rounding backwards.
if (round_digit < float_decimal.digits.len and float_decimal.digits[round_digit] - '0' >= 5) {
assert(round_digit >= 0);
var i = round_digit;
while (true) {
if (i == 0) {
// Rounded all the way past the start. This was of the form 9.999...
// Slot the new digit in place and increase the exponent.
float_decimal.exp += 1;
// Re-size the buffer to use the reserved leading byte.
const one_before = @as([*]u8, @ptrFromInt(@intFromPtr(&float_decimal.digits[0]) - 1));
float_decimal.digits = one_before[0 .. float_decimal.digits.len + 1];
float_decimal.digits[0] = '1';
return;
}
i -= 1;
const new_value = (float_decimal.digits[i] - '0' + 1) % 10;
float_decimal.digits[i] = new_value + '0';
// must continue rounding until non-9
if (new_value != 0) {
return;
}
}
}
}
/// Corrected Errol3 double to ASCII conversion.
pub fn errol3(value: f64, buffer: []u8) FloatDecimal {
const bits = @as(u64, @bitCast(value));
const i = tableLowerBound(bits);
if (i < enum3.len and enum3[i] == bits) {
const data = enum3_data[i];
const digits = buffer[1 .. data.str.len + 1];
mem.copy(u8, digits, data.str);
return FloatDecimal{
.digits = digits,
.exp = data.exp,
};
}
return errol3u(value, buffer);
}
/// Uncorrected Errol3 double to ASCII conversion.
fn errol3u(val: f64, buffer: []u8) FloatDecimal {
// check if in integer or fixed range
if (val > 9.007199254740992e15 and val < 3.40282366920938e+38) {
return errolInt(val, buffer);
} else if (val >= 16.0 and val < 9.007199254740992e15) {
return errolFixed(val, buffer);
}
// normalize the midpoint
const e = math.frexp(val).exponent;
var exp = @as(i16, @intFromFloat(math.floor(307 + @as(f64, @floatFromInt(e)) * 0.30103)));
if (exp < 20) {
exp = 20;
} else if (@as(usize, @intCast(exp)) >= lookup_table.len) {
exp = @as(i16, @intCast(lookup_table.len - 1));
}
var mid = lookup_table[@as(usize, @intCast(exp))];
mid = hpProd(mid, val);
const lten = lookup_table[@as(usize, @intCast(exp))].val;
exp -= 307;
var ten: f64 = 1.0;
while (mid.val > 10.0 or (mid.val == 10.0 and mid.off >= 0.0)) {
exp += 1;
hpDiv10(&mid);
ten /= 10.0;
}
while (mid.val < 1.0 or (mid.val == 1.0 and mid.off < 0.0)) {
exp -= 1;
hpMul10(&mid);
ten *= 10.0;
}
// compute boundaries
var high = HP{
.val = mid.val,
.off = mid.off + (fpnext(val) - val) * lten * ten / 2.0,
};
var low = HP{
.val = mid.val,
.off = mid.off + (fpprev(val) - val) * lten * ten / 2.0,
};
hpNormalize(&high);
hpNormalize(&low);
// normalized boundaries
while (high.val > 10.0 or (high.val == 10.0 and high.off >= 0.0)) {
exp += 1;
hpDiv10(&high);
hpDiv10(&low);
}
while (high.val < 1.0 or (high.val == 1.0 and high.off < 0.0)) {
exp -= 1;
hpMul10(&high);
hpMul10(&low);
}
// digit generation
// We generate digits starting at index 1. If rounding a buffer later then it may be
// required to generate a preceding digit in some cases (9.999) in which case we use
// the 0-index for this extra digit.
var buf_index: usize = 1;
while (true) {
var hdig = @as(u8, @intFromFloat(math.floor(high.val)));
if ((high.val == @as(f64, @floatFromInt(hdig))) and (high.off < 0)) hdig -= 1;
var ldig = @as(u8, @intFromFloat(math.floor(low.val)));
if ((low.val == @as(f64, @floatFromInt(ldig))) and (low.off < 0)) ldig -= 1;
if (ldig != hdig) break;
buffer[buf_index] = hdig + '0';
buf_index += 1;
high.val -= @as(f64, @floatFromInt(hdig));
low.val -= @as(f64, @floatFromInt(ldig));
hpMul10(&high);
hpMul10(&low);
}
const tmp = (high.val + low.val) / 2.0;
var mdig = @as(u8, @intFromFloat(math.floor(tmp + 0.5)));
if ((@as(f64, @floatFromInt(mdig)) - tmp) == 0.5 and (mdig & 0x1) != 0) mdig -= 1;
buffer[buf_index] = mdig + '0';
buf_index += 1;
return FloatDecimal{
.digits = buffer[1..buf_index],
.exp = exp,
};
}
fn tableLowerBound(k: u64) usize {
var i = enum3.len;
var j: usize = 0;
while (j < enum3.len) {
if (enum3[j] < k) {
j = 2 * j + 2;
} else {
i = j;
j = 2 * j + 1;
}
}
return i;
}
/// Compute the product of an HP number and a double.
/// @in: The HP number.
/// @val: The double.
/// &returns: The HP number.
fn hpProd(in: HP, val: f64) HP {
var hi: f64 = undefined;
var lo: f64 = undefined;
split(in.val, &hi, &lo);
var hi2: f64 = undefined;
var lo2: f64 = undefined;
split(val, &hi2, &lo2);
const p = in.val * val;
const e = ((hi * hi2 - p) + lo * hi2 + hi * lo2) + lo * lo2;
return HP{
.val = p,
.off = in.off * val + e,
};
}
/// Split a double into two halves.
/// @val: The double.
/// @hi: The high bits.
/// @lo: The low bits.
fn split(val: f64, hi: *f64, lo: *f64) void {
hi.* = gethi(val);
lo.* = val - hi.*;
}
fn gethi(in: f64) f64 {
const bits = @as(u64, @bitCast(in));
const new_bits = bits & 0xFFFFFFFFF8000000;
return @as(f64, @bitCast(new_bits));
}
/// Normalize the number by factoring in the error.
/// @hp: The float pair.
fn hpNormalize(hp: *HP) void {
const val = hp.val;
hp.val += hp.off;
hp.off += val - hp.val;
}
/// Divide the high-precision number by ten.
/// @hp: The high-precision number
fn hpDiv10(hp: *HP) void {
var val = hp.val;
hp.val /= 10.0;
hp.off /= 10.0;
val -= hp.val * 8.0;
val -= hp.val * 2.0;
hp.off += val / 10.0;
hpNormalize(hp);
}
/// Multiply the high-precision number by ten.
/// @hp: The high-precision number
fn hpMul10(hp: *HP) void {
const val = hp.val;
hp.val *= 10.0;
hp.off *= 10.0;
var off = hp.val;
off -= val * 8.0;
off -= val * 2.0;
hp.off -= off;
hpNormalize(hp);
}
/// Integer conversion algorithm, guaranteed correct, optimal, and best.
/// @val: The val.
/// @buf: The output buffer.
/// &return: The exponent.
fn errolInt(val: f64, buffer: []u8) FloatDecimal {
const pow19 = @as(u128, 1e19);
assert((val > 9.007199254740992e15) and val < (3.40282366920938e38));
var mid = @as(u128, @intFromFloat(val));
var low: u128 = mid - fpeint((fpnext(val) - val) / 2.0);
var high: u128 = mid + fpeint((val - fpprev(val)) / 2.0);
if (@as(u64, @bitCast(val)) & 0x1 != 0) {
high -= 1;
} else {
low -= 1;
}
var l64 = @as(u64, @intCast(low % pow19));
const lf = @as(u64, @intCast((low / pow19) % pow19));
var h64 = @as(u64, @intCast(high % pow19));
const hf = @as(u64, @intCast((high / pow19) % pow19));
if (lf != hf) {
l64 = lf;
h64 = hf;
mid = mid / (pow19 / 10);
}
var mi: i32 = mismatch10(l64, h64);
var x: u64 = 1;
{
var i: i32 = @intFromBool(lf == hf);
while (i < mi) : (i += 1) {
x *= 10;
}
}
const m64 = @as(u64, @truncate(@divTrunc(mid, x)));
if (lf != hf) mi += 19;
var buf_index = u64toa(m64, buffer) - 1;
if (mi != 0) {
buffer[buf_index - 1] += @intFromBool(buffer[buf_index] >= '5');
} else {
buf_index += 1;
}
return FloatDecimal{
.digits = buffer[0..buf_index],
.exp = @as(i32, @intCast(buf_index)) + mi,
};
}
/// Fixed point conversion algorithm, guaranteed correct, optimal, and best.
/// @val: The val.
/// @buf: The output buffer.
/// &return: The exponent.
fn errolFixed(val: f64, buffer: []u8) FloatDecimal {
assert((val >= 16.0) and (val < 9.007199254740992e15));
const u = @as(u64, @intFromFloat(val));
const n = @as(f64, @floatFromInt(u));
var mid = val - n;
var lo = ((fpprev(val) - n) + mid) / 2.0;
var hi = ((fpnext(val) - n) + mid) / 2.0;
var buf_index = u64toa(u, buffer);
var exp = @as(i32, @intCast(buf_index));
var j = buf_index;
buffer[j] = 0;
if (mid != 0.0) {
while (mid != 0.0) {
lo *= 10.0;
const ldig = @as(i32, @intFromFloat(lo));
lo -= @as(f64, @floatFromInt(ldig));
mid *= 10.0;
const mdig = @as(i32, @intFromFloat(mid));
mid -= @as(f64, @floatFromInt(mdig));
hi *= 10.0;
const hdig = @as(i32, @intFromFloat(hi));
hi -= @as(f64, @floatFromInt(hdig));
buffer[j] = @as(u8, @intCast(mdig + '0'));
j += 1;
if (hdig != ldig or j > 50) break;
}
if (mid > 0.5) {
buffer[j - 1] += 1;
} else if ((mid == 0.5) and (buffer[j - 1] & 0x1) != 0) {
buffer[j - 1] += 1;
}
} else {
while (buffer[j - 1] == '0') {
buffer[j - 1] = 0;
j -= 1;
}
}
buffer[j] = 0;
return FloatDecimal{
.digits = buffer[0..j],
.exp = exp,
};
}
fn fpnext(val: f64) f64 {
return @as(f64, @bitCast(@as(u64, @bitCast(val)) +% 1));
}
fn fpprev(val: f64) f64 {
return @as(f64, @bitCast(@as(u64, @bitCast(val)) -% 1));
}
pub const c_digits_lut = [_]u8{
'0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6',
'0', '7', '0', '8', '0', '9', '1', '0', '1', '1', '1', '2', '1', '3',
'1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '2', '0',
'2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7',
'2', '8', '2', '9', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4',
'3', '5', '3', '6', '3', '7', '3', '8', '3', '9', '4', '0', '4', '1',
'4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8',
'4', '9', '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5',
'5', '6', '5', '7', '5', '8', '5', '9', '6', '0', '6', '1', '6', '2',
'6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9',
'7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6',
'7', '7', '7', '8', '7', '9', '8', '0', '8', '1', '8', '2', '8', '3',
'8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', '9', '0',
'9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7',
'9', '8', '9', '9',
};
fn u64toa(value_param: u64, buffer: []u8) usize {
var value = value_param;
const kTen8: u64 = 100000000;
const kTen9: u64 = kTen8 * 10;
const kTen10: u64 = kTen8 * 100;
const kTen11: u64 = kTen8 * 1000;
const kTen12: u64 = kTen8 * 10000;
const kTen13: u64 = kTen8 * 100000;
const kTen14: u64 = kTen8 * 1000000;
const kTen15: u64 = kTen8 * 10000000;
const kTen16: u64 = kTen8 * kTen8;
var buf_index: usize = 0;
if (value < kTen8) {
const v = @as(u32, @intCast(value));
if (v < 10000) {
const d1: u32 = (v / 100) << 1;
const d2: u32 = (v % 100) << 1;
if (v >= 1000) {
buffer[buf_index] = c_digits_lut[d1];
buf_index += 1;
}
if (v >= 100) {
buffer[buf_index] = c_digits_lut[d1 + 1];
buf_index += 1;
}
if (v >= 10) {
buffer[buf_index] = c_digits_lut[d2];
buf_index += 1;
}
buffer[buf_index] = c_digits_lut[d2 + 1];
buf_index += 1;
} else {
// value = bbbbcccc
const b: u32 = v / 10000;
const c: u32 = v % 10000;
const d1: u32 = (b / 100) << 1;
const d2: u32 = (b % 100) << 1;
const d3: u32 = (c / 100) << 1;
const d4: u32 = (c % 100) << 1;
if (value >= 10000000) {
buffer[buf_index] = c_digits_lut[d1];
buf_index += 1;
}
if (value >= 1000000) {
buffer[buf_index] = c_digits_lut[d1 + 1];
buf_index += 1;
}
if (value >= 100000) {
buffer[buf_index] = c_digits_lut[d2];
buf_index += 1;
}
buffer[buf_index] = c_digits_lut[d2 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d3];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d3 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d4];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d4 + 1];
buf_index += 1;
}
} else if (value < kTen16) {
const v0: u32 = @as(u32, @intCast(value / kTen8));
const v1: u32 = @as(u32, @intCast(value % kTen8));
const b0: u32 = v0 / 10000;
const c0: u32 = v0 % 10000;
const d1: u32 = (b0 / 100) << 1;
const d2: u32 = (b0 % 100) << 1;
const d3: u32 = (c0 / 100) << 1;
const d4: u32 = (c0 % 100) << 1;
const b1: u32 = v1 / 10000;
const c1: u32 = v1 % 10000;
const d5: u32 = (b1 / 100) << 1;
const d6: u32 = (b1 % 100) << 1;
const d7: u32 = (c1 / 100) << 1;
const d8: u32 = (c1 % 100) << 1;
if (value >= kTen15) {
buffer[buf_index] = c_digits_lut[d1];
buf_index += 1;
}
if (value >= kTen14) {
buffer[buf_index] = c_digits_lut[d1 + 1];
buf_index += 1;
}
if (value >= kTen13) {
buffer[buf_index] = c_digits_lut[d2];
buf_index += 1;
}
if (value >= kTen12) {
buffer[buf_index] = c_digits_lut[d2 + 1];
buf_index += 1;
}
if (value >= kTen11) {
buffer[buf_index] = c_digits_lut[d3];
buf_index += 1;
}
if (value >= kTen10) {
buffer[buf_index] = c_digits_lut[d3 + 1];
buf_index += 1;
}
if (value >= kTen9) {
buffer[buf_index] = c_digits_lut[d4];
buf_index += 1;
}
if (value >= kTen8) {
buffer[buf_index] = c_digits_lut[d4 + 1];
buf_index += 1;
}
buffer[buf_index] = c_digits_lut[d5];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d5 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d6];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d6 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d7];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d7 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d8];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d8 + 1];
buf_index += 1;
} else {
const a = @as(u32, @intCast(value / kTen16)); // 1 to 1844
value %= kTen16;
if (a < 10) {
buffer[buf_index] = '0' + @as(u8, @intCast(a));
buf_index += 1;
} else if (a < 100) {
const i: u32 = a << 1;
buffer[buf_index] = c_digits_lut[i];
buf_index += 1;
buffer[buf_index] = c_digits_lut[i + 1];
buf_index += 1;
} else if (a < 1000) {
buffer[buf_index] = '0' + @as(u8, @intCast(a / 100));
buf_index += 1;
const i: u32 = (a % 100) << 1;
buffer[buf_index] = c_digits_lut[i];
buf_index += 1;
buffer[buf_index] = c_digits_lut[i + 1];
buf_index += 1;
} else {
const i: u32 = (a / 100) << 1;
const j: u32 = (a % 100) << 1;
buffer[buf_index] = c_digits_lut[i];
buf_index += 1;
buffer[buf_index] = c_digits_lut[i + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[j];
buf_index += 1;
buffer[buf_index] = c_digits_lut[j + 1];
buf_index += 1;
}
const v0 = @as(u32, @intCast(value / kTen8));
const v1 = @as(u32, @intCast(value % kTen8));
const b0: u32 = v0 / 10000;
const c0: u32 = v0 % 10000;
const d1: u32 = (b0 / 100) << 1;
const d2: u32 = (b0 % 100) << 1;
const d3: u32 = (c0 / 100) << 1;
const d4: u32 = (c0 % 100) << 1;
const b1: u32 = v1 / 10000;
const c1: u32 = v1 % 10000;
const d5: u32 = (b1 / 100) << 1;
const d6: u32 = (b1 % 100) << 1;
const d7: u32 = (c1 / 100) << 1;
const d8: u32 = (c1 % 100) << 1;
buffer[buf_index] = c_digits_lut[d1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d1 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d2];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d2 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d3];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d3 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d4];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d4 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d5];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d5 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d6];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d6 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d7];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d7 + 1];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d8];
buf_index += 1;
buffer[buf_index] = c_digits_lut[d8 + 1];
buf_index += 1;
}
return buf_index;
}
fn fpeint(from: f64) u128 {
const bits = @as(u64, @bitCast(from));
assert((bits & ((1 << 52) - 1)) == 0);
return @as(u128, 1) << @as(u7, @truncate((bits >> 52) -% 1023));
}
/// Given two different integers with the same length in terms of the number
/// of decimal digits, index the digits from the right-most position starting
/// from zero, find the first index where the digits in the two integers
/// divergent starting from the highest index.
/// @a: Integer a.
/// @b: Integer b.
/// &returns: An index within [0, 19).
fn mismatch10(a: u64, b: u64) i32 {
const pow10 = 10000000000;
const af = a / pow10;
const bf = b / pow10;
var i: i32 = 0;
var a_copy = a;
var b_copy = b;
if (af != bf) {
i = 10;
a_copy = af;
b_copy = bf;
}
while (true) : (i += 1) {
a_copy /= 10;
b_copy /= 10;
if (a_copy == b_copy) return i;
}
}
|
0 | repos/gotta-go-fast/src/self-hosted-parser/input_dir/fmt | repos/gotta-go-fast/src/self-hosted-parser/input_dir/fmt/errol/enum3.zig | pub const enum3 = [_]u64{
0x4e2e2785c3a2a20b,
0x240a28877a09a4e1,
0x728fca36c06cf106,
0x1016b100e18e5c17,
0x3159190e30e46c1d,
0x64312a13daa46fe4,
0x7c41926c7a7122ba,
0x08667a3c8dc4bc9c,
0x18dde996371c6060,
0x297c2c31a31998ae,
0x368b870de5d93270,
0x57d561def4a9ee32,
0x6d275d226331d03a,
0x76703d7cb98edc59,
0x7ec490abad057752,
0x037be9d5a60850b5,
0x0c63165633977bca,
0x14a048cb468bc209,
0x20dc29bc6879dfcd,
0x2643dc6227de9148,
0x2d64f14348a4c5db,
0x341eef5e1f90ac35,
0x4931159a8bd8a240,
0x503ca9bade45b94a,
0x5c1af5b5378aa2e5,
0x6b4ef9beaa7aa584,
0x6ef1c382c3819a0a,
0x754fe46e378bf133,
0x7ace779fddf21622,
0x7df22815078cb97b,
0x7f33c8eeb77b8d05,
0x011b7aa3d73f6658,
0x06ceb7f2c53db97f,
0x0b8f3d82e9356287,
0x0e304273b18918b0,
0x139fb24e492936f6,
0x176090684f5fe997,
0x1e3035e7b5183922,
0x220ce77c2b3328fc,
0x246441ed79830182,
0x279b5cd8bbdd8770,
0x2cc7c3fba45c1272,
0x3081eab25ad0fcf7,
0x329f5a18504dfaac,
0x347eef5e1f90ac35,
0x3a978cfcab31064c,
0x4baa32ac316fb3ab,
0x4eb9a2c2a34ac2f9,
0x522f6a5025e71a61,
0x5935ede8cce30845,
0x5f9aeac2d1ea2695,
0x6820ee7811241ad3,
0x6c06c9e14b7c22c3,
0x6e5a2fbffdb7580c,
0x71160cf8f38b0465,
0x738a37935f3b71c9,
0x756fe46e378bf133,
0x7856d2aa2fc5f2b5,
0x7bd3b063946e10ae,
0x7d8220e1772428d7,
0x7e222815078cb97b,
0x7ef5bc471d5456c7,
0x7fb82baa4ae611dc,
0x00bb7aa3d73f6658,
0x0190a0f3c55062c5,
0x05898e3445512a6e,
0x07bfe89cf1bd76ac,
0x08dfa7ebe304ee3e,
0x0c43165633977bca,
0x0e104273b18918b0,
0x0fd6ba8608faa6a9,
0x10b4139a6b17b224,
0x1466cc4fc92a0fa6,
0x162ba6008389068a,
0x1804116d591ef1fb,
0x1c513770474911bd,
0x1e7035e7b5183923,
0x2114dab846e19e25,
0x222ce77c2b3328fc,
0x244441ed79830182,
0x249b23b50fc204db,
0x278aacfcb88c92d6,
0x289d52af46e5fa6a,
0x2bdec922478c0421,
0x2d44f14348a4c5dc,
0x2f0c1249e96b6d8d,
0x30addc7e975c5045,
0x322aedaa0fc32ac8,
0x33deef5e1f90ac34,
0x343eef5e1f90ac35,
0x35ef1de1f7f14439,
0x3854faba79ea92ec,
0x47f52d02c7e14af7,
0x4a6bb6979ae39c49,
0x4c85564fb098c955,
0x4e80fde34c996086,
0x4ed9a2c2a34ac2f9,
0x51a3274280201a89,
0x574fe0403124a00e,
0x581561def4a9ee31,
0x5b55ed1f039cebff,
0x5e2780695036a679,
0x624be064a3fb2725,
0x674dcfee6690ffc6,
0x6a6cc08102f0da5b,
0x6be6c9e14b7c22c4,
0x6ce75d226331d03a,
0x6d5b9445072f4374,
0x6e927edd0dbb8c09,
0x71060cf8f38b0465,
0x71b1d7cb7eae05d9,
0x72fba10d818fdafd,
0x739a37935f3b71c9,
0x755fe46e378bf133,
0x76603d7cb98edc59,
0x78447e17e7814ce7,
0x799d696737fe68c7,
0x7ade779fddf21622,
0x7c1c283ffc61c87d,
0x7d1a85c6f7fba05d,
0x7da220e1772428d7,
0x7e022815078cb97b,
0x7e9a9b45a91f1700,
0x7ee3c8eeb77b8d05,
0x7f13c8eeb77b8d05,
0x7f6594223f5654bf,
0x7fd82baa4ae611dc,
0x002d243f646eaf51,
0x00f5d15b26b80e30,
0x0180a0f3c55062c5,
0x01f393b456eef178,
0x05798e3445512a6e,
0x06afdadafcacdf85,
0x06e8b03fd6894b66,
0x07cfe89cf1bd76ac,
0x08ac25584881552a,
0x097822507db6a8fd,
0x0c27b35936d56e28,
0x0c53165633977bca,
0x0c8e9eddbbb259b4,
0x0e204273b18918b0,
0x0f1d16d6d4b89689,
0x0fe6ba8608faa6a9,
0x105f48347c60a1be,
0x13627383c5456c5e,
0x13f93bb1e72a2033,
0x148048cb468bc208,
0x1514c0b3a63c1444,
0x175090684f5fe997,
0x17e4116d591ef1fb,
0x18cde996371c6060,
0x19aa2cf604c30d3f,
0x1d2b1ad9101b1bfd,
0x1e5035e7b5183923,
0x1fe5a79c4e71d028,
0x20ec29bc6879dfcd,
0x218ce77c2b3328fb,
0x221ce77c2b3328fc,
0x233f346f9ed36b89,
0x243441ed79830182,
0x245441ed79830182,
0x247441ed79830182,
0x2541e4ee41180c0a,
0x277aacfcb88c92d6,
0x279aacfcb88c92d6,
0x27cbb4c6bd8601bd,
0x28c04a616046e074,
0x2a4eeff57768f88c,
0x2c2379f099a86227,
0x2d04f14348a4c5db,
0x2d54f14348a4c5dc,
0x2d6a8c931c19b77a,
0x2fa387cf9cb4ad4e,
0x308ddc7e975c5046,
0x3149190e30e46c1d,
0x318d2ec75df6ba2a,
0x32548050091c3c24,
0x33beef5e1f90ac34,
0x33feef5e1f90ac35,
0x342eef5e1f90ac35,
0x345eef5e1f90ac35,
0x35108621c4199208,
0x366b870de5d93270,
0x375b20c2f4f8d4a0,
0x3864faba79ea92ec,
0x3aa78cfcab31064c,
0x4919d9577de925d5,
0x49ccadd6dd730c96,
0x4b9a32ac316fb3ab,
0x4bba32ac316fb3ab,
0x4cff20b1a0d7f626,
0x4e3e2785c3a2a20b,
0x4ea9a2c2a34ac2f9,
0x4ec9a2c2a34ac2f9,
0x4f28750ea732fdae,
0x513843e10734fa57,
0x51e71760b3c0bc13,
0x55693ba3249a8511,
0x57763ae2caed4528,
0x57f561def4a9ee32,
0x584561def4a9ee31,
0x5b45ed1f039cebfe,
0x5bfaf5b5378aa2e5,
0x5c6cf45d333da323,
0x5e64ec8fd70420c7,
0x6009813653f62db7,
0x64112a13daa46fe4,
0x672dcfee6690ffc6,
0x677a77581053543b,
0x699873e3758bc6b3,
0x6b3ef9beaa7aa584,
0x6b7b86d8c3df7cd1,
0x6bf6c9e14b7c22c3,
0x6c16c9e14b7c22c3,
0x6d075d226331d03a,
0x6d5a3bdac4f00f33,
0x6e4a2fbffdb7580c,
0x6e927edd0dbb8c08,
0x6ee1c382c3819a0a,
0x70f60cf8f38b0465,
0x7114390c68b888ce,
0x714fb4840532a9e5,
0x727fca36c06cf106,
0x72eba10d818fdafd,
0x737a37935f3b71c9,
0x73972852443155ae,
0x754fe46e378bf132,
0x755fe46e378bf132,
0x756fe46e378bf132,
0x76603d7cb98edc58,
0x76703d7cb98edc58,
0x782f7c6a9ad432a1,
0x78547e17e7814ce7,
0x7964066d88c7cab8,
0x7ace779fddf21621,
0x7ade779fddf21621,
0x7bc3b063946e10ae,
0x7c0c283ffc61c87d,
0x7c31926c7a7122ba,
0x7d0a85c6f7fba05d,
0x7d52a5daf9226f04,
0x7d9220e1772428d7,
0x7db220e1772428d7,
0x7dfe5aceedf1c1f1,
0x7e122815078cb97b,
0x7e8a9b45a91f1700,
0x7eb6202598194bee,
0x7ec6202598194bee,
0x7ef3c8eeb77b8d05,
0x7f03c8eeb77b8d05,
0x7f23c8eeb77b8d05,
0x7f5594223f5654bf,
0x7f9914e03c9260ee,
0x7fc82baa4ae611dc,
0x7fefffffffffffff,
0x001d243f646eaf51,
0x00ab7aa3d73f6658,
0x00cb7aa3d73f6658,
0x010b7aa3d73f6658,
0x012b7aa3d73f6658,
0x0180a0f3c55062c6,
0x0190a0f3c55062c6,
0x03719f08ccdccfe5,
0x03dc25ba6a45de02,
0x05798e3445512a6f,
0x05898e3445512a6f,
0x06bfdadafcacdf85,
0x06cfdadafcacdf85,
0x06f8b03fd6894b66,
0x07c1707c02068785,
0x08567a3c8dc4bc9c,
0x089c25584881552a,
0x08dfa7ebe304ee3d,
0x096822507db6a8fd,
0x09e41934d77659be,
0x0c27b35936d56e27,
0x0c43165633977bc9,
0x0c53165633977bc9,
0x0c63165633977bc9,
0x0c7e9eddbbb259b4,
0x0c9e9eddbbb259b4,
0x0e104273b18918b1,
0x0e204273b18918b1,
0x0e304273b18918b1,
0x0fd6ba8608faa6a8,
0x0fe6ba8608faa6a8,
0x1006b100e18e5c17,
0x104f48347c60a1be,
0x10a4139a6b17b224,
0x12cb91d317c8ebe9,
0x138fb24e492936f6,
0x13afb24e492936f6,
0x14093bb1e72a2033,
0x1476cc4fc92a0fa6,
0x149048cb468bc209,
0x1504c0b3a63c1444,
0x161ba6008389068a,
0x168cfab1a09b49c4,
0x175090684f5fe998,
0x176090684f5fe998,
0x17f4116d591ef1fb,
0x18a710b7a2ef18b7,
0x18d99fccca44882a,
0x199a2cf604c30d3f,
0x1b5ebddc6593c857,
0x1d1b1ad9101b1bfd,
0x1d3b1ad9101b1bfd,
0x1e4035e7b5183923,
0x1e6035e7b5183923,
0x1fd5a79c4e71d028,
0x20cc29bc6879dfcd,
0x20e8823a57adbef8,
0x2104dab846e19e25,
0x2124dab846e19e25,
0x220ce77c2b3328fb,
0x221ce77c2b3328fb,
0x222ce77c2b3328fb,
0x229197b290631476,
0x240a28877a09a4e0,
0x243441ed79830181,
0x244441ed79830181,
0x245441ed79830181,
0x246441ed79830181,
0x247441ed79830181,
0x248b23b50fc204db,
0x24ab23b50fc204db,
0x2633dc6227de9148,
0x2653dc6227de9148,
0x277aacfcb88c92d7,
0x278aacfcb88c92d7,
0x279aacfcb88c92d7,
0x27bbb4c6bd8601bd,
0x289d52af46e5fa69,
0x28b04a616046e074,
0x28d04a616046e074,
0x2a3eeff57768f88c,
0x2b8e3a0aeed7be19,
0x2beec922478c0421,
0x2cc7c3fba45c1271,
0x2cf4f14348a4c5db,
0x2d44f14348a4c5db,
0x2d54f14348a4c5db,
0x2d5a8c931c19b77a,
0x2d64f14348a4c5dc,
0x2efc1249e96b6d8d,
0x2f0f6b23cfe98807,
0x2fe91b9de4d5cf31,
0x308ddc7e975c5045,
0x309ddc7e975c5045,
0x30bddc7e975c5045,
0x3150ed9bd6bfd003,
0x317d2ec75df6ba2a,
0x321aedaa0fc32ac8,
0x32448050091c3c24,
0x328f5a18504dfaac,
0x3336dca59d035820,
0x33ceef5e1f90ac34,
0x33eeef5e1f90ac35,
0x340eef5e1f90ac35,
0x34228f9edfbd3420,
0x34328f9edfbd3420,
0x344eef5e1f90ac35,
0x346eef5e1f90ac35,
0x35008621c4199208,
0x35e0ac2e7f90b8a3,
0x361dde4a4ab13e09,
0x367b870de5d93270,
0x375b20c2f4f8d49f,
0x37f25d342b1e33e5,
0x3854faba79ea92ed,
0x3864faba79ea92ed,
0x3a978cfcab31064d,
0x3aa78cfcab31064d,
0x490cd230a7ff47c3,
0x4929d9577de925d5,
0x4939d9577de925d5,
0x49dcadd6dd730c96,
0x4a7bb6979ae39c49,
0x4b9a32ac316fb3ac,
0x4baa32ac316fb3ac,
0x4bba32ac316fb3ac,
0x4cef20b1a0d7f626,
0x4e2e2785c3a2a20a,
0x4e3e2785c3a2a20a,
0x4e6454b1aef62c8d,
0x4e90fde34c996086,
0x4ea9a2c2a34ac2fa,
0x4eb9a2c2a34ac2fa,
0x4ec9a2c2a34ac2fa,
0x4ed9a2c2a34ac2fa,
0x4f38750ea732fdae,
0x504ca9bade45b94a,
0x514843e10734fa57,
0x51b3274280201a89,
0x521f6a5025e71a61,
0x52c6a47d4e7ec633,
0x55793ba3249a8511,
0x575fe0403124a00e,
0x57863ae2caed4528,
0x57e561def4a9ee32,
0x580561def4a9ee31,
0x582561def4a9ee31,
0x585561def4a9ee31,
0x59d0dd8f2788d699,
0x5b55ed1f039cebfe,
0x5beaf5b5378aa2e5,
0x5c0af5b5378aa2e5,
0x5c4ef3052ef0a361,
0x5e1780695036a679,
0x5e54ec8fd70420c7,
0x5e6b5e2f86026f05,
0x5faaeac2d1ea2695,
0x611260322d04d50b,
0x625be064a3fb2725,
0x64212a13daa46fe4,
0x671dcfee6690ffc6,
0x673dcfee6690ffc6,
0x675dcfee6690ffc6,
0x678a77581053543b,
0x682d3683fa3d1ee0,
0x699cb490951e8515,
0x6b3ef9beaa7aa583,
0x6b4ef9beaa7aa583,
0x6b7896beb0c66eb9,
0x6bdf20938e7414bb,
0x6bef20938e7414bb,
0x6bf6c9e14b7c22c4,
0x6c06c9e14b7c22c4,
0x6c16c9e14b7c22c4,
0x6cf75d226331d03a,
0x6d175d226331d03a,
0x6d4b9445072f4374,
};
const Slab = struct {
str: []const u8,
exp: i32,
};
fn slab(str: []const u8, exp: i32) Slab {
return Slab{
.str = str,
.exp = exp,
};
}
pub const enum3_data = [_]Slab{
slab("40648030339495312", 69),
slab("4498645355592131", -134),
slab("678321594594593", 244),
slab("36539702510912277", -230),
slab("56819570380646536", -70),
slab("42452693975546964", 175),
slab("34248868699178663", 291),
slab("34037810581283983", -267),
slab("67135881167178176", -188),
slab("74973710847373845", -108),
slab("60272377639347644", -45),
slab("1316415380484425", 116),
slab("64433314612521525", 218),
slab("31961502891542243", 263),
slab("4407140524515149", 303),
slab("69928982131052126", -291),
slab("5331838923808276", -248),
slab("24766435002945523", -208),
slab("21509066976048781", -149),
slab("2347200170470694", -123),
slab("51404180294474556", -89),
slab("12320586499023201", -56),
slab("38099461575161174", 45),
slab("3318949537676913", 79),
slab("48988560059074597", 136),
slab("7955843973866726", 209),
slab("2630089515909384", 227),
slab("11971601492124911", 258),
slab("35394816534699092", 284),
slab("47497368114750945", 299),
slab("54271187548763685", 305),
slab("2504414972009504", -302),
slab("69316187906522606", -275),
slab("53263359599109627", -252),
slab("24384437085962037", -239),
slab("3677854139813342", -213),
slab("44318030915155535", -195),
slab("28150140033551147", -162),
slab("1157373742186464", -143),
slab("2229658838863212", -132),
slab("67817280930489786", -117),
slab("56966478488538934", -92),
slab("49514357246452655", -74),
slab("74426102121433776", -64),
slab("78851753593748485", -55),
slab("19024128529074359", -25),
slab("32118580932839778", 57),
slab("17693166778887419", 72),
slab("78117757194253536", 88),
slab("56627018760181905", 122),
slab("35243988108650928", 153),
slab("38624526316654214", 194),
slab("2397422026462446", 213),
slab("37862966954556723", 224),
slab("56089100059334965", 237),
slab("3666156212014994", 249),
slab("47886405968499643", 258),
slab("48228872759189434", 272),
slab("29980574575739863", 289),
slab("37049827284413546", 297),
slab("37997894491800756", 300),
slab("37263572163337027", 304),
slab("16973149506391291", 308),
slab("391314839376485", -304),
slab("38797447671091856", -300),
slab("54994366114768736", -281),
slab("23593494977819109", -270),
slab("61359116592542813", -265),
slab("1332959730952069", -248),
slab("6096109271490509", -240),
slab("22874741188249992", -231),
slab("33104948806015703", -227),
slab("21670630627577332", -209),
slab("70547825868713855", -201),
slab("54981742371928845", -192),
slab("27843818440071113", -171),
slab("4504022405368184", -161),
slab("2548351460621656", -148),
slab("4629494968745856", -143),
slab("557414709715803", -133),
slab("23897004381644022", -131),
slab("33057350728075958", -117),
slab("47628822744182433", -112),
slab("22520091703825729", -96),
slab("1285104507361864", -89),
slab("46239793787746783", -81),
slab("330095714976351", -73),
slab("4994144928421182", -66),
slab("77003665618895", -58),
slab("49282345996092803", -56),
slab("66534156679273626", -48),
slab("24661175471861008", -36),
slab("45035996273704964", 39),
slab("32402369146794532", 51),
slab("42859354584576066", 61),
slab("1465909318208761", 71),
slab("70772667115549675", 72),
slab("18604316837693468", 86),
slab("38329392744333992", 113),
slab("21062646087750798", 117),
slab("972708181182949", 132),
slab("36683053719290777", 146),
slab("32106017483029628", 166),
slab("41508952543121158", 190),
slab("45072812455233127", 205),
slab("59935550661561155", 212),
slab("40270821632825953", 217),
slab("60846862848160256", 219),
slab("42788225889846894", 225),
slab("28044550029667482", 237),
slab("46475406389115295", 240),
slab("7546114860200514", 246),
slab("7332312424029988", 249),
slab("23943202984249821", 258),
slab("15980751445771122", 263),
slab("21652206566352648", 272),
slab("65171333649148234", 278),
slab("70789633069398184", 284),
slab("68600253110025576", 290),
slab("4234784709771466", 295),
slab("14819930913765419", 298),
slab("9499473622950189", 299),
slab("71272819274635585", 302),
slab("16959746108988652", 304),
slab("13567796887190921", 305),
slab("4735325513114182", 306),
slab("67892598025565165", 308),
slab("81052743999542975", -307),
slab("4971131903427841", -303),
slab("19398723835545928", -300),
slab("29232758945460627", -298),
slab("27497183057384368", -281),
slab("17970091719480621", -275),
slab("22283747288943228", -274),
slab("47186989955638217", -270),
slab("6819439187504402", -266),
slab("47902021250710456", -262),
slab("41378294570975613", -249),
slab("2665919461904138", -248),
slab("3421423777071132", -247),
slab("12192218542981019", -239),
slab("7147520638007367", -235),
slab("45749482376499984", -231),
slab("80596937390013985", -229),
slab("26761990828289327", -214),
slab("18738512510673039", -211),
slab("619160875073638", -209),
slab("403997300048931", -206),
slab("22159015457577768", -195),
slab("13745435592982211", -192),
slab("33567940583589088", -188),
slab("4812711195250522", -184),
slab("3591036630219558", -167),
slab("1126005601342046", -161),
slab("5047135806497922", -154),
slab("43018133952097563", -149),
slab("45209911804158747", -146),
slab("2314747484372928", -143),
slab("65509428048152994", -138),
slab("2787073548579015", -133),
slab("1114829419431606", -132),
slab("4459317677726424", -132),
slab("32269008655522087", -128),
slab("16528675364037979", -117),
slab("66114701456151916", -117),
slab("54934856534126976", -116),
slab("21168365664081082", -111),
slab("67445733463759384", -104),
slab("45590931008842566", -95),
slab("8031903171011649", -91),
slab("2570209014723728", -89),
slab("6516605505584466", -89),
slab("32943123175907307", -78),
slab("82523928744087755", -74),
slab("28409785190323268", -70),
slab("52853886779813977", -69),
slab("30417302377115577", -65),
slab("1925091640472375", -58),
slab("30801466247558002", -57),
slab("24641172998046401", -56),
slab("19712938398437121", -55),
slab("43129529027318865", -52),
slab("15068094409836911", -45),
slab("48658418478920193", -41),
slab("49322350943722016", -36),
slab("38048257058148717", -25),
slab("14411294198511291", 45),
slab("32745697577386472", 48),
slab("16059290466419889", 57),
slab("64237161865679556", 57),
slab("8003248329710242", 63),
slab("81296060678990625", 69),
slab("8846583389443709", 71),
slab("35386333557774838", 72),
slab("21606114462319112", 74),
slab("18413733104063271", 84),
slab("35887030159858487", 87),
slab("2825769263311679", 104),
slab("2138446062528161", 114),
slab("52656615219377", 116),
slab("16850116870200639", 118),
slab("48635409059147446", 132),
slab("12247140014768649", 136),
slab("16836228873919609", 138),
slab("5225574770881846", 147),
slab("42745323906998127", 155),
slab("10613173493886741", 175),
slab("10377238135780289", 190),
slab("29480080280199528", 191),
slab("4679330956996797", 201),
slab("3977921986933363", 209),
slab("56560320317673966", 210),
slab("1198711013231223", 213),
slab("4794844052924892", 213),
slab("16108328653130381", 218),
slab("57878622568856074", 219),
slab("18931483477278361", 224),
slab("4278822588984689", 225),
slab("1315044757954692", 227),
slab("14022275014833741", 237),
slab("5143975308105889", 237),
slab("64517311884236306", 238),
slab("3391607972972965", 244),
slab("3773057430100257", 246),
slab("1833078106007497", 249),
slab("64766168833734675", 249),
slab("1197160149212491", 258),
slab("2394320298424982", 258),
slab("4788640596849964", 258),
slab("1598075144577112", 263),
slab("3196150289154224", 263),
slab("83169412421960475", 271),
slab("43304413132705296", 272),
slab("5546524276967009", 277),
slab("3539481653469909", 284),
slab("7078963306939818", 284),
slab("14990287287869931", 289),
slab("34300126555012788", 290),
slab("17124434349589332", 291),
slab("2117392354885733", 295),
slab("47639264836707725", 296),
slab("7409965456882709", 297),
slab("29639861827530837", 298),
slab("79407577493590275", 299),
slab("18998947245900378", 300),
slab("35636409637317792", 302),
slab("23707742595255608", 303),
slab("47415485190511216", 303),
slab("33919492217977303", 304),
slab("6783898443595461", 304),
slab("27135593774381842", 305),
slab("2367662756557091", 306),
slab("44032152438472327", 307),
slab("33946299012782582", 308),
slab("17976931348623157", 309),
slab("40526371999771488", -307),
slab("1956574196882425", -304),
slab("78262967875297", -304),
slab("1252207486004752", -302),
slab("5008829944019008", -302),
slab("1939872383554593", -300),
slab("3879744767109186", -300),
slab("44144884605471774", -291),
slab("45129663866844427", -289),
slab("2749718305738437", -281),
slab("5499436611476874", -281),
slab("35940183438961242", -275),
slab("71880366877922484", -275),
slab("44567494577886457", -274),
slab("25789638850173173", -270),
slab("17018905290641991", -267),
slab("3409719593752201", -266),
slab("6135911659254281", -265),
slab("23951010625355228", -262),
slab("51061856989121905", -260),
slab("4137829457097561", -249),
slab("13329597309520689", -248),
slab("26659194619041378", -248),
slab("53318389238082755", -248),
slab("1710711888535566", -247),
slab("6842847554142264", -247),
slab("609610927149051", -240),
slab("1219221854298102", -239),
slab("2438443708596204", -239),
slab("2287474118824999", -231),
slab("4574948237649998", -231),
slab("18269851255456139", -230),
slab("40298468695006992", -229),
slab("16552474403007851", -227),
slab("39050270537318193", -217),
slab("1838927069906671", -213),
slab("7355708279626684", -213),
slab("37477025021346077", -211),
slab("43341261255154663", -209),
slab("12383217501472761", -208),
slab("2019986500244655", -206),
slab("35273912934356928", -201),
slab("47323883490786093", -199),
slab("2215901545757777", -195),
slab("4431803091515554", -195),
slab("27490871185964422", -192),
slab("64710073234908765", -189),
slab("57511323531737074", -188),
slab("2406355597625261", -184),
slab("75862936714499446", -176),
slab("1795518315109779", -167),
slab("7182073260439116", -167),
slab("563002800671023", -162),
slab("2252011202684092", -161),
slab("2523567903248961", -154),
slab("10754533488024391", -149),
slab("37436263604934127", -149),
slab("1274175730310828", -148),
slab("5096702921243312", -148),
slab("11573737421864639", -143),
slab("23147474843729279", -143),
slab("46294949687458557", -143),
slab("36067106647774144", -141),
slab("44986453555921307", -134),
slab("27870735485790148", -133),
slab("55741470971580295", -133),
slab("11148294194316059", -132),
slab("22296588388632118", -132),
slab("44593176777264236", -132),
slab("11948502190822011", -131),
slab("47794008763288043", -131),
slab("1173600085235347", -123),
slab("4694400340941388", -123),
slab("1652867536403798", -117),
slab("3305735072807596", -117),
slab("6611470145615192", -117),
slab("27467428267063488", -116),
slab("4762882274418243", -112),
slab("10584182832040541", -111),
slab("42336731328162165", -111),
slab("33722866731879692", -104),
slab("69097540994131414", -98),
slab("45040183407651457", -96),
slab("5696647848853893", -92),
slab("40159515855058247", -91),
slab("12851045073618639", -89),
slab("25702090147237278", -89),
slab("3258302752792233", -89),
slab("5140418029447456", -89),
slab("23119896893873391", -81),
slab("51753157237874753", -81),
slab("67761208324172855", -77),
slab("8252392874408775", -74),
slab("1650478574881755", -73),
slab("660191429952702", -73),
slab("3832399419240467", -70),
slab("26426943389906988", -69),
slab("2497072464210591", -66),
slab("15208651188557789", -65),
slab("37213051060716888", -64),
slab("55574205388093594", -61),
slab("385018328094475", -58),
slab("15400733123779001", -57),
slab("61602932495116004", -57),
slab("14784703798827841", -56),
slab("29569407597655683", -56),
slab("9856469199218561", -56),
slab("39425876796874242", -55),
slab("21564764513659432", -52),
slab("35649516398744314", -48),
slab("51091836539008967", -47),
slab("30136188819673822", -45),
slab("4865841847892019", -41),
slab("33729482964455627", -38),
slab("2466117547186101", -36),
slab("4932235094372202", -36),
slab("1902412852907436", -25),
slab("3804825705814872", -25),
slab("80341375308088225", 44),
slab("28822588397022582", 45),
slab("57645176794045164", 45),
slab("65491395154772944", 48),
slab("64804738293589064", 51),
slab("1605929046641989", 57),
slab("3211858093283978", 57),
slab("6423716186567956", 57),
slab("4001624164855121", 63),
slab("4064803033949531", 69),
slab("8129606067899062", 69),
slab("4384946084578497", 70),
slab("2931818636417522", 71),
slab("884658338944371", 71),
slab("1769316677888742", 72),
slab("3538633355777484", 72),
slab("7077266711554968", 72),
slab("43212228924638223", 74),
slab("6637899075353826", 79),
slab("36827466208126543", 84),
slab("37208633675386937", 86),
slab("39058878597126768", 88),
slab("57654578150150385", 91),
slab("5651538526623358", 104),
slab("76658785488667984", 113),
slab("4276892125056322", 114),
slab("263283076096885", 116),
slab("10531323043875399", 117),
slab("42125292175501597", 117),
slab("33700233740401277", 118),
slab("44596066840334405", 125),
slab("9727081811829489", 132),
slab("61235700073843246", 135),
slab("24494280029537298", 136),
slab("4499029632233837", 137),
slab("18341526859645389", 146),
slab("2612787385440923", 147),
slab("6834859331393543", 147),
slab("70487976217301855", 153),
slab("40366692112133834", 160),
slab("64212034966059256", 166),
slab("21226346987773482", 175),
slab("51886190678901447", 189),
slab("20754476271560579", 190),
slab("83017905086242315", 190),
slab("58960160560399056", 191),
slab("66641177824100826", 194),
slab("5493127645170153", 201),
slab("39779219869333628", 209),
slab("79558439738667255", 209),
slab("50523702331566894", 210),
slab("40933393326155808", 212),
slab("81866786652311615", 212),
slab("11987110132312231", 213),
slab("23974220264624462", 213),
slab("47948440529248924", 213),
slab("8054164326565191", 217),
slab("32216657306260762", 218),
slab("30423431424080128", 219),
};
|
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.