Condition code flag emulation for program code conversion
OwnerJohn Sandham, Geraint M. Northinventors
Life of this patent
Estimating the term…
Abstract
An emulator (30) allows subject code (10) written for a subject processor (12) having subject processor registers (14) and condition code flags (16) to run in a non-compatible computing environment (2). The emulator (3) identifies and records parameters of instructions in the subject code (10) that affect status of the subject condition code flags (16). Then, when an instruction in the subject code (10) is encountered, such as a branch or jump, that uses the flag status to make a decision, the flag status is resolved from the recorded instruction parameters. Advantageously, emulation overhead is substantially reduced.
Claims25
A method for emulating condition code flags during program code conversion, comprising the steps of:
- (a) identifying a flag-affecting instruction in a sequence of subject code instructions;
- (b) recording parameters of the identified flag-affecting instruction;
- (c) detecting a flag-usage instruction in the sequence of subject code instructions;
- and
- (d) resolving a flag status with respect to the recorded parameters.
A method for emulating condition code flags during program code conversion, comprising:
- selecting a sequence of subject code instructions;
- identifying a flag-affecting instruction in the sequence of subject code instructions, the flag-affecting instruction specifying an operation that affects subject condition code flags of a subject processor;
- recording parameters of the identified flag-affecting instruction including an instruction type parameter and one or more operand parameters;
- detecting a flag-usage instruction in the sequence of subject code instructions, the flag-usage instruction specifying an operation with reference to a flag status of one or more of the subject condition code flags;
- and
- in response to detecting a flag-usage instruction, resolving a flag status of one or more of the subject condition code flags with respect to the recorded parameters.
An emulator apparatus for use in a target computing environment for emulating a subject processor of a subject computing environment when translating subject code appropriate to the subject computing environment to produce target code appropriate to the target computing environment, the emulator apparatus comprising:
- means for identifying a flag-affecting instruction in a sequence of subject code instructions;
- an instruction parameter store for recording parameters of the identified flag-affecting instruction;
- means for detecting a flag-usage instruction in the sequence of subject code instructions;
- and
- means for resolving a flag status with respect to the instruction parameters recorded in the instruction parameter store.
Dependencies are inferred from the claim text.