Binary to Text translator
4 stars based on
The translation process takes place during execution of the source binary code. In order to improve execution speed g binary translator the source binary code, the dynamic binary translator may need to reduce overhead during the translation process. Overhead may include, for example, repetitive translation of a same fragment or same set of instructions of the source binary code, redundancy in saving a same set of instructions or same fragment of the source binary code being translated, etc.
For example, if the source binary code is unchanged during execution, the relating translated target binary code may be reused. Translation reuse may require verifying consistency of the source instruction to be currently translated compared to previously translated source instruction relating to the target binary code to be reused. To ensure consistency, a no-fault verification method may require saving all the fragments of the source binary code that affect the translation, and comparing all the saved fragments with a fragment to be executed.
In addition, because a dynamic binary translator may not be able to discover the exact boundaries of functions of the source binary code, a conventional dynamic binary translator may need g binary translator rely on an inaccurate verification procedure to verify consistency of the source binary code, leaving certain functional issues unresolved. The g binary translator will be understood and appreciated more fully from the following detailed description of embodiments of the invention, taken in conjunction with g binary translator accompanying g binary translator of which:.
It will be appreciated that for simplicity and clarity of illustration, elements shown in the figures have not g binary translator been drawn to scale. For example, the dimensions of some of the elements may be exaggerated relative to other elements for clarity. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of embodiments of the invention. However it will be understood by those of ordinary skill in the art that embodiments of the invention may be practiced without these specific details.
In other instances, g binary translator methods and procedures have not been described in detail so as not to obscure the embodiments of the invention. Some portions of the detailed description in the following are presented in terms of algorithms and symbolic representations of operations on data bits or binary digital signals within a computer memory. These algorithmic descriptions and representations may be the techniques used by those skilled in the data processing arts to convey the substance of their work to others skilled in the art.
An algorithm is here, and generally, considered to be a self-consistent sequence of acts or operations leading to a desired result. These include physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated.
It has proven convenient at times, principally for reasons g binary translator common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers or the like. It should be understood, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities.
Embodiments of the invention may include g binary translator for performing the operations herein. These g binary translator may be specially constructed for the desired purposes, or they may include a general-purpose computer selectively activated or reconfigured by a computer program stored in the computer.
Such a computer program may be stored in a computer readable storage medium, such as, but is not limited to, any type of disk including floppy disks, optical disks, CD-ROMs, magnetic-optical disks, read-only memories ROMrandom access memories RAMelectrically programmable read-only memories EPROMelectrically erasable and programmable read only memories EEPROMmagnetic or optical cards, or any other type of media suitable for storing electronic instructions, and capable of being coupled to a computer system g binary translator. The processes and displays presented herein are not inherently related to any particular computer or other apparatus.
Various general-purpose systems may be used with programs in accordance with the teachings herein, or it may prove convenient to construct a more specialized apparatus to perform the desired g binary translator. The desired structure for a variety of these systems will appear from the description below. In addition, embodiments of the invention are not described with reference to any particular programming language.
It will be appreciated that a variety of programming languages may be used to implement the teachings of the invention as described herein. G binary translator the following description, various figures, diagrams, flowcharts, models, and descriptions are presented as different means to effectively g binary translator the substances and illustrate different embodiments of the invention that are proposed in this application. It shall be understood by those skilled in the art that they are provided merely as exemplary samples, and shall not be constructed g binary translator limitation g binary translator the invention.
A non-exhaustive list of g binary translator for apparatus 2 may include a desktop personal computer, a workstation, a server computer, a laptop computer, a notebook computer, a hand-held computer, a personal digital assistant PDAa mobile telephone, a game console, and the like. Moreover, processor 4 may be part of an application specific integrated circuit ASICor may be part of an application specific standard product ASSP.
Memory 6 may be fixed within or removable from apparatus 2. If the source architecture g binary translator not comply with the target architecture, as is the case, for example, with the IA and Itanium architectures, processor 4 may not be able to execute source binary code According to some exemplary embodiments of the invention, processor 4 may invoke dynamic binary translator 30 to translate source binary code 10 into target binary code While fragments of source binary code 10 are being translated into code blocks of target binary code 20processor 4 may execute the translated code blocks of target binary code The results of executing the translated code blocks of target binaries 20 may generally correspond to the results of executing g binary translator binary code 10 on a processor that complies with the source architecture.
Dynamic binary translator 30 may translate source binaries 10 in fragments into code blocks of target binaries 20 for execution by a target processor complying with a target architecture.
A source fragment, or code fragment, may be a source binary instruction, a basic instruction code, a code page, or other code size. As shown in FIG. As translator 30 translates the source binaries to be executed by processor 4execution engine 31 may direct the flow of execution of processor 4 through the translated code blocks.
When the execution flow to be carried out by processor 4 reaches a source fragment, e. Upon receiving the translation request, translation engine 32 may attempt to query for a previously g binary translator code block that may potentially be reused to perform the instructions included in the source fragment.
A potentially reusable code block may be a code block that has been previously translated g binary translator the same source fragment but may not be currently accessible by the execution engine To search for such a potentially reusable code block, translation engine 32 may send a reuse request to reuse engine If a potentially reusable translated code block is identified, reuse engine 33 may proceed to verify the consistency of the source fragment that corresponds to the identified code block, thereby to determine a g binary translator status of the identified code block.
A source fragment is considered consistent if each and every instruction in the source fragment is exactly the same as it was before, for example, when the source fragment was originally translated. The reusable translated code block may then be passed to execution engine 31 for execution. If the previously translated code block is determined to be unusable, e.
This may be achieved by global optimization performed by the dynamic binary translator. When global optimization is performed on translated code block 21certain functions used in translated code block 21 may be realized sharing a translated code block of a different source fragment. For example, as is shown in FIG. It will be appreciated that if all source fragments in the RSB of a previously translated code block are consistent, that is, each and every instruction of the RSB source fragments is the same as it was before, e.
The translated code block may then be identified as safely reusable. Therefore, according to exemplary embodiments of the present invention, verification of reusability status of a translated code block may be limited to verifying the consistency of only those source fragments that are related to g binary translator translated code block.
Such source fragment verification, that is, verification of only the RSB elements of the translated code block, ensures correctness of the reused target g binary translator blocks and may be faster than conventional methods that verify the entire source binary code.
Furthermore, it will be appreciated that verifying only the RSB elements of the translated code block, according to embodiments of the invention, does not compromise the quality of the translated target binaries.
The RVR parameter may be defined as a ratio between the number of source fragments that are verified more than once, and the number of all verified source fragments. The NVR may be defined as a ratio between the number of source fragments that are verified but whose verification results are not actually used, and the total number of verified source fragments.
Verifying only the RSB elements of a translated code block, according to exemplary embodiments of the invention, may reduce the NVR of the translator and, thus, improve translation efficiency.
However, it is appreciated that even if the NVR is minimal, the same source fragment may be verified more than once for different translated code blocks, because a given source fragment, e. This potential redundancy is overcome by some exemplary embodiments of the invention, e. According to exemplary embodiments of the invention, the efficiency of a dynamic binary translator, as measured by for example, RVR, may be improved by grouping translated code blocks into one or more code block groups, e.
A code block group, e. Source fragments corresponding to a group of translated code blocks may be the union of the RSB elements of all the group g binary translator, and may be g binary translator as part of a RSB groups 40 in memory 6separately from the original source fragment 10 FIG. According to embodiments of the invention, during dynamic binary translation, consistency of source fragments may be verified for a group, rather than for g binary translator translated code blocks.
Similarly, translated code blocks 22 and 23 may share a common source fragment 43which may also g binary translator saved as a RSB element of group source According to exemplary embodiments of the invention, translated code blocks 2122and 23whose RSB elements may intersect with each other, may be included in code block group 26 and may share source fragments of group Similarly, translated code blocks 24 g binary translator 25 may be included in another code block group e.
In this example, the reusability status of group 27 may be marked as non-reusable, as described in more detail below. In some embodiments, translated code block 25 may belong to g binary translator group 29 of invalidated binaries, and may be revived during the process of dynamic binary translation, as discussed in detail below with reference to FIG.
In a RSB group such as, for example, source group 46overlapping RSB elements, for example, source fragments 42 and 43may be saved only once but may be referenced by multiple translated code blocks. In this manner, there may be less, or no duplicated RSB elements in any single group. The reusability status of a group to which a translated code block belongs may be used to determine the reusability status of the translated code block. If the group g binary translator marked as reusable, the code block may then be determined to be reusable.
If the reusability status of the group is marked as unknown, reuse engine 33 may need to re-verify consistency of the group's RSB elements. If all of the RSB elements are verified to be consistent, the group may be re-marked as reusable, and the code block may be reused. The process of grouping source fragments and verifying reusability of the group, according to embodiments of the invention, may result in a low, or even zero, RVR, a reduction in verification time, and conservation of storage space needed to contain the source fragments.
During execution of source binaries, execution engine 31 FIG. The execution flow may reach a current source fragment, which may g binary translator a set of source instructions of any size, for which execution engine 31 may be unable to identify a corresponding previously translated code block.
In such case, as indicated g binary translator boxexecution engine 31 may send a translation request to translation nse intraday tips 4u 32 FIG. Upon receiving the translation request at boxtranslation g binary translator 32 may send a reuse request to reuse engine 33 FIG. According to some embodiments of the invention, certain previously translated code blocks may be effectively inaccessible to execution engine As indicated at boxreuse engine 33 may attempt to find or locate the previously translated code block, as described above, as well as a group to which the translated code block may belong.
At boxif none of the translated code blocks g binary translator determined to meet the requirement of the reuse request, reuse engine 33 may send translation engine 32 an indication that a reusable translated code g binary translator for the source fragment cannot be found or located. After receiving the indication at box that no reusable translated code block can be found or located, at box translation engine 32 may proceed to translate the source fragment.
A newly translated code block may subsequently be generated g binary translator sent for execution by execution engine More details concerning the translation process performed by g binary translator engine 32 are described below with reference to FIG.
If a corresponding translated code block, e. G binary translator boxreuse engine 33 may read the reusability status marking of g binary translator group, e. If group 26 is marked as reusable, indicating that all the translated code blocks in the group, i.
Reuse engine 33 may then terminate the reusability verification process and, as indicated at boxmay send the identified code block, i. Translation engine 32 may in turn pass the identified code block 23 to execution engine g binary translator for execution.
If all the RSB elements related to the group, e. At this point, any translated code blocks, e. G binary translator identified code block, e. Translation engine 32 may subsequently pass code block 24 to execution engine 31 for execution. If at box one or more of the RSB elements related to the group, e. In such a case, the group, e.