HenrikBengtsson / x86-64-level

x86-64-level - Get the x86-64 Microarchitecture Level on the Current Machine
https://github.com/HenrikBengtsson/x86-64-level
95 stars 16 forks source link

Add FreeBSD support #16

Open ocochard opened 6 months ago

ocochard commented 6 months ago

Adding support, tested on Intel Xeon Platinum 8259CL and AMD EPYC 7502P.

I didn’t map all CPU features name, but only the mandatories like MMX+ -> mmxext.

$ uname -a
FreeBSD15.0-CURRENT FreeBSD 15.0-CURRENT #0 master-n6860-b5e4f003d8ca-dirty: Thu May  2 22:21:20 UTC 2024
$ grep Features /var/run/dmesg.boot | sort | uniq
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  Features2=0x7ffefbff<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,SMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Structured Extended Features2=0x818<PKU,OSPKE,AVX512VNNI>
  Structured Extended Features3=0xbc000400<MD_CLEAR,IBPB,STIBP,L1DFL,ARCH_CAP,SSBD>
  Structured Extended Features=0xd39ffffb<FSGSBASE,TSCADJ,BMI1,HLE,AVX2,FDPEXC,SMEP,BMI2,ERMS,INVPCID,RTM,PQM,NFPUSG,MPX,PQE,AVX512F,AVX512DQ,RDSEED,ADX,SMAP,CLFLUSHOPT,CLWB,PROCTRACE,AVX512CD,AVX512BW,AVX512VL>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>

$ ./x86-64-level
4