virtualization or OS ?
Posted: Mon May 04, 2009 9:31 pm
I want to write a code which will determine whether it runs on a physical system or inside a virtualized environment / software ? Would this be possible ?
The Place to Start for Operating System Developers
http://f.osdev.org/
If you're referring to emulated environment, no not in general. However the emulator may have behavior that the emulated system does not, but that would need to be specific to the emulator. Why do you ask? Do your system need to do something different when it's run in the emulator? If the emulator does not support some specific hardware then you have to test for the presence of that hardware (which you must anyway). The emulator may have hardware that is not present on normal system as well, but the same goes here - you have to test for the presence of the hardware you are going to use. Also the CPU in the emulator may behave slightly differently which probably should be possible to determine via the CPUID.extremecoder wrote:I want to write a code which will determine whether it runs on a physical system or inside a virtualized environment / software ? Would this be possible ?
If you are referring to eht AMD/Intel virtualization extensions, then yes, you can. I think some status register contains some flag indicating it runs in virtualization. Check the Intel/AMD docs for specifics.extremecoder wrote:I want to write a code which will determine whether it runs on a physical system or inside a virtualized environment / software ? Would this be possible ?