使用静态重新编译仿真的自修改代码有什么问题?
What is wrong with self-modifying codes with static-recompilation emulations?
我正在寻找编写模拟器及其技术的方法。但是下面的段落让我想知道,如果你写一个自修改代码来模拟静态重新编译,我想我无法弄清楚哪种情况会出现。
In this technique, you take a program written in the emulated code and attempt to translate it into the assembly code of your computer. The result will be a usual executable file which you can run on your computer without any special tools. While static recompilation sounds very nice, it is not always possible. For example, you cannot statically recompile self-modifying code as there is no way to tell what it will become without running it. To avoid such situations, you may try combining static recompiler with an interpreter or a dynamic recompiler.
这是我正在阅读的内容,这一行让我想知道:
For example, you cannot statically recompile self-modifying code as there is no way to tell what it will become without running it
一个很好的解释和例子将很有启发性,谢谢。
编辑:顺便说一下,我知道自修改的意思,我只是想知道静态重编译后会出现什么问题,哪里会出问题,什么东西会使我们的自修改代码崩溃。
自修改代码严重依赖原始CPU的指令集编码。例如,它可以翻转特定内存位置中的某些位,将一条指令转换为另一条指令。使用静态重新编译,翻转那些相同的位将产生完全不同的效果,因为指令的编码对于主机来说完全不同 CPU.
我正在寻找编写模拟器及其技术的方法。但是下面的段落让我想知道,如果你写一个自修改代码来模拟静态重新编译,我想我无法弄清楚哪种情况会出现。
In this technique, you take a program written in the emulated code and attempt to translate it into the assembly code of your computer. The result will be a usual executable file which you can run on your computer without any special tools. While static recompilation sounds very nice, it is not always possible. For example, you cannot statically recompile self-modifying code as there is no way to tell what it will become without running it. To avoid such situations, you may try combining static recompiler with an interpreter or a dynamic recompiler.
这是我正在阅读的内容,这一行让我想知道:
For example, you cannot statically recompile self-modifying code as there is no way to tell what it will become without running it
一个很好的解释和例子将很有启发性,谢谢。
编辑:顺便说一下,我知道自修改的意思,我只是想知道静态重编译后会出现什么问题,哪里会出问题,什么东西会使我们的自修改代码崩溃。
自修改代码严重依赖原始CPU的指令集编码。例如,它可以翻转特定内存位置中的某些位,将一条指令转换为另一条指令。使用静态重新编译,翻转那些相同的位将产生完全不同的效果,因为指令的编码对于主机来说完全不同 CPU.