📜 ⬆️ ⬇️

Forgotten word: environment

Once upon a time, when computers were large and programs were small, an important concept such as Environment was used. This good term has already lost its reserved meaning, but has not lost its relevance. In connection with the widespread use of virtualization, information about the operating environment has become the subject of discussion and in some ways even of sports interest among programmers. We decided to participate in this with the “iron” argument - the CPUID instruction.

Why is that? The fact is that, in addition to standard and advanced functions, CPUID also implements virtual functions, which the hypervisor of the host system is responsible for performing. In this case, the result of the get hypervisor information query may be one of the signatures that uniquely identify the operating environment. Depending on the implementation, the following signatures may be available to us (the list is incomplete):

image
')
In order to identify the features of the virtual environment implemented by Oracle VirtualBox, it was decided on the basis of the previously written example of UEFIInfo (in English interpretation - Brief Sysinfo Utility), designed to work in the EFI Byte Code mode with 32-bit and 64-bit UEFI BIOS implementations, write a working software that identifies this very environment. (Something about our experiments with EBC is published here, on Habré. See, for example, the note " EFI Byte Code and memory operations ")

Why UEFI? Because experiments with firmware are a kind of “clean room”, free from cultural layers of software. Having a well-established algorithm in hand is easy to get to the implementation of such software for Linux or Windows.

The source code of the UEFIInfo v0.02 utility in assembly language was decided to be posted for public viewing. To attract attention, we place a screenshot of its execution in the Oracle VirtualBox virtual environment, weighed down by the influence of the open TianoCore implementation:

image

Source: https://habr.com/ru/post/273555/


All Articles