Files
Odin/core/sys/info/cpu_riscv64.odin
Jeroen van Rijn 655fab7227 Add core/hyperthread count for Windows and Linux (#5216)
Add core/hyperthread count to `core:sys/info` for Windows and Linux.
TODO: Linux RISCV, Linux ARM, Darwin, and the BSDs.
2025-05-25 19:43:10 +02:00

104 lines
1.5 KiB
Odin

package sysinfo
CPU_Feature :: enum u64 {
// Bit-Manipulation ISA Extensions v1.
Zba = 3,
Zbb,
Zbs,
// CMOs (ratified).
Zicboz,
// Bit-Manipulation ISA Extensions v1.
Zbc,
// Scalar Crypto ISA extensions v1.
Zbkb,
Zbkc,
Zbkx,
Zknd,
Zkne,
Zknh,
Zksed,
Zksh,
Zkt,
// Cryptography Extensions Volume II v1.
Zvbb,
Zvbc,
Zvkb,
Zvkg,
Zvkned,
Zvknha,
Zvknhb,
Zvksed,
Zvksh,
Zvkt,
// ISA Manual v1.
Zfh,
Zfhmin,
Zihintntl,
// ISA manual (ratified).
Zvfh,
Zvfhmin,
Zfa,
Ztso,
// Atomic Compare-and-Swap Instructions Manual (ratified).
Zacas,
Zicond,
// ISA manual (ratified).
Zihintpause,
// Vector Extensions Manual v1.
Zve32x,
Zve32f,
Zve64x,
Zve64f,
Zve64d,
// ISA manual (ratified).
Zimop,
// Code Size Reduction (ratified).
Zca,
Zcb,
Zcd,
Zcf,
// ISA manual (ratified).
Zcmop,
Zawrs,
// Base features, don't think this is ever not here.
I,
// Integer multiplication and division, currently required by Odin.
M,
// Atomics.
A,
// Single precision floating point, currently required by Odin.
F,
// Double precision floating point, currently required by Odin.
D,
// Compressed instructions.
C,
// Vector operations.
V,
// Indicates Misaligned Scalar Loads will not trap the program.
Misaligned_Supported,
// Indicates Hardware Support for Misaligned Scalar Loads.
Misaligned_Fast,
}
CPU_Features :: distinct bit_set[CPU_Feature; u64]
CPU :: struct {
name: Maybe(string),
features: Maybe(CPU_Features),
physical_cores: int,
logical_cores: int,
}
cpu: CPU