I'm trying to find a way to know if my program is running in a VM programmatically. This needs to work on any OS and any architecture (x86, or ARM).
Using the CPUID in x86 with eax=1, we are able to see if the hypervisor bit is set to 1, and this will give us the info that we are running in VM. This seems to work pretty well, especially on any OS. However, it is not portable on the new M{1,2} CPUs.
Is there any instruction similar to CPUID to get this hypervisor bit on ARM ?
On windows, I only found the way of parsing the hardware info with WMI, and get the company names -> This will lead to parse all the VM company names which is not portable in the future.
On Linux, the /proc/cpuinfo file can also be parsed to get this information. But didn't find any similar way to get this in Windows nor OSX.
Do you know any reg key or something similar to have such info ?
My goal is just to know if we are running in a VM, don't really need anything else (Vendor name for instance is not needed).
Any lead would be much appreciated :)