arch: architecture-specific interface
The arch module provides non-portable access to CPU information and the floating point environment.
// Undocumented types: type cpuid_ecxflag; type cpuid_edxflag; type cpuid_vendor;
// Undocumented Errors: type cpuid_unknownvendor;
fn cpuid_getvendor() (cpuid_vendor | cpuid_unknownvendor); fn cpuid_hasflags(edx: u32, ecx: u32) bool; // Undocumented functions: fn feclearexcept(ex: uint) void; fn fegetround() uint; fn feraiseexcept(ex: uint) void; fn fesetround(mode: uint) void; fn fetestexcept(ex: uint) uint;
type cpuid_ecxflag = enum uint { SSE3 = 1 << 0, AES = 1 << 25, AVX = 1 << 28, };
type cpuid_edxflag = enum uint { SSE = 1 << 25, SSE2 = 1 << 26, };
type cpuid_vendor = enum { AMD, INTEL, WINCHIP, TRANSMETA, CYRIX, CENTAUR, NEXGEN, UMC, SIS, NSC, RISE, VORTEX, VIA, ZHAOXIN, HYGON, MCST_ELBRUS, VMWARE, // Virtual Machines. XENHVM, MICROSOFT_HV, PARALLELS, };
type cpuid_unknownvendor = !void;
fn cpuid_getvendor() (cpuid_vendor | cpuid_unknownvendor);
Figures out cpu vendor using cpuid
fn cpuid_hasflags(edx: u32, ecx: u32) bool;
Checks if cpu has given features. See cpuid_edxflag and cpuid_ecxflag for available options.
fn feclearexcept(ex: uint) void;
fn fegetround() uint;
fn feraiseexcept(ex: uint) void;
fn fesetround(mode: uint) void;
fn fetestexcept(ex: uint) uint;