Patent ID: 8510756

Claim:
A method for increasing efficiency of guest operating system (OS) code in a Virtual Machine (VM) running under control of a Virtual Machine Monitor VMM), wherein the guest OS code includes unsafe instructions that force a processor to exit Virtual Machine context, the method comprising: (a) entering a virtual machine hardware support mode of the processor; (b) installing a code analysis routine that analyzes opcodes of instructions in the guest OS code; (c) entering a VM context execution mode that fully virtualizes the processor; (d) at run time, detecting presence of the opcodes of unsafe instructions in the guest OS code using the code analysis routine; (e) executing natively, in the VM context, and without switching to the VMM, substitute instructions instead of at least some of the unsafe instructions; and (f) resuming the guest OS code execution, after execution of the substitute instructions, wherein the code analysis routine is implemented as a guest tool in a hypervisor or another virtual machine, and wherein the guest tool implements the guest OS code parsing and modification using information about memory mapping of a guest OS kernel.