Method and apparatus for patching problematic instructions in a microprocessor using software interrupts
First Claim
1. A method for processing instructions within a pipelined processor, the method comprising the steps of:
- fetching an instruction;
matching an instruction using at least one match condition, wherein the match condition identifies instructions which are to be patched;
marking an instruction as a matched instruction by setting a match bit;
passing the match bit associated with the matched instruction through the pipelined processor with the matched instruction;
replacing the matched instruction with an interrupt instruction; and
patching the marked instruction, using an interrupt handler based on the interrupt instruction, by replacing the marked instruction with one or more other instructions that perform a same logical operation on data as the marked instruction.
3 Assignments
0 Petitions
Accused Products
Abstract
A method and apparatus for patching a problematic instruction within a pipelined processor in a data processing system is presented. A plurality of instructions are fetched, and the plurality of instructions are matched against at least one match condition to generate a matched instruction. The match conditions may include matching the opcode of an instruction, the pre-decode bits of an instruction, a type of instruction, or other conditions. A matched instruction may be marked using a match bit that accompanies the instruction through the instruction pipeline. The matched instruction is then replaced with an internal opcode or internal instruction that causes the instruction scheduling unit to take a special software interrupt. The problematic instruction is then patched through the execution of a set of instructions that cause the desired logical operation of the problematic instruction.
295 Citations
30 Claims
-
1. A method for processing instructions within a pipelined processor, the method comprising the steps of:
-
fetching an instruction;
matching an instruction using at least one match condition, wherein the match condition identifies instructions which are to be patched;
marking an instruction as a matched instruction by setting a match bit;
passing the match bit associated with the matched instruction through the pipelined processor with the matched instruction;
replacing the matched instruction with an interrupt instruction; and
patching the marked instruction, using an interrupt handler based on the interrupt instruction, by replacing the marked instruction with one or more other instructions that perform a same logical operation on data as the marked instruction. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
fetching a plurality of instructions from a memory or a cache;
filtering the plurality of instructions using a match value against each instruction in the plurality of instructions to generate a subset of matched instructions; and
storing the matched instructions in an instruction cache.
-
-
8. The method of claim 7 further comprising:
-
setting a match bit for each matched instruction in the subset of matched instructions;
associatively storing the match bit for each matched instruction in the instruction cache with the matched instructions.
-
-
9. The method of claim 1 further comprising:
-
bitwise comparing the instruction with at least one pair of associated match values, wherein the pair of match values represents a combinational logic function to be applied against the instruction; and
in response to a determination that the bitwise comparison results in a successful match, selecting the instruction as a matched instruction.
-
-
10. The method of claim 9 wherein the step of bitwise comparing comprises, for instruction bit in a set of bits representing the instruction:
-
obtaining an instruction bit;
obtaining a corresponding first match value bit from a first match value in the pair of match values;
obtaining a corresponding second match value bit from a second match value in the pair of match values; and
determining a match result bit according to a preconfigured logic function in the processor.
-
-
11. The method of claim 10 further comprising:
bitwise ANDing the match result bits to determine whether the bitwise comparison results in a successful match.
-
12. An apparatus for processing instructions within a pipelined processor, the apparatus comprising:
-
fetching means for fetching an instruction;
matching means for matching an instruction using at least one match condition, wherein the match condition identifies instructions which are to be placed;
marking means for marking an instruction as a matched instruction by setting a match bit;
passing means for passing the match bit associated with the matched instruction through the pipelined processor with the matched instruction;
replacing means for replacing the matched instruction with an interrupt instruction; and
patching means for patching the marked instruction, using an interrupt handler based on the interrupt instruction, by replacing the marked instruction with one or more other instructions that perform a same logical operation on data as the marked instruction. - View Dependent Claims (13, 14, 15, 16, 17, 18, 19, 20, 21, 22)
executing means for executing the interrupt instruction in conjunction with a software interrupt vector to invoke a software interrupt handler.
-
-
15. The apparatus of claim 12 wherein an instruction is matched based on an instruction opcode.
-
16. The apparatus of claim 12 wherein an instruction is matched based on an instruction classification.
-
17. The apparatus of claim 16 wherein the instruction classification is selected from the group consisting of instruction type, instruction opcode, instruction operand source, or instruction operand destination.
-
18. The apparatus of claim 12 further comprising:
-
fetching means for fetching a plurality of instructions from a memory or a cache;
filtering means for filtering the plurality of instructions using match value against each instruction in the plurality of instructions to generate a subset of matched instructions; and
first storing means for storing the matched instructions in an instruction cache.
-
-
19. The apparatus of claim 18 further comprising:
-
setting means for setting a match bit for each matched instruction in the subset of matched instructions;
second storing means for associatively storing the match bit for each matched instruction in the instruction cache with the matched instructions.
-
-
20. The apparatus of claim 12 further comprising:
-
comparing means for bitwise comparing the instruction with at least one pair of associated match values, wherein the pair of match values represents a combinational logic function to be applied against the instruction; and
selecting means for selecting, in response to a determination that the bitwise comparison results in a successful match, the instruction as a matched instruction.
-
-
21. The apparatus of claim 20 wherein the comparing means comprises, for each instruction bit in a set of bits representing the instruction:
-
first obtaining means for obtaining an instruction bit;
second obtaining means for obtaining a corresponding first match value bit from a first match value in the pair of match values;
third obtaining means for obtaining a corresponding second match value bit from a second match value in the pair of match values; and
determining means for determining a match result bit according to a preconfigured logic function in the processor.
-
-
22. The apparatus of claim 21 further comprising:
ANDing means for bitwise ANDing the match result bits to determine whether the bitwise comparison results in a successful match.
-
23. A computer program product in a computer-readable medium for use in a data processing system for processing instructions within a pipelined processor, the computer program product comprising:
-
instructions for fetching an instruction;
instructions for matching a fetched instruction using at least one match condition, wherein the match condition identifies instructions which are to be patched;
instructions for marking an instruction as a matched instruction by setting a match bit;
instruction for passing the match bit associated with the matched instruction through the pipelined processor with the matched instruction;
instructions for replacing the matched instruction with an interrupt instruction; and
instructions for patching the marked instruction, using an interrupt handler based on the interrupt instruction, by replacing the marked instruction with one or more other instructions that perform a same logical operation on data as the marked instruction. - View Dependent Claims (24, 25, 26, 27, 28)
-
-
29. A method for processing instructions within a pipelined processor, the method comprising the steps of:
-
fetching an instruction;
matching the instruction based on an opcode of the instruction;
setting a match bit based on a result of the matching;
selecting one of the opcode of the instruction and an interrupt opcode based on the value of the match bit and whether or not an interrupt mode is selected, wherein the selected opcode is output as a selected opcode; and
outputting the match bit and the selected opcode to an instruction scheduling unit.
-
-
30. An apparatus for processing instructions within a pipelined processor, comprising:
-
an instruction match facility;
an instruction cache coupled to the instruction match facility;
an instruction decode unit coupled to the instruction cache; and
an instruction scheduling unit coupled to the instruction decode unit, wherein the instruction match facility matches a fetched instruction based on an opcode of the fetched instruction and outputs opcode instruction bits along with a match bit to the instruction cache, the instruction cache outputs the match bit and the opcode instruction bits to the instruction decode unit, the instruction decode unit selects one of the opcode of the instruction and an interrupt opcode based on the match bit and the assertion of an interrupt mode select signal, the selected opcode being output to the instruction scheduling unit along with the match bit.
-
Specification