A hardware-assisted virtualization system having a central processing unit, CPU; the CPU having operational modes comprising at least a normal mode, a record mode, and a replay mode, wherein the record mode is for recording execution of a virtual machine on the CPU and the replay mode is for replaying execution of the virtual machine on the CPU: the CPU is configured such that when the CPU is in the record mode: i) each time an instruction corresponding to a predefined subset of an instruction set of the CPU is encountered by an execution engine of the CPU, a result of execution of the instruction is stored in a buffer, wherein the predefined subset comprises instructions that generate non-deterministic values, and ii) a fault or exception is triggered by the CPU when the buffer is full, thereby exiting from a context of the virtual machine to a context of a hypervisor; and when the CPU is in the replay mode: iii) each time the instruction corresponding to the predefined subset is encountered by the execution engine, a next non-deterministic value is read from the buffer and supplied in place of a result of the execution of the instruction, and iv) a fault or exception is triggered by the CPU when the buffer does not contain a next value, thereby exiting from the context of the virtual machine to the context of the hypervisor. the CPU is configured such that when the CPU is in the record mode: i) each time an instruction corresponding to a predefined subset of an instruction set of the CPU is encountered by an execution engine of the CPU, a result of execution of the instruction is stored in a buffer, wherein the predefined subset comprises instructions that generate non-deterministic values, and ii) a fault or exception is triggered by the CPU when the buffer is full, thereby exiting from a context of the virtual machine to a context of a hypervisor; and when the CPU is in the replay mode: iii) each time the instruction corresponding to the predefined subset is encountered by the execution engine, a next non-deterministic value is read from the buffer and supplied in place of a result of the execution of the instruction, and iv) a fault or exception is triggered by the CPU when the buffer does not contain a next value, thereby exiting from the context of the virtual machine to the context of the hypervisor. i) each time an instruction corresponding to a predefined subset of an instruction set of the CPU is encountered by an execution engine of the CPU, a result of execution of the instruction is stored in a buffer, wherein the predefined subset comprises instructions that generate non-deterministic values, and ii) a fault or exception is triggered by the CPU when the buffer is full, thereby exiting from a context of the virtual machine to a context of a hypervisor; and when the CPU is in the replay mode: iii) each time the instruction corresponding to the predefined subset is encountered by the execution engine, a next non-deterministic value is read from the buffer and supplied in place of a result of the execution of the instruction, and iv) a fault or exception is triggered by the CPU when the buffer does not contain a next value, thereby exiting from the context of the virtual machine to the context of the hypervisor.