二进制翻译中自修改代码的缓存策略研究

上传人:jiups****uk12 文档编号:43545644 上传时间:2018-06-06 格式:PDF 页数:67 大小:412.46KB
返回 下载 相关 举报
二进制翻译中自修改代码的缓存策略研究_第1页
第1页 / 共67页
二进制翻译中自修改代码的缓存策略研究_第2页
第2页 / 共67页
二进制翻译中自修改代码的缓存策略研究_第3页
第3页 / 共67页
二进制翻译中自修改代码的缓存策略研究_第4页
第4页 / 共67页
二进制翻译中自修改代码的缓存策略研究_第5页
第5页 / 共67页
点击查看更多>>
资源描述

《二进制翻译中自修改代码的缓存策略研究》由会员分享,可在线阅读,更多相关《二进制翻译中自修改代码的缓存策略研究(67页珍藏版)》请在金锄头文库上搜索。

1、华中科技大学硕士学位论文二进制翻译中自修改代码的缓存策略研究姓名:刘安战申请学位级别:硕士专业:计算机软件与理论指导教师:羌卫中20080607华 中 科 技 大 学 硕 士 学 位 论 文 I 摘 要 自修改代码是二进制翻译研究中的难点和影响翻译效率的重要因素。众多文献介绍了自修改代码对二进制翻译效率的影响,但均缺乏量化分析;自修改代码具有在程序执行过程中动态地改变程序自身执行指令的特点,在计算机安全领域有广泛的应用。在自修改代码频繁出现时,二进制翻译器中如何设计和实现高效的代码缓存策略是加速二进制翻译效率值得研究的问题。 针对上述问题,利用 QEMU 作为实验平台,对自修改代码和非自修改代

2、码进行了大量的测试,量化地分析了自修改代码对翻译器的翻译效率和翻译块数量的影响。在量化分析了自修改代码对翻译效率影响的基础上,结合翻译器以基本块和 Trace翻译的优点,精确的自修改代码缓存策略 PSCM(Precise Self- modifying Code cache Management policy)在以 Trace 为翻译机制的前提下,通过基本块的精确替换方式,替换由于自修改造成的代码缓存中不一致的翻译块。PSCM 通过页块映射把发生自修代码的物理页映射到具体的基本翻译块, 通过 Trace 的定位确定基本翻译块对应的Trace,通过代码缓存管理维护代码缓存中的基本翻译块和 Tra

3、ce 链,通过精确的块替换方法替换由于自修改代码造成的代码缓存中失效的基本翻译块。 研究结果表明,在 QEMU 翻译器上,自修改代码随着自修改同比次数增长,其执行时间的增加速度平均是非自修改程序的 5.81 倍。平均每增加 1 次自修改,对应在 QEMU 上的翻译块数量增加 10.51。 翻译器以 Trace 为翻译机制的效率较基本块有明显优势。对于 PSCM 的测试表明,在代码缓存(Code cache)中的翻译块的数量 (Flush Blocks counts,FB)为 11 时,PSCM 策略加速因子为 3.95;PSCM 策略加速因子随着 FB 的增加而增加,数据说明利用 PSCM 策

4、略能够改进翻译器在自修改代码翻译的效率。 关键词:二进制翻译,自修改代码,代码缓存,自修改翻译策略,自修改缓存策略 华 中 科 技 大 学 硕 士 学 位 论 文 II Abstract In binary translation, self- modifying code is a difficult issue and factor that influences the translation efficiency. Many papers introduce the influence of Self- modifying code on binary translator, but

5、there are no quantitative research discovered. Self- modifying code has the characteristics that it can dynamically modify and yield the code of the program during running time. And self- modifying code has abroad application in the field of computer secutity. There is a great valueable issue to acc

6、elerate the translation efficiency through design and relize great efficiency policy of code cache in binary translator, when self- modifying code occurs frequently. To address the issues above, using QEMU as the experimentation platform, this thesis carries on massive tests about the self- modifyin

7、g and non- self- modifying code, thoroughly analyses translation time efficiency and the translation block number which is influenced by the self- modifying code. Bases on quantitative research of Self- modifying code s influence on the translation efficiency, and combines the advantages of basic bl

8、ock and trace translation mechanism, to accelerate self- modifying code translation, the thesis provides a code cache policy named PSCM, and realizes fundamental PSCM prototype system. PSCM uses trace as the translation mechanism. Through precise- block replace, replaces the disaccorded block in cod

9、e cache. Through mapping, relates the modified page and basic translation block. Through locating, finds the trace that a block belongs to. Through code cache management maintains the trace information and translation block in code cache. From the research, the speed about procedure execution time i

10、ncreasing with numbers of self- modifying when self- modifying code is executed on QEMU is 5.81 times of the speed when non- self- modifying code is executed on QEMU; Each time there is one more time of self- modifying, the translation block averagely increases 10.51 blocks; Trace mechanism has more

11、 distinct advantage than basic block in translator. The test result of PSCM prototype indicates, when the FB (numbers of translated blocks in Code cache) is 11, the tactics acceleration ratio of PSCM is 3.95; PSCM tactics acceleration ratio increases with the increasement of FB, which means the adva

12、ntage of PSCM appears more obvious when FB is big. PSCM can be used to improve translation efficiency for self- modifying code. Key words: Binary translation,Self- Modifying Code, Code cache Management, Self- Modifying Code Translation policy,Self- Modifying Code cache policy 独创性声明 本人声明所呈交的学位论文是我个人在

13、导师指导下进行的研究工作及取得的研究成果。尽我所知,除文中已经标明引用的内容外,本论文不包含任何其他个人或集体已经发表或撰写过的研究成果。对本文的研究做出贡献的个人和集体,均已在文中以明确方式标明。本人完全意识到,本声明的法律结果由本人承担。 学位论文作者签名: 日期: 年 月 日 学位论文版权使用授权书 本学位论文作者完全了解学校有关保留、使用学位论文的规定,即:学校有权保留并向国家有关部门或机构送交论文的复印件和电子版,允许论文被查阅和借阅。本人授权华中科技大学可以将本学位论文的全部或部分内容编入有关数据库进行检索,可以采用影印、缩印或扫描等复制手段保存和汇编本学位论文。 保密 ,在_年解

14、密后适用本授权书。 不保密。 (请在以上方框内打“” ) 学位论文作者签名: 指导教师签名: 日期: 年 月 日 日期: 年 月 日 本论文属于 华 中 科 技 大 学 硕 士 学 位 论 文 1 1 绪 论 本章首先介绍了课题背景,然后对二进制翻译进行了概述,包括二进制翻译的概念、意义、分类及特点、历史上的系统,并分别对解释执行、静态翻译和动态翻译进行了介绍,接着本章介绍了二进制翻译的研究热点,介绍了二进制翻译中的自修改代码问题,最后是本文的研究内容和文章的组织。 1.1 课题背景 随着计算系统的资源规模不断扩展、处理能力快速增强、资源种类日益丰富、应用需求灵活多样,新型的计算机理与模式已成

15、为未来信息技术领域面临的重大挑战。计算系统虚拟化作为一种新型计算模式推动科技发展和社会进步,已成为国际竞争的焦点和制高点。因此不同平台之间的软件移植成为一个研究的热点,不仅对软件重用有重大意义,而且对于开阔处理器研发的思路,促进新处理器创新也有现实的意义。 为使得源指令集体系(Instruction Set Architecture,ISA)的目标代码在新的指令集体系结构中执行,有以下三种方法选择1: 1. 在新处理器上提供一种特殊模式执行代码仿真,如 Intel 的安腾处理器存在专门执行 x86 代码的硬件2; 2. 重新编译程序,成为新处理器的二进制代码; 3. 用软件的方法解释或翻译应用

16、程序。 其中第三种方法,称为二进制翻译技术(Binary Translation) 。它是一种直接翻译可执行二进制程序的技术,能够把一种机器上的二进制程序翻译到另外一种机器上3,有助于打破 ISA和其软件基础之间形成的扼制创新的局面,打破 CPU 设计改革的瓶颈,使开发新 ISA 机器变得可行,同时也使得一种机器上的二进制程序能够很容易地移植到另一种机器上,扩大了硬件/软件的适用范围。 本课题受国家 973 计划项目“计算系统虚拟化基础理论与方法研究 ”(No.2007CB310900)支持,属于子课题“体系结构虚拟化研究” 。本课题关于虚拟化动态二进制翻译方法研究,包括支持跨体系结构的虚拟化计算系统的动态二进制翻译方法和支持高效的虚拟化计算系统的动态优化方法的研究。 华 中 科 技 大 学 硕 士 学 位 论 文 2 自修改代码(Self- modifying Code

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号