Patent ID: 7472384
Filing Date: 2008-12-30
Classification: G06F

Abstract:
1. A method of on-the-fly patching of executable code comprising: identifying original instructions to be changed while the original instructions are being executed on a processor; copying the original instructions 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 for transferring control to an unpatched instruction in a location where the instructions are being patched; and replacing the original instructions while the original instructions are in the process of being executed on the processor 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; and calling the hook, wherein the mark instructions place an identifiable set of data into a processor stack that is identified at a later time, such that the stack contains a number of how many instructions have been patched, wherein the hook activates the second jump instruction to transfer control to the copied instructions at a location just after the original instruction from which the hook was called; wherein the original instructions are part of the instruction set of the processor available to a user, wherein a number of times the mark instructions have been executed is counted to determine a location of the processor's instruction pointer where execution should resume, in the patched instructions, and wherein the modified instructions determine the number of the instructions at the location of the original code that had already been executed.