Simple code to demonstrate how one can use Intel(R) VT-x technology to setup Virtual Machine Control Structure (VMCS) and launch virtual machine. Virtual machine state mirrors host state.
The tool measures VM-Entry and VM-Exit turnaroound time in cycles. RDTSC instruction is used to do the measurements.
Superuser access is required to run the tool.
$ ./get_vmlatency.sh
- gcc
- kernel headers
- virtualization must be enabled in BIOS.
Windows does not allow to load unsigned drivers so one have to setup self signing to run the tool. The instructions below are based on VirtualBox's wiki page and on Windows's TechNet article
All pathes are specified for Windows Driver Kit Version 7.1.0.
- Launch administrator command prompt
- Create the test certifiate
C:\WinDDK\7600.16385.1\bin\amd64\MakeCert.exe -r -pe -ss my -n "CN=MyTestCertificate" mytestcert.cer
- Register the certificate in your system
C:\WinDDK\7600.16385.1\bin\amd64\CertMgr.exe -add mytestcert.cer -s -r localMachine root
- Keep mytestcert.cer in a safe place
- Launch administrator command prompt
- Enable testing mode in Windows registry
Bcdedit.exe -set TESTSIGNING ON
C:\WinDDK\7600.16385.1\bin\amd64\CertMgr.exe -add mytestcert.cer -s -r localMachine root
C:\WinDDK\7600.16385.1\bin\amd64\CertMgr.exe -add mytestcert.cer -s -r localMachine trustedpublisher
- Reboot the system
- After reboot you will see
"Test Mode<CR>Windows 7<CR>Build 7600"
in the right left corner if you use Windows 7
C:\WinDDK\7600.16385.1\bin\amd64\SignTool.exe sign /f <path to>\mytestcert.cer build-win7-fre\amd64\vmlatency.sys