Xinchuang Application Compatibility Adaptation Method and System Based on Instruction Set Conversion
Through static analysis and dynamic compilation technology, the instruction set-related code in the source code is identified and adapted, and the runtime library compatibility problem is handled through binary analysis tools, which solves the compatibility, performance and security problems of information creation applications in cross-instruction set migration, and achieves efficient and stable application operation and data security.
Patent Information
- Application Number
- CN202510290314.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-12
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2045-03-12
AI Technical Summary
During the cross-instruction set migration process of information creation applications, there are compatibility, performance and security issues, especially source code-level incompatibility and complex conversion processes of binary code.
Static analysis tools and line-by-line analysis technology are used to identify function calls, macro definitions and inline assembly code fragments related to the original instruction set in the source code, build an instruction set mapping table, and recompile the modified source code into a binary file that can be executable by the target instruction set through dynamic compilation technology. At the same time, binary analysis tools are used to deal with the compatibility issues of the runtime library.
It realizes comprehensive adaptation from source code to runtime library, significantly improves the portability and operation efficiency of the application, solves compatibility, performance and security issues, and ensures the stable operation and data security of the information innovation application in the target instruction set environment.
Smart Images

Figure CN119808081B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer compatibility adaptation, and specifically to a Xinchuang application compatibility adaptation method and system based on instruction set conversion. Background Art
[0002] During the process of Xinchuang application compatibility adaptation, for the technical problem of instruction set conversion, the first thing to face is the identification and modification of incompatibility at the source code level. There may be a large number of code segments in the source code of application software that are closely related to the original instruction set, such as function calls, macro definitions, and inline assemblers of specific instruction sets. These code segments cannot run directly in the target Xinchuang instruction set environment. Therefore, it is necessary to analyze them one by one to identify the parts related to the original instruction set. For open-source software, the source code can be directly modified to replace functions, macro definitions, etc. of the original instruction set with implementations adapted to the target instruction set. However, for closed-source software, since the source code cannot be obtained, only a binary translation tool can be used to directly convert the binary code of the original instruction set into the code of the target instruction set. This process is not only complex but may also introduce performance losses and compatibility problems. Summary of the Invention
[0003] The purpose of the present invention is to provide a Xinchuang application compatibility adaptation method and system based on instruction set conversion, which realizes comprehensive adaptation from the source code to the runtime library, solves the compatibility, performance, and security problems of Xinchuang applications during cross-instruction set migration, and significantly improves the portability and running efficiency of applications.
[0004] The purpose of the present invention can be achieved through the following technical solutions:
[0005] The present application provides a Xinchuang application compatibility adaptation method based on instruction set conversion, including the following steps:
[0006] S1. Use a static analysis tool to scan the source code, identify function calls, macro definitions, and inline assembler code segments related to the original instruction set. According to the identification results, analyze the source code line by line to extract the code logic closely related to the original instruction set.
[0007] S2. According to the extracted code logic, construct an instruction set mapping table, map the original instruction set functions to the corresponding function implementations of the target instruction set, and then use dynamic compilation technology to recompile the modified source code into a binary file executable by the target instruction set.
[0008] S3. Use a binary analysis tool to scan the runtime library on which the application depends, identify the library function implementations that are incompatible with the original instruction set. According to the library function identification results, recompile or replace the incompatible library functions to adapt the application and its dependent runtime library to the operating system and hardware environment of the target instruction set.
[0009] S4. Deploy the modified application and runtime library in the test environment, execute functional tests to verify whether the running logic of the application in the target instruction set environment is correct, and determine the correctness status of the application in the target environment.
[0010] S5. After determining the correctness status of the application in the target environment, monitor the execution efficiency of the application in the target instruction set environment to determine whether there is performance loss; then use security testing tools to detect whether there are potential security vulnerabilities in the modified application and runtime library to ensure compliance with the security requirements of the Xinchuang environment.
[0011] Furthermore, use static analysis tools to scan the source code to identify function calls, macro definitions, and inline assembly code fragments related to the original instruction set, specifically including:
[0012] S11. Obtain the source code and input it into the scanner. The scanner traverses the code segment and marks the function body and inline segment.
[0013] S12. The analyzer performs syntax parsing on the marked code segment, and the recognizer extracts function calls and macro definitions.
[0014] S13. The associator matches the identified function calls and macro definitions with the instruction set to determine whether there is an association. When there is an association, add the code fragment to the fragment set.
[0015] S14. Filter the fragment set through preset instruction set rules to obtain the final instruction set-related code fragments, and use machine learning algorithms to classify the fragment set to determine the call patterns of different instruction sets.
[0016] Furthermore, according to the recognition results, analyze the source code line by line to extract the code logic closely related to the original instruction set, specifically including: use line-by-line analysis technology to obtain each line of data in the source code, judge the logical relationship of each line of data, extract the code segment related to the instruction set, perform relevance verification through preset logical chain rules to obtain closely related code logic, use a concise expression method to regenerate a logical description that conforms to the thinking chain, and perform word count matching according to similarity rules to finally generate a business description similar to the original text.
[0017] Furthermore, according to the extracted code logic, construct an instruction set mapping table to map the original instruction set functions to the corresponding function implementations of the target instruction set, specifically including:
[0018] S21. Obtain the function definitions of the original instruction set and the target instruction set, extract the function names and parameter lists, and establish function feature vectors.
[0019] S22. Use clustering algorithms to classify the feature vectors to determine the similarity between functions, and construct a function mapping relationship table according to the similarity results.
[0020] S23. Generate the function implementation code corresponding to the target instruction set through the mapping relation table. When the function cannot be directly mapped, use the adapter pattern for conversion;
[0021] S24. Integrate the converted function code into the target instruction set. After completing the instruction set mapping and conversion, output the final target instruction set code.
[0022] Furthermore, through dynamic compilation technology, recompile the modified source code into a binary file executable by the target instruction set, specifically including:
[0023] Obtain the content of the modified source code, analyze the syntax structure of the source code, and determine the code segments to be compiled;
[0024] Adopt dynamic compilation technology, generate an intermediate code representation form according to the characteristics of the target instruction set, optimize the execution efficiency of the code according to the intermediate code representation form, and extract the key instruction sequences;
[0025] Convert the optimized instruction sequences into the machine code of the target instruction set, generate a binary file format, and then verify the integrity of the binary file and check the compatibility of the instruction set;
[0026] According to different target instruction sets, adjust the compilation parameters, generate multiple versions of binary files, store the generated binary files, record the configuration information during the compilation process, and establish a version management mechanism.
[0027] Furthermore, adopt a binary analysis tool to scan the runtime libraries on which the application depends and identify the library function implementations that are incompatible with the original instruction set, specifically including:
[0028] Obtain the binary file of the target application, scan the file using a binary analysis tool, and extract all the dependent runtime library information;
[0029] According to the extracted runtime library information, judge whether the implementation of each library function is compatible with the target instruction set through a preset instruction set mapping table;
[0030] When the implementation of the library function is incompatible with the target instruction set, mark the library function as an incompatible item and record its specific implementation details;
[0031] Generate a list of incompatible library functions according to the marked incompatible items, including the name, implementation details, and corresponding dependent runtime libraries of each incompatible library function;
[0032] Adopt a machine learning algorithm to analyze the list of incompatible library functions and predict the library functions that need to be modified or replaced and their corresponding modification schemes;
[0033] Optimize the model through a preset instruction set, optimize the predicted modification plan to generate the final library function modification instruction set, and automatically generate the modified runtime library file according to the final library function modification instruction set to complete the implementation of the library function compatible with the original instruction set.
[0034] Further, after automatically generating the modified runtime library file, it further includes:
[0035] Obtain the instruction set information of the target operating system and hardware environment; scan the application and its dependent runtime libraries to identify the call situations of library functions;
[0036] According to the identified library functions, judge their compatibility with the target instruction set again. When the library function is incompatible, obtain the source code of the library function for recompilation;
[0037] When recompilation fails, search for alternative library functions compatible with the target instruction set for replacement, and integrate the recompiled or replaced library functions into the application and its dependent runtime libraries to generate the final runtime library adapted to the target instruction set operating system and hardware environment.
[0038] Further, deploy the modified application and runtime library in the test environment, execute functional tests to verify whether the running logic of the application in the target instruction set environment is correct, specifically including:
[0039] In the pre-established test environment, deploy the application software with code modifications and its dependent runtime libraries, execute the preset functional test cases, obtain the running state data of the application under the target instruction set architecture, analyze the differences between the running state data and the expected results, judge whether the running logic of the application matches the target instruction set environment, determine the correctness status of the application in the target environment. If the running logic of the application does not match the target instruction set environment, obtain the compatibility data of the runtime library, analyze the adaptation degree of the runtime library to the target instruction set, and determine the modification plan of the runtime library.
[0040] Further, monitor the execution efficiency of the application in the target instruction set environment to judge whether there is performance loss; then use security testing tools to detect whether there are potential security vulnerabilities in the modified application and runtime library, specifically including: use performance testing tools to monitor the execution efficiency of the application in the target instruction set environment, obtain performance data, and judge whether there is performance loss through performance data analysis algorithms. When there is performance loss, modify the application using application optimization algorithms.
[0041] Meanwhile, a security testing tool is used to detect the modified application and runtime library, obtain security data, identify potential security vulnerabilities through a security data analysis algorithm, and when there are security vulnerabilities, a security repair algorithm is used to repair the application and runtime library; the repaired application is deployed in the IT application innovation environment, and the performance testing tool and security testing tool are used again for monitoring and detection.
[0042] The present invention provides an IT application innovation application compatibility adaptation system based on instruction set conversion, which is used to implement an IT application innovation application compatibility adaptation method based on instruction set conversion, including:
[0043] An analysis and extraction module uses a static analysis tool to scan the source code, identify function calls, macro definitions, and inline assembly code fragments related to the original instruction set, extracts the code logic closely related to the original instruction set through line-by-line analysis technology, and classifies the code fragments using a machine learning algorithm to generate an adaptation strategy;
[0044] A mapping and conversion module constructs an instruction set mapping table according to the extracted code logic, maps functions, macro definitions, and inline assembly code fragments in the original instruction set to the implementation of the target instruction set; processes complex functions and inline assembly code through the adapter pattern and optimization algorithm to generate code logic compatible with the target instruction set, and outputs an intermediate code representation form;
[0045] A dynamic compilation and optimization module recompiles the modified source code into a binary file executable by the target instruction set, optimizes the execution efficiency of the code through dynamic compilation technology, extracts the key instruction sequence and converts it into the machine code of the target instruction set. At the same time, it supports multi-version compilation and version management;
[0046] An adaptation and verification module uses a binary analysis tool to scan the runtime libraries on which the application depends, identifies the library function implementations incompatible with the original instruction set, automatically generates a modified runtime library file through an instruction set optimization model, and processes the library functions that cannot be automatically adapted in combination with the recompilation or replacement mechanism;
[0047] A testing and security guarantee module deploys the modified application and runtime library in a testing environment, performs functional testing, performance testing, and security testing, evaluates the execution efficiency of the application through a performance monitoring tool, detects potential security vulnerabilities through a security testing tool, and optimizes and repairs when problems are found.
[0048] The beneficial effects of the present invention are:
[0049] Through static analysis tools and line-by-line analysis techniques, the present invention accurately identifies function calls, macro definitions, and inline assembly code fragments related to the original instruction set in the source code, and uses machine learning algorithms to classify these fragments and generate adaptation strategies. It not only efficiently extracts the code logic closely related to the original instruction set, but also converts it into an implementation of the target instruction set through the adapter pattern, solving the compatibility problem of open-source and closed-source software in cross-instruction set migration. At the same time, by generating an adapted business description through logic chain rules and similarity rules, the integrity and consistency of the business logic are ensured, significantly improving the portability and running efficiency of the code in the new environment;
[0050] Use binary analysis tools to scan the runtime libraries on which the application depends, identify and process library functions that are incompatible with the original instruction set, automatically generate modified runtime library files through an instruction set mapping table and an optimization model, and solve the adaptation problems of complex library functions by combining recompilation or replacement mechanisms. Also, optimize the execution efficiency of the code through dynamic compilation technology, extract key instruction sequences and generate machine code for the target instruction set, and support multi-version compilation and version management. This not only ensures the full adaptation of the runtime library to the target instruction set, but also optimizes the program performance, solving the problems of runtime library incompatibility and performance loss, and providing strong support for the stable operation of Xinchuang applications;
[0051] By deploying the modified application and runtime libraries in the test environment, performing functional tests, performance tests, and security tests, comprehensively verifying the running logic, execution efficiency, and security of the application in the target instruction set environment, evaluating the execution efficiency of the application through performance monitoring tools, identifying performance bottlenecks and optimizing them; using security testing tools to detect potential security vulnerabilities and making targeted improvements through repair algorithms; ultimately ensuring that the application meets both performance requirements and security standards in the Xinchuang environment, solving the performance and security risk problems in cross-platform migration, and guaranteeing the efficient and stable operation of Xinchuang applications and data security. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] For better understanding and implementation, the technical solutions of the present application will be described in detail below with reference to the accompanying drawings.
[0053] Figure 1 It is a schematic flowchart of the Xinchuang application compatibility adaptation method based on instruction set conversion provided in Embodiment 1 of the present application;
[0054] Figure 2 It is a schematic flowchart of using a static analysis tool to scan the source code in the Xinchuang application compatibility adaptation method based on instruction set conversion provided in Embodiment 1 of the present application;
[0055] Figure 3 It is a schematic flowchart of constructing an instruction set mapping table in the Xinchuang application compatibility adaptation method based on instruction set conversion provided in Embodiment 1 of the present application;
[0056] Figure 4 This is a schematic structural diagram of the Xinchuang application compatibility adaptation system based on instruction set conversion provided in Embodiment 2 of the present application. Detailed implementation manners
[0057] To further elaborate on the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, exemplary embodiments will be described in detail herein, and the examples are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementation manners described in the following exemplary embodiments do not represent all implementation manners consistent with the present application. On the contrary, they are merely examples of methods and systems consistent with some aspects of the present application as detailed in the appended claims.
[0058] The terms used in the present application are only for the purpose of describing specific embodiments and are not intended to limit the present application. The singular forms "a", "the", and "said" used in the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0059] The following will, in conjunction with the accompanying drawings and preferred embodiments, elaborate in detail on the specific implementation manners, features, and effects of the present invention.
[0060] Embodiment 1
[0061] Please refer to Figures 1 - 3 , this embodiment provides a Xinchuang application compatibility adaptation method based on instruction set conversion, including the following steps:
[0062] S1. Use a static analysis tool to scan the source code, identify function calls, macro definitions, and inline assembly code fragments related to the original instruction set. According to the identification results, analyze the source code line by line and extract the code logic closely related to the original instruction set;
[0063] Further, using a static analysis tool to scan the source code and identify function calls, macro definitions, and inline assembly code fragments related to the original instruction set specifically includes:
[0064] S11. Obtain the source code and input it into the scanner. The scanner traverses the code segment and marks the function body and inline segment;
[0065] S12. The analyzer performs syntax parsing on the marked code segment, and the identifier extracts function calls and macro definitions;
[0066] S13. The associator matches the identified function calls and macro definitions with the instruction set to determine if there is an association. When there is an association, the code snippet is added to the snippet set.
[0067] S14. Filter the snippet set through preset instruction set rules to obtain the final instruction set-related code snippets, and classify the snippet set using machine learning algorithms to determine the call patterns of different instruction sets.
[0068] Specifically, after identifying the code snippets related to the original instruction set, these snippets can be mapped to the implementation of the target instruction set through the adapter pattern. The adapter pattern allows the interface of one class to be converted into another interface expected by the client, enabling classes that could not work together due to incompatible interfaces to cooperate. For example, for the identified inline assembly code snippets, an adapter can be designed to convert them into assembly code supported by the target instruction set, thus achieving the adaptation of the code snippets.
[0069] At the same time, after classifying the code snippets using machine learning algorithms, specific adaptation strategies can be generated according to the classification results. For example, for a certain frequently occurring call pattern, an optimization algorithm (such as the Adam algorithm) can be used to adjust the adaptation strategy to improve the adaptation efficiency. In addition, code optimization suggestions, such as reducing function call overhead and optimizing memory access, can be combined to further improve the performance of the adapted code. It can not only effectively map the identified code snippets to the implementation of the target instruction set but also generate optimized adaptation strategies using the classification results, thus ensuring the integrity and effectiveness of the entire adaptation process.
[0070] Furthermore, according to the recognition results, analyze the source code line by line to extract the code logic closely related to the original instruction set, specifically including: using line-by-line analysis technology to obtain each line of data in the source code, judging the logical relationship of each line of data, extracting the code segments related to the instruction set, performing relevance verification through preset logical chain rules to obtain the closely related code logic, regenerating a logical description that conforms to the thinking chain using a concise expression method, and performing word count matching according to similarity rules, and finally generating a business description similar to the original text.
[0071] Specifically, by analyzing the source code line by line and extracting the code logic closely related to the original instruction set, and generating the adapted business description by combining the logical chain rules and similarity rules, this technology can efficiently identify and convert the parts of the code related to the original instruction set while retaining the integrity and consistency of the business logic. The specific effect is to achieve the precise adaptation of the code from the original instruction set to the target instruction set, solve the problems of poor code compatibility, low adaptation efficiency, and easy loss of business logic during cross-platform migration or instruction set conversion, and significantly improve the running efficiency and maintainability of the code in the new environment.
[0072] S2. According to the extracted code logic, construct an instruction set mapping table, map the original instruction set functions to the corresponding function implementations of the target instruction set, and then, through dynamic compilation technology, recompile the modified source code into a binary file executable by the target instruction set; this process ensures that the code is not only logically compatible with the target instruction set but also can run correctly on the target architecture at the execution level.
[0073] Among them, the role of the instruction set mapping table is to map the functions, macro definitions, and inline assembly code fragments in the original instruction set to the corresponding implementations of the target instruction set. For example, some specific functions in the original instruction set need to be replaced with equivalent functions provided by the target instruction set, or the inline assembly code needs to be rewritten to meet the syntax and architecture requirements of the target instruction set; through this mapping and replacement, the source code is logically adjusted to a form compatible with the target instruction set.
[0074] Furthermore, according to the extracted code logic, construct an instruction set mapping table, map the original instruction set functions to the corresponding function implementations of the target instruction set, specifically including:
[0075] S21. Obtain the function definitions of the original instruction set and the target instruction set, extract the function names and parameter lists, and establish function feature vectors.
[0076] S22. Use a clustering algorithm to classify the feature vectors, determine the similarity between functions, and construct a function mapping relationship table according to the similarity results.
[0077] S23. Through the mapping relationship table, generate the function implementation code corresponding to the target instruction set. When a function cannot be directly mapped, use the adapter pattern for conversion.
[0078] S24. Integrate the converted function code into the target instruction set. After completing the instruction set mapping and conversion, output the final target instruction set code.
[0079] Among them, when encountering complex functions that cannot be directly mapped and cannot be converted through the adapter pattern, manual intervention or heuristic algorithms are used to find alternative solutions, such as by calling low-level system calls provided by the target instruction set or redesigning part of the logic to meet the requirements of the target architecture; at the same time, in order to ensure the correctness and integrity of the generated target instruction set code, a code verification mechanism is introduced, such as unit tests and static code analysis tools, to verify the converted code, and a performance analysis tool is used to evaluate the performance of the target code, optimize possible performance bottlenecks, and ensure that the code is not only logically compatible but also can run efficiently on the target architecture; further improve the process of instruction set mapping and conversion, and improve the reliability and efficiency of adaptation.
[0080] Specifically, by extracting function feature vectors and using clustering algorithms to determine function similarity, a function mapping relationship table can be accurately constructed to ensure that the functions in the original instruction set can be accurately mapped to the equivalent implementations in the target instruction set. Secondly, for functions that cannot be directly mapped, the adapter pattern is used for conversion, solving the adaptation problems of complex function calls and inline assembly code, and ensuring the logical compatibility of the code. Finally, through dynamic compilation technology, the modified source code is recompiled into a binary file of the target instruction set, ensuring that the code is not only logically compatible with the target instruction set but also can run correctly on the target architecture at the execution level; significantly improving the efficiency and accuracy of code adaptation, solving the compatibility problems during cross-instruction set migration, reducing the adaptation cost, and providing technical support for the rapid deployment of Xinchuang applications.
[0081] Among them, Xinchuang applications refer to software applications developed based on the concept of information technology application innovation, aiming to achieve comprehensive domestic substitution from hardware to software through independent and controllable technologies and products. Such applications involve cross-platform and cross-instruction set compatibility adaptation, can run efficiently in different operating systems and hardware environments, and meet the requirements of security, reliability, and performance optimization at the same time; the core goal of Xinchuang applications is to solve the problems of poor compatibility, low adaptation efficiency, and high security risks encountered in the migration and deployment of traditional applications through technological innovation and adaptation optimization, thereby promoting the independent control and sustainable development of the information technology industry.
[0082] Furthermore, through dynamic compilation technology, the modified source code is recompiled into an executable binary file of the target instruction set, specifically including:
[0083] Obtain the content of the modified source code, analyze the syntax structure of the source code, and determine the code segments to be compiled;
[0084] Adopt dynamic compilation technology, generate an intermediate code representation form according to the characteristics of the target instruction set, optimize the execution efficiency of the code according to the intermediate code representation form, and extract the key instruction sequences;
[0085] Convert the optimized instruction sequences into machine code of the target instruction set, generate a binary file format, then verify the integrity of the binary file, check the compatibility of the instruction set, and ensure executability;
[0086] According to different target instruction sets, adjust the compilation parameters, generate multiple versions of binary files, store the generated binary files, record the configuration information during the compilation process, and establish a version management mechanism.
[0087] Specifically, through dynamic compilation technology, efficient compilation and optimization of the modified source code are achieved, generating an executable binary file compatible with the target instruction set. This process not only improves the execution efficiency of the code but also ensures the integrity and executability of the generated file. At the same time, the version management mechanism meets the requirements of multi-platform deployment. It solves the compatibility problems in cross-instruction set compilation, optimizes program performance, simplifies multi-version management, and significantly improves the portability and adaptation efficiency of the code.
[0088] S3. Use a binary analysis tool to scan the runtime libraries on which the application depends, identify the library function implementations that are incompatible with the original instruction set, and according to the library function identification results, recompile or replace the incompatible library functions to make the application and its dependent runtime libraries adapt to the operating system and hardware environment of the target instruction set.
[0089] Furthermore, use a binary analysis tool to scan the runtime libraries on which the application depends and identify the library function implementations that are incompatible with the original instruction set. Specifically, it includes:
[0090] Obtain the binary file of the target application, use a binary analysis tool to scan the file, and extract all the dependent runtime library information.
[0091] According to the extracted runtime library information, through a preset instruction set mapping table, determine whether the implementation of each library function is compatible with the target instruction set.
[0092] When the implementation of a library function is incompatible with the target instruction set, mark the library function as an incompatible item and record its specific implementation details.
[0093] According to the marked incompatible items, generate a list of incompatible library functions, including the name, implementation details, and corresponding dependent runtime libraries of each incompatible library function.
[0094] Use a machine learning algorithm to analyze the list of incompatible library functions and predict the library functions that need to be modified or replaced and their corresponding modification schemes.
[0095] Through a preset instruction set optimization model, optimize the predicted modification scheme to generate the final library function modification instruction set. According to the final library function modification instruction set, automatically generate the modified runtime library file to complete the implementation of the library function compatible with the original instruction set.
[0096] Specifically, generating the modification instruction set and the runtime library file is an automated process based on the instruction set optimization model, aiming to generate the implementation of the library function adapted to the target instruction set.
[0097] Furthermore, after automatically generating the modified runtime library file, it also includes:
[0098] Obtain the instruction set information of the target operating system and hardware environment; scan the application and its dependent runtime libraries to identify the call situations of library functions;
[0099] According to the identified library functions, judge their compatibility with the target instruction set again. When a library function is incompatible, obtain the source code of the library function for recompilation;
[0100] When recompilation is not possible, search for alternative library functions compatible with the target instruction set for replacement, and integrate the recompiled or replaced library functions into the application and its dependent runtime libraries to generate the final runtime library adapted to the target instruction set's operating system and hardware environment.
[0101] Among them, recompiling or replacing incompatible library functions is a supplement to generating modified instruction sets and runtime library files, dealing with situations that cannot be solved by automated modification (such as missing source code or requiring manual replacement). Use the modified runtime library file directly as the input for recompiling or replacing incompatible library functions to ensure the coherence of the entire process, and then output the final target as the adapted runtime library file to ensure that the application and its dependent runtime libraries are fully adapted to the target environment.
[0102] Specifically, through binary analysis tools and dynamic compilation technologies, comprehensive adaptation of the application and its dependent runtime libraries is achieved, solving the problem of incompatible runtime libraries in cross-instruction set environments. Specifically, use binary analysis tools to scan the runtime libraries to accurately identify library functions incompatible with the original instruction set, and use the instruction set mapping table and machine learning algorithms to generate modified instruction sets adapted to the target instruction set. On this basis, dynamic compilation technologies compile the modified runtime library code into binary files of the target instruction set to ensure that the generated runtime library has good compatibility and execution efficiency in the target operating system and hardware environment. In addition, by recompiling or replacing incompatible library functions, complex situations that cannot be solved by automated modification are further handled to ensure that the application and its dependent runtime libraries can seamlessly adapt to the target environment. This process not only improves the adaptation efficiency but also reduces the system operation risks caused by incompatible runtime libraries, providing strong support for the migration and deployment of Xinchuang applications.
[0103] S4. Deploy the modified application and runtime libraries in the test environment, execute functional tests, verify whether the running logic of the application in the target instruction set environment is correct, and determine the correctness status of the application in the target environment;
[0104] Furthermore, deploy the modified application and runtime libraries in the test environment, execute functional tests, verify whether the running logic of the application in the target instruction set environment is correct, specifically including:
[0105] In a pre-established test environment, deploy the application software with code modifications and its dependent runtime libraries, execute the preset functional test cases, obtain the runtime status data of the application under the target instruction set architecture, analyze the differences between the runtime status data and the expected results, determine whether the application's running logic matches the target instruction set environment, determine the correctness status of the application in the target environment. If the application's running logic does not match the target instruction set environment, obtain the compatibility data of the runtime library, analyze the adaptation degree of the runtime library to the target instruction set, and determine the modification plan for the runtime library.
[0106] Specifically, by deploying the modified application and runtime library in the test environment and executing functional tests, a comprehensive verification of the application's running logic in the target instruction set environment is achieved; not only ensures the correctness status of the application in the target environment, but also provides a clear direction for subsequent optimization and adjustment, significantly improving the reliability and efficiency of application adaptation, and providing a strong guarantee for the stable operation of Xinchuang applications.
[0107] S5. After determining the correctness status of the application in the target environment, monitor the execution efficiency of the application in the target instruction set environment to determine whether there is performance loss; then use security testing tools to detect whether there are potential security vulnerabilities in the modified application and runtime library to ensure that it meets the security requirements of the Xinchuang environment.
[0108] Furthermore, monitor the execution efficiency of the application in the target instruction set environment to determine whether there is performance loss; then use security testing tools to detect whether there are potential security vulnerabilities in the modified application and runtime library. Specifically, use performance testing tools to monitor the execution efficiency of the application in the target instruction set environment, obtain performance data, and through performance data analysis algorithms, determine whether there is performance loss. When there is performance loss, use application optimization algorithms to modify the application.
[0109] At the same time, use security testing tools to detect the modified application and runtime library, obtain security data, and through security data analysis algorithms, identify potential security vulnerabilities. When there are security vulnerabilities, use security repair algorithms to repair the application and runtime library; deploy the repaired application in the Xinchuang environment, and use performance testing tools and security testing tools again for monitoring and detection to ensure that it meets the security requirements of the Xinchuang environment.
[0110] Specifically, through performance monitoring and security testing, comprehensively evaluate and optimize the running state of the application in the target instruction set environment. Specifically, use performance testing tools to monitor the execution efficiency of the application, analyze performance data to determine whether there is performance loss, and when problems are found, make targeted improvements through application optimization algorithms; at the same time, use security testing tools to detect potential security vulnerabilities in the application and runtime libraries, identify problems through security data analysis algorithms, and use security repair algorithms to repair them. Finally, redeploy the repaired application and test it again to ensure that it meets both performance requirements and security standards in the Xinchuang environment, thus ensuring the efficient and stable operation of the application and data security.
[0111] Embodiment 2
[0112] Please refer to Figure 3 , this embodiment provides a Xinchuang application compatibility adaptation system based on instruction set conversion, which is used to implement the Xinchuang application compatibility adaptation method based on instruction set conversion, including:
[0113] Analysis and extraction module: Use static analysis tools to scan the source code, identify function calls, macro definitions, and inline assembly code fragments related to the original instruction set, extract the code logic closely related to the original instruction set through line-by-line analysis technology, and classify the code fragments using machine learning algorithms to generate adaptation strategies. This module provides basic data support for subsequent code adaptation.
[0114] Mapping and conversion module: According to the extracted code logic, construct an instruction set mapping table, map functions, macro definitions, and inline assembly code fragments in the original instruction set to the implementation of the target instruction set; process complex functions and inline assembly code through the adapter pattern and optimization algorithms to generate code logic compatible with the target instruction set, and output the intermediate code representation form;
[0115] Dynamic compilation and optimization module: Recompile the modified source code into a binary file executable by the target instruction set, optimize the execution efficiency of the code through dynamic compilation technology, extract the key instruction sequence and convert it into the machine code of the target instruction set. At the same time, support multi-version compilation and version management to ensure that the generated binary file runs efficiently on the target architecture;
[0116] Adaptation and verification module: Use binary analysis tools to scan the runtime libraries on which the application depends, identify library function implementations that are incompatible with the original instruction set, automatically generate modified runtime library files through the instruction set optimization model, and combine recompilation or replacement mechanisms to process library functions that cannot be automatically adapted to ensure that the runtime libraries are fully adapted to the operating system and hardware environment of the target instruction set;
[0117] The test and security guarantee module deploys the modified application and runtime library in the test environment, executes functional tests, performance tests, and security tests, evaluates the execution efficiency of the application through a performance monitoring tool, detects potential security vulnerabilities through a security test tool, and optimizes and repairs problems when they are discovered. Finally, it ensures that the application meets both the performance requirements and the security standards of the Xinchuang environment in the target environment.
[0118] The above are only the preferred embodiments of the present invention, and do not impose any form of limitation on the present invention. Although the present invention has been disclosed above with the preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art can make some changes or modifications to the equivalent embodiments of equivalent changes within the scope of the technical solution of the present invention. However, as long as the content of the technical solution of the present invention is not departed from, any brief modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention still fall within the scope of the technical solution of the present invention.
Claims
1. A method for adapting the compatible application of a trusted computing platform based on instruction set conversion, characterized in that: The steps include: Use static analysis tools to scan source code, identify function calls, macro definitions, and inline assembly code snippets related to the original instruction set, and analyze the source code line by line based on the identification results to extract code logic closely related to the original instruction set; According to the extracted code logic, an instruction set mapping table is constructed to map the original instruction set function to the function implementation corresponding to the target instruction set. Then, through dynamic compilation technology, the modified source code is recompiled into a binary file executable by the target instruction set. Among them, according to the extracted code logic, an instruction set mapping table is constructed to map the original instruction set function to the function implementation corresponding to the target instruction set, specifically including: Obtain the function definitions of the original instruction set and the target instruction set, extract the function name and parameter list, and establish the function feature vector; A clustering algorithm is used to classify feature vectors, determine the similarity between functions, and build a function mapping relationship table based on the similarity results; Generate the function implementation code corresponding to the target instruction set through the mapping relationship table. When the function cannot be directly mapped, the adapter mode is used for conversion. Integrate the converted function code into the target instruction set, complete the instruction set mapping and conversion, and output the final target instruction set code; Use binary analysis tools to scan the runtime libraries that the application depends on, identify library function implementations that are incompatible with the original instruction set, and recompile or replace incompatible library functions based on the library function identification results to make the application and its dependent runtime libraries compatible with the operating system and hardware environment of the target instruction set; Deploy the modified application and runtime library in the test environment, perform functional testing, verify whether the application's operating logic in the target instruction set environment is correct, and determine the correctness status of the application in the target environment; After determining the correctness status of the application in the target environment, monitor the execution efficiency of the application in the target instruction set environment to determine whether there is performance loss; then use security testing tools to detect whether the modified application and runtime library have potential security vulnerabilities to ensure that they meet the security requirements of the trusted innovation environment.
2. According to the method for compatible adaptation of trusted innovation applications based on instruction set conversion according to claim 1, it is characterized in that: Use static analysis tools to scan the source code and identify function calls, macro definitions, and inline assembly code snippets related to the original instruction set, including: The source code is obtained and fed into a scanner, which traverses the code segments and marks function bodies and inline segments; The analyzer performs syntax analysis on the marked code segments, and the recognizer extracts function calls and macro definitions; The associator matches the identified function calls and macro definitions with the instruction set to determine whether there is an association. If there is an association, the code snippet is added to the snippet set. The snippet set is filtered through the preset instruction set rules to obtain the final instruction set related code snippets. The snippet set is classified by machine learning algorithm to determine the calling modes of different instruction sets.
3. According to the method for compatible adaptation of trusted computing applications based on instruction set conversion according to claim 1, it is characterized in that: According to the recognition results, the source code is analyzed line by line to extract the code logic closely related to the original instruction set, including: using line-by-line analysis technology to obtain each line of data in the source code, judging the logical relationship of each line of data, extracting the code segments related to the instruction set, verifying the association through preset logical chain rules, obtaining closely related code logic, using concise expressions to regenerate logical descriptions that conform to the thinking chain, matching the number of words according to similarity rules, and finally generating a business description similar to the original text.
4. According to claim 1, the method for compatible adaptation of trusted computing applications based on instruction set conversion is characterized in that: The modified source code is recompiled into a binary file executable by the target instruction set through dynamic compilation technology, including: Obtain the modified source code content, analyze the grammatical structure of the source code, and determine the code fragments that need to be compiled; Dynamic compilation technology is used to generate intermediate code representations according to the characteristics of the target instruction set. Based on the intermediate code representations, the execution efficiency of the code is optimized and key instruction sequences are extracted. Convert the optimized instruction sequence into the machine code of the target instruction set, generate a binary file format, verify the integrity of the binary file, and check the compatibility of the instruction set; According to different target instruction sets, the compilation parameters are adjusted to generate multiple versions of binary files, store the generated binary files, record the configuration information during the compilation process, and establish a version management mechanism.
5. According to the method for compatible adaptation of trusted innovation applications based on instruction set conversion according to claim 1, it is characterized in that: Use binary analysis tools to scan the runtime libraries that the application depends on and identify library function implementations that are incompatible with the original instruction set, including: Get the binary file of the target application, scan the file using a binary analysis tool, and extract all dependent runtime library information; According to the extracted runtime library information, through the preset instruction set mapping table, it is determined whether the implementation of each library function is compatible with the target instruction set; When the implementation of a library function is incompatible with the target instruction set, mark the library function as an incompatible item and record its specific implementation details; Generate an incompatible library function list based on the marked incompatible items, including the name, implementation details and corresponding dependent runtime library of each incompatible library function; Use machine learning algorithms to analyze the list of incompatible library functions, predict library functions that need to be modified or replaced, and their corresponding modification plans; Through the preset instruction set optimization model, the predicted modification plan is optimized to generate the final library function modification instruction set. According to the final library function modification instruction set, the modified runtime library file is automatically generated to complete the library function implementation compatible with the original instruction set.
6. According to claim 5, the method for compatible adaptation of trusted innovation applications based on instruction set conversion is characterized in that: After automatically generating the modified runtime library files, it also includes: Obtain instruction set information of the target operating system and hardware environment; scan the application and its dependent runtime libraries, and identify the calling status of library functions; Based on the identified library function, its compatibility with the target instruction set is judged again. If the library function is incompatible, the source code of the library function is obtained and recompiled; When recompilation is not possible, an alternative library function compatible with the target instruction set is searched for replacement, and the recompiled or replaced library function is integrated into the application and its dependent runtime library to generate a final runtime library that is adapted to the operating system and hardware environment of the target instruction set.
7. According to claim 1, the method for compatible adaptation of trusted computing applications based on instruction set conversion is characterized in that: Deploy the modified application and runtime library in the test environment and perform functional testing to verify whether the application's operating logic is correct in the target instruction set environment, including: In a pre-established test environment, deploy the code-modified application software and its dependent runtime libraries, execute preset functional test cases, obtain the application's running status data under the target instruction set architecture, analyze the difference between the running status data and the expected results, determine whether the application's running logic matches the target instruction set environment, and determine the correctness status of the application in the target environment. If the application's running logic does not match the target instruction set environment, obtain the compatibility data of the runtime library, analyze the degree of adaptation of the runtime library to the target instruction set, and determine the modification plan for the runtime library.
8. According to claim 1, the method for compatible adaptation of trusted computing applications based on instruction set conversion is characterized in that: Monitor the execution efficiency of the application in the target instruction set environment to determine whether there is performance loss; Then, security testing tools are used to detect whether the modified applications and runtime libraries have potential security vulnerabilities, including: using performance testing tools to monitor the application execution efficiency in the target instruction set environment, obtaining performance data, and using performance data analysis algorithms to determine whether there is performance loss. If there is performance loss, the application optimization algorithm is used to modify the application; At the same time, security testing tools are used to detect the modified applications and runtime libraries, obtain security data, and identify potential security vulnerabilities through security data analysis algorithms. When security vulnerabilities exist, security repair algorithms are used to repair the applications and runtime libraries. The repaired applications are deployed in the trusted computing environment, and performance testing tools and security testing tools are used again to monitor and detect them.
9. A system for informatization application compatibility adaptation based on instruction set conversion, used to implement the informatization application compatibility adaptation method based on instruction set conversion as described in any one of claims 1 to 8, characterized in that: The analysis and extraction module uses static analysis tools to scan source code, identify function calls, macro definitions, and inline assembly code snippets related to the original instruction set, extracts code logic closely related to the original instruction set through line-by-line analysis technology, and uses machine learning algorithms to classify code snippets and generate adaptation strategies; The mapping and conversion module builds an instruction set mapping table based on the extracted code logic, maps the functions, macro definitions and inline assembly code snippets in the original instruction set to the implementation of the target instruction set; processes complex functions and inline assembly codes through adapter patterns and optimization algorithms, generates code logic compatible with the target instruction set, and outputs an intermediate code representation; Dynamic compilation and optimization module recompiles the modified source code into a binary file executable by the target instruction set, optimizes the execution efficiency of the code through dynamic compilation technology, extracts key instruction sequences and converts them into machine code of the target instruction set, and supports multi-version compilation and version management; The adaptation and verification module uses binary analysis tools to scan the runtime library that the application depends on, identifies the library function implementation that is incompatible with the original instruction set, automatically generates the modified runtime library file through the instruction set optimization model, and combines the recompilation or replacement mechanism to handle the library functions that cannot be automatically adapted; The testing and security assurance module deploys modified applications and runtime libraries in the test environment, performs functional testing, performance testing, and security testing, evaluates the execution efficiency of the application through performance monitoring tools, detects potential security vulnerabilities through security testing tools, and optimizes and repairs problems when they are found.
Citation Information
Patent Citations
Source code credential migration system and method
CN116450213A
Instruction conversion method of cross-chip platform
CN119292671A