Patent ID: 8015558
Filing Date: 2011-09-06
Classification: G06F

Abstract:
1. A method of on-the-fly patching of executable code comprising: copying original instructions to be changed to a storage location; adding a hook with a first jump instruction for transferring control to the copied instructions; using a second jump instruction in the copied instructions to transfer control to an unpatched instruction in a location where the instructions are being patched; replacing the original instructions with mark instructions by using atomic writes that guarantee that a result of the operation can be observed as completed or not observed at all; using the mark instructions, storing, in a stack, a number representing how many instructions have been patched; calling the hook; using the hook, and activating the second jump instruction to transfer control to a location just after one of the original instructions from which the hook was called; and counting a number of times the mark instructions have been executed is counted to determine where, in the patched instructions, execution should resume, wherein instructions, at a location of the original instructions, are used to determine a number of the instructions that had already been executed based on the number representing how many instructions have been patched and the number of times the mark instructions have been executed.