Patent ID: 8230479
Filing Date: 2012-07-24
Classification: G06F

Abstract:
1. A method of using binary code translation to introduce an additional or modified function into a program run on a processor comprising: a) translating original program code for said program at runtime by adding code to implement said additional or modified function; b) updating an address offset correction table each time code is added to provide a mapping from original program code addresses to relocated addresses in said translated code; c) as each branch is reached, determining whether the branch is a static branch with a static target or a dynamic branch with a runtime computed branch target; d) stopping said translating at the dynamic branches; e) translating static branches by replacing the original branch targets with corrected target addresses provided by the address offset correction table; f) when a dynamic branch is executed where translation was previously stopped, continuing said translating at runtime at said dynamic branch; and g) continuing translating beginning at the target of said dynamic branch by using the original branch target address to lookup a corrected branch target address using said offset correction table; whereby when execution reaches code at said target, the target code is translated to introduce the additional or modified function while branch target addresses are corrected, taking into account the code address changes caused by inserting code at previous addresses.