US9563424B2ActiveUtilityA1

Native code instruction selection

89
Assignee: GOOGLE INCPriority: Aug 17, 2012Filed: Jan 31, 2013Granted: Feb 7, 2017
Est. expiryAug 17, 2032(~6.1 yrs left)· nominal 20-yr term from priority
G06F 9/30003G06F 8/52
89
PatentIndex Score
14
Cited by
19
References
27
Claims

Abstract

Methods, systems, and apparatus, including computer programs encoded on computer storage media, for selecting native code instructions. One of the methods includes receiving an initial machine language instruction for execution by a processor in a first execution mode; determining that a portion of the initial machine language instruction, when executed by the processor in a second execution mode, satisfies one or more risk criteria; generating one or more alternative machine language instructions to replace the initial machine language instruction for execution by the processor in the first execution mode, wherein the one or more alternative machine language instructions, when executed by the processor in the second execution mode, mitigate the one or more risk criteria; and providing the one or more alternative machine language instructions.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A computer implemented method comprising:
 receiving in a computing system having a processor that can operate in a first execution mode and a different second execution mode, a program that has an initial machine language instruction for execution by the processor in the first execution mode, wherein the initial machine language instruction, when executed by the processor in the first execution mode, performs a first operation; 
 determining, by an instruction selector of a plugin configured to execute the program on the processor, that a portion of the initial machine language instruction, when the portion is interpreted by the processor as an instruction in the second execution mode, causes the processor to perform a second operation that is different from the first operation and that satisfies one or more risk criteria; 
 in response, generating, by the instruction selector of the plugin, one or more alternative machine language instructions to replace the initial machine language instruction for execution by the processor in the first execution mode, wherein the one or more alternative machine language instructions, when interpreted by the processor as instructions in the first execution mode, cause the processor to perform a third operation that is similar to the first operation, and wherein the one or more alternative machine language instructions, when interpreted by the processor as one or more instructions in the different second execution mode, cause the processor to perform a fourth operation that is different from the second operation and that does not satisfy the one or more risk criteria of the second operation being performed by the processor when the portion of the initial machine language instruction is interpreted as an instruction in the second execution mode; and 
 replacing, by the instruction selector of the plugin, the initial machine language instruction with the one or more alternative machine language instructions in the program. 
 
     
     
       2. The method of  claim 1 , further comprising:
 receiving an intermediate language instruction, wherein generating the one or more alternative machine language instructions comprises selecting the one or more alternative machine language instructions to correspond to the intermediate language instruction. 
 
     
     
       3. The method of  claim 1 , wherein determining that the portion of the initial machine language instruction satisfies the one or more risk criteria comprises determining that the portion of the machine language instruction when executed by the processor in the second execution mode comprises a branch instruction. 
     
     
       4. The method of  claim 1 , wherein determining that the portion of the initial machine language instruction satisfies the one or more risk criteria comprises determining that the portion of the machine language instruction when executed by the processor in the second execution mode comprises an unsafe load or store instruction. 
     
     
       5. The method of  claim 1 , wherein the initial machine language instruction in the first execution mode is a NOP instruction, and wherein generating the one or more alternative instructions comprises altering the NOP instruction in the first execution mode. 
     
     
       6. The method of  claim 1 , wherein the initial machine language instruction in the first execution mode is a NOP instruction, and wherein generating the one or more alternative machine language instructions comprises generating a sequence of instructions that are equivalent to a NOP instruction in first execution mode. 
     
     
       7. The method of  claim 6 , wherein the sequence of instructions comprises one or more AND instructions. 
     
     
       8. The method of  claim 1 , wherein generating the one or more alternative machine language instructions comprises selecting an instruction that halts execution in the second execution mode. 
     
     
       9. The method of  claim 8 , wherein selecting an instruction that halts execution in the second execution mode comprises selecting a breakpoint instruction in the second execution mode. 
     
     
       10. The method of  claim 8 , wherein selecting an instruction that halts execution in the second execution mode comprises selecting an instruction that writes to an address in non-writeable memory, or an instruction that reads from an address in non-readable memory. 
     
     
       11. The method of  claim 1 , wherein generating the one or more alternative machine language instructions comprises altering a destination address of a branch instruction in the second execution mode. 
     
     
       12. The method of  claim 11 , wherein altering the destination address of a branch instruction in the second execution mode comprises masking the least-significant bits of the destination address. 
     
     
       13. A system comprising:
 one or more computers and one or more storage devices storing instructions that are operable, when executed by the one or more computers, to cause the one or more computers to perform operations comprising: 
 receiving in a processor in the system, the processor having a first execution mode and a different second execution mode, a program that has an initial machine language instruction for execution by the processor in the first execution mode, wherein the initial machine language instruction, when executed by the processor in the first execution mode, performs a first operation; 
 determining, by an instruction selector of a plugin configured to execute the program on the processor, that a portion of the initial machine language instruction, when the portion is interpreted by the processor as an instruction in the second execution mode, causes the processor to perform a second operation that is different from the first operation and that satisfies one or more risk criteria; 
 in response, generating, by the instruction selector of the plugin, one or more alternative machine language instructions to replace the initial machine language instruction for execution by the processor in the first execution mode, wherein the one or more alternative machine language instructions, when interpreted by the processor as instructions in the first execution mode, cause the processor to perform a third operation that is similar to the first operation, and wherein the one or more alternative machine language instructions, when interpreted by the processor as one or more instructions in the different second execution mode, cause the processor to perform a fourth operation that is different from the second operation and that does not satisfy the one or more risk criteria of the second operation being performed by the processor when the portion of the initial machine language instruction is interpreted as an instruction in the second execution mode; and 
 replacing, by the instruction selector of the plugin, the initial machine language instruction with the one or more alternative machine language instructions in the program. 
 
     
     
       14. The system of  claim 13 , wherein the operations further comprise:
 receiving an intermediate language instruction, wherein generating the one or more alternative machine language instructions comprises selecting the one or more alternative machine language instructions to correspond to the intermediate language instruction. 
 
     
     
       15. The system of  claim 13 , wherein determining that the portion of the initial machine language instruction satisfies the one or more risk criteria comprises determining that the portion of the machine language instruction when executed by the processor in the second execution mode comprises a branch instruction. 
     
     
       16. The system of  claim 13 , wherein determining that the portion of the initial machine language instruction satisfies the one or more risk criteria comprises determining that the portion of the machine language instruction when executed by the processor in the second execution mode comprises an unsafe load or store instruction. 
     
     
       17. The system of  claim 13 , wherein generating the one or more alternative machine language instructions comprises selecting an instruction that halts execution in the second execution mode. 
     
     
       18. The system of  claim 13 , wherein generating the one or more alternative machine language instructions comprises altering a destination address of a branch instruction in the second execution mode. 
     
     
       19. A computer program product, encoded on one or more non-transitory computer storage media, comprising instructions that when executed by one or more computers cause the one or more computers to perform operations comprising:
 receiving in a processor having a first execution mode and a different second execution mode, a program that has an initial machine language instruction for execution by the processor in the first execution mode, wherein the initial machine language instruction, when executed by the processor in the first execution mode, performs a first operation; 
 determining, by an instruction selector of a plugin configured to execute the program on the processor, that a portion of the initial machine language instruction, when the portion is interpreted by the processor as an instruction in the second execution mode, causes the processor to perform a second operation that is different from the first operation and that satisfies one or more risk criteria; 
 in response, generating, by the instruction selector of the plugin, one or more alternative machine language instructions to replace the initial machine language instruction for execution by the processor in the first execution mode, wherein the one or more alternative machine language instructions, when interpreted by the processor as instructions in the first execution mode, cause the processor to perform a third operation that is similar to the first operation, and wherein the one or more alternative machine language instructions, when interpreted by the processor as one or more instructions in the different second execution mode, cause the processor to perform a fourth operation that is different from the second operation and that does not satisfy the one or more risk criteria of the second operation being performed by the processor when the portion of the initial machine language instruction is interpreted as an instruction in the second execution mode; and 
 replacing, by the instruction selector of the plugin, the initial machine language instruction with the one or more alternative machine language instructions in the program. 
 
     
     
       20. The computer program product of  claim 19 , wherein the operations further comprise:
 receiving an intermediate language instruction, wherein generating the one or more alternative machine language instructions comprises selecting the one or more alternative machine language instructions to correspond to the intermediate language instruction. 
 
     
     
       21. The computer program product of  claim 19 , wherein determining that the portion of the initial machine language instruction satisfies the one or more risk criteria comprises determining that the portion of the machine language instruction when executed by the processor in the second execution mode comprises a branch instruction. 
     
     
       22. The computer program product of  claim 19 , wherein determining that the portion of the initial machine language instruction satisfies the one or more risk criteria comprises determining that the portion of the machine language instruction when executed by the processor in the second execution mode comprises an unsafe load or store instruction. 
     
     
       23. The computer program product of  claim 19 , wherein generating the one or more alternative machine language instructions comprises selecting an instruction that halts execution in the second execution mode. 
     
     
       24. The computer program product of  claim 19 , wherein generating the one or more alternative machine language instructions comprises altering a destination address of a branch instruction in the second execution mode. 
     
     
       25. The method of  claim 1 ,
 wherein receiving the initial machine language instruction for execution by the processor in the first execution mode comprises receiving the initial machine language instruction by an instruction selector of a web browser plugin having a native code module, and further comprising: 
 providing, by the instruction selector to the native code module, the program having the one or more alternative machine language instructions to be executed natively by the native code module. 
 
     
     
       26. The system of  claim 13 ,
 wherein receiving the initial machine language instruction for execution by the processor in the first execution mode comprises receiving the initial machine language instruction by an instruction selector of a web browser plugin having a native code module, and 
 wherein the operations further comprise providing, by the instruction selector to the native code module, the program having the one or more alternative machine language instructions to be executed natively by the native code module. 
 
     
     
       27. The computer program product of  claim 19 ,
 wherein receiving the initial machine language instruction for execution by the processor in the first execution mode comprises receiving the initial machine language instruction by an instruction selector of a web browser plugin having a native code module, and 
 wherein the operations further comprise providing, by the instruction selector to the native code module, the program having the one or more alternative machine language instructions to be executed natively by the native code module.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.