Method, apparatus, and electronic device for executing code in read-only memory.
Patent Information
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- XG TECHNOLOGIES PTE LTD
- Filing Date
- 2026-03-17
- Publication Date
- 2026-06-09
AI Technical Summary
【0010】 本開示の実施例の技術的解決手段は、第1メモリからパッチデータを読み取り、パッチデータを解析して、パッチコードデータを取得する。パッチコードデータから、第2メモリ内のターゲットコードでのパッチ関数の位置を指示するための、少なくとも1つのパッチ関数に対応する第1アドレスを取得し、これにより、本開示の実施例の解決手段は、第1パッチコードの本体を第2メモリに記憶し、第1メモリには、パッチ関数の第1パッチコード自体でない、パッチ関数に対応する第1アドレスを記憶するため、第1メモリの容量ボトルネックを大幅に緩和し、第1メモリの容量が小さいことにより、修復可能なデータ量が少ないという問題を回避することができる。第1アドレスに対応するパッチ関数の第1パッチコードを実行し、パッチ実行時に、第1メモリから大量の命令をロードする必要がなく、直接第2メモリに固定化されたパッチ関数にジャンプするため、実行速度を向上させることができる。パッチ関数は、第2メモリのターゲットコード内に存在し、予め設定された機能修復関数であることもでき、機能拡張関数であることもできるため、設計の柔軟性が高く、パッチ関数は、単純な命令修復機能に限定されず、大規模なターゲットコードの修復又は機能拡張に対するニーズを満たすことができる。
Smart Images

Figure 2026094464000001_ABST
Abstract
Claims
1. A code execution method for read-only memory, wherein each step is executed by a code execution device for read-only memory, Steps include reading patch data from the first memory, The steps include: analyzing the aforementioned patch data to obtain patch code data, The steps include obtaining a first address corresponding to at least one patch function from the aforementioned patch code data, The step includes executing a first patch code of the patch function corresponding to the first address, The first address indicates the position of the patch function in the target code, The aforementioned target code is stored in the second memory. A method for executing code in read-only memory, characterized by the features described above.
2. The code execution method for the read-only memory includes the step of obtaining a first address corresponding to at least one patch function from the patch code data, The step further includes obtaining a second address from the patch code data that corresponds to at least one patch function, wherein the second address indicates the position of a first instruction code in the target code, and the first instruction code triggers the execution of the first patch code of the patch function. The step of executing the first patch code of the patch function corresponding to the first address is: The step of executing the aforementioned target code, The step of jumping to a patch function corresponding to the first address and executing the first patch code of the patch function in response to the execution of the first instruction code in the target code, is included. The method for executing code in a read-only memory according to feature 1.
3. The code execution method for the read-only memory includes the step of obtaining a first address corresponding to at least one patch function from the patch code data, The process further includes obtaining a third address from the patch code data that corresponds to at least one patch function, wherein the third address indicates the position in the target code of the code to continue executing once the execution of the first patch code of the patch function is complete. The code execution method for the read-only memory includes, after the step of executing the first patch code of the patch function corresponding to the first address, If the execution of the first patch code is completed, the process further includes the step of executing the code corresponding to the third address. The method for executing code in a read-only memory according to feature 1.
4. The step of reading patch data from the first memory is: The process includes the step of reading the patch data from the first memory and storing it in the third memory, the third memory being for temporarily storing the patch data. The step of analyzing the aforementioned patch data to obtain patch code data is: The steps include reading the patch data from the third memory, The step of analyzing the patch data to obtain the patch code data is included. The method for executing code in a read-only memory according to feature 1.
5. The step of obtaining a first address corresponding to at least one patch function from the aforementioned patch code data is: The steps include determining whether the patch code data corresponding to the patch data contains a first address corresponding to at least one patch function, based on the flag bits of the patch data, If the patch code data includes a first address corresponding to at least one patch function, the method includes the step of obtaining the first address corresponding to at least one patch function from the patch code data. The method for executing code in a read-only memory according to feature 1.
6. The code execution method for the read-only memory involves, after determining whether the patch code data corresponding to the patch data contains a first address corresponding to at least one patch function, based on the flag bits of the patch data, If the patch code data does not contain a first address corresponding to any patch function, and the patch code data contains at least one second patch code, the step of obtaining the at least one second patch code and a fourth address corresponding to the second patch code from the patch code data, The step of executing the aforementioned target code, The method further includes the step of jumping to the second patch code and executing the second patch code in response to the execution of the second instruction code in the target code, The fourth address indicates the position of the second instruction code in the target code, The second instruction code triggers the execution of the second patch code. The method for executing code in a read-only memory according to feature 5.
7. The code execution method for the read-only memory involves, after obtaining the at least one second patch code and the fourth address corresponding to the second patch code from the patch code data, The step further includes obtaining a fifth address from the patch code data that corresponds to at least one second patch code, the fifth address indicating the position in the target code of the code to continue executing once the execution of the second patch code is complete. The code execution method for the read-only memory includes, after the step of executing the second patch code, If the execution of the second patch code is completed, the process further includes the step of executing the code corresponding to the fifth address. The method for executing code in a read-only memory according to feature 6.
8. A patch data reading module for reading patch data from the first memory, A patch data analysis module for analyzing the aforementioned patch data and obtaining patch code data, A first address acquisition module for obtaining a first address corresponding to at least one patch function from the aforementioned patch code data, Includes a first patch code execution module for executing the first patch code of the patch function corresponding to the first address, The first address indicates the position of the patch function in the target code, The aforementioned target code is stored in the second memory. A code execution device for read-only memory, characterized by the following features.
9. A computer-readable storage medium, When executed by a processor, the processor stores computer program instructions that cause it to execute the code execution method for read-only memory described in any one of claims 1 to 7. A computer-readable storage medium characterized by the following features.
10. An electronic device comprising one or more processors and memory in which computer program instructions are stored, When the computer program instruction is executed by the processor, the processor is instructed to execute the code execution method for read-only memory described in any one of claims 1 to 7. An electronic device characterized by the following features.