TCG动态二进制翻译技术研究

合集下载

基于动态二进制翻译技术的仿真器研究

基于动态二进制翻译技术的仿真器研究

中 分 号 P15 圈 类 t 3 ・ T 14
基 于动 态二进制翻译技 术 的仿 真 器研 究
陈 乔 ,蒋烈辉 ,董卫宇 ,徐金龙 ,方 明
( 军信 息工程大学信息工程学院 ,郑州 400) 解放 502 摘 要 :以动态 二进 制仿真器 Q MU 为平台 ,分析 动态二进制翻译技术在仿真器开 发中的应 用 ,研究 Q MU 的翻译机制 、优化策 略、关 E E
DOI 1.9 9 .s.0 03 2 .0 2 .9 : 03 6 0i n10 —4 82 1.00 4 s 1
1 概述
计算 机发 展 的历程 是软硬 件相 互矛 盾、相 互统 一 的过
进制翻译模 块 ,从而明显地提 高了仿真速度 。
3 动态二进剖翻译器 Q MU E
Q MU是一套多源多 目的开源跨平台翻译器 。Q MU有 E E 2种主要运行模 式 :进 程模式和系统模式 J 系统模式中 。在 Q MU 能仿真整 个硬件 系统 ,包 括中央处 理器 及其他 周边 E
[ sr c]Us gte y a cbn r asao MU s sac lt r ,hs a e nlz s e y a c iayt n lintcn lg sd Abta t i n mi iayt nltr n hd r QE a r erhpa o tipp r a e nmi n r asa o h ooyu e ae fm a y t d h b r t e
和关键技术 。
31 Q MU 系统 的基 本结构 . E 系统 由控制核 心、解释器、翻译器和翻译缓存等组成 。 控制器负责整个翻译过程 的调度 ,解释器负责完成指令 的匹 配工作 ,翻译器主要完成源二进制指令流到 中间指令和 中间 指令到 目标二进制指令流 的转换 ,最后翻译缓存负责存放翻 译后 的基本块 。在运行 时,控制核心会维护一个软件 的 目标 机虚拟 C U状态 , P 称为 e v n ,它包括通 用寄 存器 、段寄存器 、 标志位寄存器等。 目标机 的所有资源都通过 e v基址加上特 n

二进制翻译技术

二进制翻译技术

3 有代表性的二进制翻译系统
目前,二进制翻译已经得到了广泛的重视和研究,一些有代表性的系统见表 2。 表 2 所列出的多数翻译器都与机器特性高度相关,重利用是非常困难的。其中 1994 年 AT&T 公 司开发的 Flashport 二进制翻译器可以运用到多个源、目标平台,但不能完全自动化,需要专 业用户通过图形用户界面(GUI)进行交互。昆士兰(Queensland)大学开发的 UQBT 以及 UQDBT,
代码翻译
MPE XL)
Mimic
IBM
(1987)
[6] 对每条源机器指令代码扩 IBM system /370 IBM RT PC 展倍数为 4 的软件模拟器
Accelera- Tandem tor (1991)
[7] 将 CISC 移植到 RISC 的静 态翻译器,采用解释器作 为补充
TNS CISC
动态翻译
FX!32 UQBT
JVMs JITs BOA Aries
图 1 二进制翻译的三种方法
解释执行对源处理器代码中的每条指令实时解释执行,系统不保存也不缓存解释过的指令,不 需要用户干涉,也不进行任何优化。解释器相对容易开发,比较容易与老的体系结构高度兼容, 但代码执行效率很差[1] 。 [14]
Alpha 的混合模拟器和二
NT)
NT)
进制翻译器
Daisy (1996)
IBM [9] [10] 利用二进制翻译调度
(PowerPC,
PowerPC 代码到超长指令
UnixV)
字(VLIW)处理器,增加并
行性
பைடு நூலகம்
VLIW
Aries
HP
[4] 解释和动态翻译相结合, HP Precision

动态二进制分析技术概述说明书

动态二进制分析技术概述说明书

Dynamic Binary Instrumentation TechnologyOverviewKunping DuNational Digital Switching System Engineering & Technological Research CenterZhengzhou,China**************Hui ShuNational Digital Switching System Engineering & Technological Research CenterZhengzhou,China*****************************Fei KangNational Digital Switching System Engineering & Technological Research CenterZhengzhou,China**************Li DaiNational Digital Switching System Engineering & Technological Research CenterZhengzhou,China**************Abstract—The Dynamic Binary Analysis technology is a newly emerged technology which can analysis program execution dynamicly. Using this technology, the process of program analysis became more simple and accurate. Foreign researchers had put forward several Dynamic Binary Analysis Platform in recent 10 years. Based on these platforms, users can easily build useful analysis tools which satisfy their own needs. This paper introduces five most representative Dynamic Binary Analysis platforms first. Then, four significant fields and existing applications closely related with Dynamic Binary Analysis technology are explored. In the end of this paper, the feature research hot spots are discussed.Keywords- Dynamic Binary Analysis, program analysis technology, Dynamic Binary InstrumentI.FOREWORDDynamic Binary Analysis[1](DBA) technology is a kind of dynamic program analysis method which can analyze program's memory structure and add specific instructions for monitoring and testing program's execution.The DBA technology enables users to monitor program's behavior under the premise of not affecting the results of program execution by inserting additional appropriate analysis code into the target program, this procedure called Dynamic Binary Instrument(DBI).In addition,using DBA technology,the analysis can complete without source code, no need to recompile and link,so that this technology can be used in many cases.The research on DBA technology began in the 1990s, initially applied to the dynamic optimization and testing of the program.Due to its versatility and accuracy of the analysis process,it has been used for memory testing,software behavior monitoring,reverse engineering and some other research areas recently..This paper first introduces five most widely used DBA platform,they are Shade, DynamoRIO, Valgrind, Pin and Nirvana. On this basis, summarizes the application status and popular tools build on DBA platform in the field of memory testing and optimization, data flow tracking, software behavior analysis, reverse engineering and parallel program analysis. Finally, the application prospects of DBA technology are discussed.II.D YNAMIC B INARY A NALYSIS P LATFORM So far, the foreign researchers had put forward a number of DBA platform, such as Shade, DynamoRIO, Valgrind etc. Based on these platforms, users can easily develop their own Dynamic Binary Instrumentation(DBI) tool. Below, we will detail the Shade, DynamoRIO, Valgrind, Pin, and Nirvana.A.Shade[2]It is the first the DBI platform which implements in Solaris system. Shade uses binary translation and cache technology, it has inner support of recording the register state and opcode information..B.DynamoRIO[3]DynamoRIO is an open-source dynamic binary optimization and analysis platform which evolves from Dynamo. It is available both in Windows and Linux system, and can record the execution instruction information efficiently, but doesn't support data flow recording. This platform is mainly used for the dynamic optimization of program in instruction level.C.Valgrind[4]An open source DBI platform under Linux which can efficiently record the instructions flow and data flow information of executable file in Linux. But because of the different operation mechanism of Linux and Windows system, this platform is still difficult to transplant to Windows system. D.Pin[5]Pin is a dynamic binary instrumentation framework for the IA-32 and x86-64 instruction-set architectures that enables the creation of dynamic program analysis tools. The tools createdNational Conference on Information Technology and Computer Science (CITCS 2012)using Pin, called Pintools, can be used to perform program analysis on user space applications in Linux and Windows. Pin provides a rich API that abstracts away the underlying instruction-set idiosyncrasies and allows context information such as register contents to be passed to the injected code as parameters. Pin automatically saves and restores the registers that are overwritten by the injected code so the application continues to work. Limited access to symbol and debug information is available as well. Pin was originally created as a tool for computer architecture analysis, but its flexible API and an active community (called "Pinheads") have created a diverse set of tools for security, emulation and parallel program analysis. Pin is proprietary software developed and supported by Intel and is supplied free of charge for non-commercial use. Pin includes the source code for a large number of example instrumentation tools like basic block profilers, cache simulators, instruction trace generators, etc. It is easy to derive new tools using the rich API it provides.E.Nirvana[6]Microsoft's latest development DBI platform, mainly includes two key module: program simulation execution module and JIT (just in time) binary translation module. But it has not been to market, only for Microsoft internal use. According to relevant data, the platform can well support tracking and playback function of Windows executable files in instruction level. There will be very good application prospects especially in software reverse engineering.III.DBI A PPLICATION FIELDA.Memory testing and optimizationDBI framework developed up to now, the most widely used application is for the building of memory monitoring tools. DBI-based memory testing tools have obvious advantages than the common memory detection tool in the detection efficiency and detection accuracy, as well as the support of the underlying system. Therefore, there have been a lot of DBI based memory monitoring tools since DBI technologies emerged. Most of those tools can not only detect the memory using situation of a program, memory errors that may exist in the program, illegal use of memory, memory leaks, but also can detect buffer overflow accurately. The following details on several of BDI-based memory monitoring tools and related research.a)Memcheck: Memcheck is a memory error detector based on Valgrind. It can detect many common problems appear in C and C++ programs, such as: accessing memory you shouldn't, using undefined values, incorrect freeing of heap memory, memory leaks etc.b)Dr.Memory: Dr. Memory is built on the open-source dynamic instrumentation platform DynamoRIO. It is an excellent memory checking tool that supports both Windows and Linux. Dr. Memory uses memory shadowing to track properties of a target application’s data during execution. So that it can detect memory error more accurately. In addition, Dr. Memory provide two instrumentation paths: the fast-path and the slow-path. The fast-path is implemented as a set of carefully hand-crafted machine-code sequences or kernels covering the most performance-critical actions. Fast-path kernels are either directly inlined or use shared code with a fast subroutine switch. Rarer operations are not worth the effort and extra maintenance costs of using hand-coded kernels and are handled in the slow-path in C code with a full context switch used to call out to the C function. Through using different path in different situation, the efficiency of detection is increased greatly.B.Dynamic Taint AnalysisThe dynamic taint analysis technology is a common technique in the field of application security detection. By analysis of the data used in the program, the program's data is marked as “contaminated”(Tainted), and “not contaminated” (UnTainted) categories, while in the process of implementation of the procedures to control the spread of contaminated properties by analyzing the illegal use of the data propagation path of the contaminated property to find the loopholes that exist of the program. DBI based platform, you can build a dynamic data flow tracking tools, such data flow tracking tool with a wide tracking range, and analysis results are accurate. Here are two methods based on DBI data flow tracking tool.a)TaintCheck: TaintCheck is a dynamic taint analysis tool based on Valgrind, for the automatic detection, analysis, and signature generation of exploits on commodity software. TaintCheck's default policy detects format string attacks, and overwrite attacks that at-tempt to modify a pointer used as a return address, function pointer,or function pointer offset. Its policy can also be extended to detect other overwrite attacks, such as those that attempt to overwrite data used in system calls or security-sensitive variables. TaintCheck gave no false positives in its default configuration. in many cases when a false positive could occur, it is a symptom of a potentially exploitable bug in the monitored program. For programs where the default policy of TaintCheck could generate a false positive. Once TaintCheck detects an overwrite attack, it can automatically provide information about the vulnerability and how the vulnerability is exploited. By back-tracing the chain of tainted data structure rooted at the detection point, TaintCheck automatically identifies which original flow and which part of the original flow have caused the attack.b)Dytan: A Generic dynamic taint analysis framework based on Pin. The goal of this tool is to be a generalized tainting framework that can be used to perform dataflow and control-flow analysis on an x86 executable. The dynamic tainting of Dytan consists of: (1)associating a taint label with data values;(2)propagating taint labels as data values flow through the program during execution.As long as user provides XML configuration file, in which specify: taint sources, propagation policy, and sinks.C.Reverse engineering applicationDynamic tracking is one of the commonly used method in reverse engineering. The procedure of dynamic tracking is like this: using dynamic debugging software (eg: OllyDebug) load the program, then follow the tracks of program executionstep-by-step. This approach can be summarized in a word:analysis when tracking. And the analysis relies heavily onmanual, it is difficult to automate it. By means of DBI platform,one can separate the analysis work to the tracking process byusing DBI tool recording the execution information of targetsoftware, analyzing the recorded information by other a utomatic tools. Such processing procedure can save a lot of human labor. And the automatic analysis of the recordedinformation also can greatly reduce the software reversingcycle.In 2008 blackhat Danny Quist. etc propose a DBI basedtemporal reverse engineering. By DBI platform Pin, they getthe basic block execution sequence. By analyzing andvisualizing these block information, it help analyst understandthe program behavior quickly. In addition, in reference[7], theauthor proposed a DBI based protocol reverse method, themain idea of the paper is recording the data-flow of a softwarewith DynamoRIO, then parse the protocol field with their ownautomatic tool.D.Parallel program analysis[8]With the development of high performance computingtechnology, the design of parallel programs is becomingincreasingly important. Parallel debugging and performanceevaluation of parallel programs are difficult problems in thefield. The traditional Parallel debugging and performance evaluation tools are mostly based on source code instrumentation, which makes the workload of analyzing parallel programs very huge, and as the coding language and software upgrade, testers need to do some modifications. The most deadly is if you can’t get the source code of the parallel program, the test can’t be conducted. DBA technology making the analysis of parallel programs has nothing to do with the source code, the analysis process is more transparent and more efficient. The following is several parallel program analysis tools based on DBI framework.a)Intel Parallel Inspector: The Intel Parallel Inspector analyzes the multithreaded programs’ execution to find memory and threading errors, such as memory leaks, references to uninitialized data, data races, and deadlocks. Intel Parallel Inspector uses Pin to instrument the running program and collect the information necessary to detect errors. The instrumentation requires no special test builds or compilers, so it’s easier to test code more often. Intel Parallel Inspector combines threading and memory error checking into one powerful error checking tool. It helps increase the reliability, security, and accuracy of C/C++ applications from within Microsoft Visual Studio.b)CMP$im: Memory system behavior is critical to parallel program performance. Computational bandwidth increases faster than memory bandwidth, especially for multi-core systems. Programmers must utilize as much bandwidth as possible for programs to scale to many processors. Hardware-based monitors can report summary statistics such as memory references and cache misses; however, they are limited to the existing cache hierarchy and are not well suited for collecting more detailed information such as the degree of cache line sharing or the frequency of cache misses because of false sharing. CMP$im uses Pin to collect the memory addresses of multithreaded and multiprocessor programs, then uses a memory system’s software model to analyze program behavior. It reports miss rates, cache line reuse and sharing, and coherence traffic, and its versatile memory system model configuration can predict future systems’ application performance. While CMP$im is not publicly available, the Pin distribution includes the source for a simple cache model, dcache.cpp.IV.F UTURE RESEARCHDBA technology as a new program analysis method, have not yet been widely used. As people get more comprehensive understanding on its properties and advantages, it will play a role in more areas in more fields. Future research on dynamic binary analysis techniques are mainly concentrated in the following aspects:a)Improvement of performance for DBI platform:Based on DBI build tools have a common weakness: a certain degreeof reduction on efficiency to instrumentation program. In general, the use of DBI make the original program run rate 3-5 times lower, in future studies, how to improve the performance and efficiency of the DBI platform is an important research direction.b)The combination of static analysis methods:DBA method has many advantages, but it is essentially a dynamic analysis method that can not overcome the shortcoming of only one execution path can be passed by a time. In the future, how to combine the dynamic binary analysis with the static analysis methods is a future research focus.c)solve the problem of huge amount of record information: Using DBI instrument a program ,weather in instruction level or function level, the record set could be very huge. How to reduce the volume of the record set in the premise of ensure enough information, how to improve the efficiency of information processing, how to visualize those information are all the research spot in the future.DBA technology, with the advantages of extensive (needn't source code) and accuracy (run-time instrument), has already come to the forefront in several areas, and provides new idea to solve the problems in related field. The DBA technology would bring more breakthrough for more field in the future.R EFERENCES[1]Nicholas Nethercote. Dynamic Binary Analysis and Instrumentation orBuilding Tools is Easy [D]. PhD thesis. University of Cambridge, 2004. [2]Bob Cmelik and David Keppel. Shade: a fast instruction-set simu lateorfor execution profiling [R]. In:ACM SIGMETRICS, 2004.[3]Derek L. Bruening. Efficient, Transparent, and Comprehensive RuntimeCode Manipulation [D]. PhD thesis, M.I.T, 2004. /. [4]hercote. Valgrind: A Framework for Heavyweight DynamicBinary Instrumentation [C]. In:Proceedings of the 2007 ACM SIGPLAN conference on Programming language design and implemention, San Diego,California,USA: 2007. 89-100..[5]Chi-Keung Luk. Pin: building customized program analysis tools withdynamic instrumentation [C]. In:Programming Language Design and Implementation. 2005: 190-200.[6]Sanjay Bhansali. Framework for Instruction-level Tracing and Analysisof Program Executions [C]. Second International Conference on Virtual Execution Environments VEE, 2006. [7]HE Yong-jun, SHU Hui, XIONG Xiao-bing. Network Protocol ReverseParsing Based on Dynamic Binary Analysis.[J]. Computer Engineering.2010.36(9):268-270[8]Moshe Bach, Mark Charney, Robert Cohn, etc. Analyzing ParallelPrograms with Pin. [J]. IEEE Computer. 2010:34-41.。

qemu技术分析--TCG基本原理

qemu技术分析--TCG基本原理

QEMU技术分析2 - TCG(Tiny Code Generator)基本原理从QEMU-0.10.0开始,TCG成为QEMU新的翻译引擎,做到了“真正”的动态翻译(从某种意义上说,旧版本是从编译后的目标文件中复制二进制指令)。

TCG的全称为“Tiny Code Generator”,QEMU的作者Fabrice Bellard在TCG的说明文件中写到,TCG起源于一个C编译器后端,后来被简化为QEMU 的动态代码生成器(Fabrice Bellard以前还写过一个很牛的编译器TinyCC)。

实际上TCG的作用也和一个真正的编译器后端一样,主要负责分析、优化Target代码以及生成Host代码。

Target指令----> TCG ----> Host指令以下的讲述以X86平台为例(Host和Target都是X86)。

我在上篇文章中讲到,动态翻译的基本思想就是把每一条Target指令切分成为若干条微操作,每条微操作由一段简单的C代码来实现,运行时通过一个动态代码生成器把这些微操作组合成一个函数,最后执行这个函数,就相当于执行了一条Target指令。

这种思想的基础是因为CPU指令都是很规则的,每条指令的长度、操作码、操作数都有固定格式,根据前面就可推导出后面,所以只需通过反汇编引擎分析出指令的操作码、输入参数、输出参数等,剩下的工作就是编码为目标指令了。

那么现在的CPU指令这么多,怎么知道要分为哪些微操作呢?其实CPU指令看似名目繁多,异常复杂,实际上多数指令不外乎以下几大类:数据传送、算术运算、逻辑运算、程序控制;例如,数据传送包括:传送指令(如MOV)、堆栈操作(PUSH、POP)等,程序控制包括:函数调用(CALL)、转移指令(JMP)等;基于此,TCG就把微操作按以上几大类定义(见tcg/i386/tcg-target.c),例如:其中一个最简单的函数tcg_out_movi 如下:// tcg/tcg.cstatic inline void tcg_out8(TCGContext *s, uint8_t v){*s->code_ptr++ = v;}static inline void tcg_out32(TCGContext *s, uint32_t v){*(uint32_t *)s->code_ptr = v;s->code_ptr += 4;}// tcg/i386/tcg-target.cstatic inline void tcg_out_movi(TCGContext *s, TCGType type,int ret, int32_t arg){if (arg == 0) {/* xor r0,r0 */tcg_out_modrm(s, 0x01 | (ARITH_XOR << 3), ret, ret);} else {tcg_out8(s, 0xb8 + ret); // 输出操作码,ret是寄存器索引tcg_out32(s, arg); // 输出操作数}}0xb8 - 0xbf 正是x86指令中的mov R, Iv 系列操作的16进制码,所以,tcg_out_movi 的功能就是输出mov 操作的指令码到缓冲区中。

基于动态二进制翻译技术的数管软件虚拟测试环境设计

基于动态二进制翻译技术的数管软件虚拟测试环境设计
关键词:Βιβλιοθήκη 件测试;星载软件;模拟器;测试环境
犇犲狊犻犵狀狅犳犗犅犇犎犛狅犳狋狑犪狉犲犜犲狊狋犘犾犪狋犳狅狉犿 犅犪狊犲犱狅狀犇狔狀犪犿犻犮 犅犻狀犪狉狔犜狉犪狀狊犾犪狋犻狅狀
WeiYongquan,WangXianghui,Zhang Hongjun,DongZhenhui,ZhuJianbing
(BeijingInstituteofSpacecraftSystem Engineering,Beijing 100094,China) 犃犫狊狋狉犪犮狋:A QEMU-basedvirtualtestplatformforOBDHsoftwarewasproposedtodealwiththeproblemsoftraditionaltestenviron ment,includinghardwaredependence,toomanytypesofequipment,monitoringpointdispersionandlackofsoftwareinternalwatching.The virtualcpubasedondynamicbinarytranslationwasemulatedtorunonboardsoftwareinheterogeneousplatform,andthemachinecodeswere recordedtohelpsoftwaredebug;combinedwiththechipdriverandapplication,thedevicewassimulatedtooffertheinformationflowtrans mission,andthesystemlogwasrecordinordertoachieveasinglewindow monitoringbyhierarchicalprocessingandreal-timedifference comparinginunifiedformat.ThevirtualenvironmentwasusedinGF-4project,theresultshowedthatitcanemulatetherunningenviron mentofonboardsoftware,providemoredebugging meansandsimulatethesystem datastream,softwaretestcanbecarriedoutbeforethe hardwareisputintoproduction,sothatthesoftwareandhardwarecanbecoordinateddeveloped,andtheefficiencycanbeimproved. 犓犲狔狑狅狉犱狊:softwaretest;onboardsoftware;emulator;testenvironment

元数据展开的动态二进制翻译寄存器化优化

元数据展开的动态二进制翻译寄存器化优化

元数据展开的动态二进制翻译寄存器化优化
鲍弢;鲁云萍;徐超豪;臧斌宇
【期刊名称】《小型微型计算机系统》
【年(卷),期】2008(29)10
【摘要】动态二进制翻译技术可以使编译好的二进制代码无缝运行于其他架构下,目前得到越来越广泛的应用.由于在动态翻译执行的过程中缺少程序的原始语义信息而只能采用保守的策略来保证程序的正确性,从而制约到动态二进制翻译的性能.为了解决这种不足,本文提出一种基于静态编译阶段产生的对性能有影响的元数据进行动态翻译中的寄存器化优化算法,进而来提高动态翻译器的整体性能.实验数据表明优化方法对于SPECfp2000和SPECint2000测试集分别获得了15.03%和1.21%的性能提升,其中的一些测试包的加速比甚至达到了37.09%.
【总页数】6页(P1929-1934)
【作者】鲍弢;鲁云萍;徐超豪;臧斌宇
【作者单位】复旦大学,并行处理研究所,上海,200433;江南计算技术研究所,江苏,无锡,214083;复旦大学,并行处理研究所,上海,200433;复旦大学,并行处理研究所,上海,200433
【正文语种】中文
【中图分类】TP311
【相关文献】
1.基于优先级动态二进制翻译寄存器分配算法 [J], 戴涛;单征;卢帅兵;石强;潭捷
2.动态二进制翻译中全寄存器直接映射方法 [J], 廖银;孙广中;姜海涛;靳国杰;陈国良
3.基于两类寄存器互为缓存方法的DSP寄存器分配溢出处理优化算法 [J], 邱亚琼;胡勇华;李阳;唐镇;石林
4.动态二进制翻译中库函数处理的优化 [J], 傅立国; 庞建民; 王军; 张家豪; 岳峰
5.块链优化技术在动态二进制翻译中的应用研究 [J], 孙光辉; 王丽娟
因版权原因,仅展示原文概要,查看原文内容请购买。

注解信息制导的动态二进制翻译及优化

注解信息制导的动态二进制翻译及优化

摘! 要:动态二进制翻译器在运行时将源体系结构机器码翻译为目标体系结构机器码, 这种即时编译技术使得源机器上的软件 无需重编译就可以直接在目标机上较高效地运行, 然而, 利用动态二进制翻译器运行源软件的效率大大低于针对目标机器重新 编译运行源软件的效率, 本文在比较分析动态翻译生成的目的机器码的性能偏低的原因的基础上, 提出了注解信息制导的动态 在英特尔的商用动态二进制翻译器; ’<%0" 1=*97)4:( >3?*@; 和静态编译器; 二进制翻译及优化的方法, 本文选取了三种注解信息, ’()*+ ( @)A:2B4+*@; 上实现了注解信息制导的动态二进制编译及优化技术, 实验结果表明该三种注解信息较大程度地提高了动态 翻译码的执行效率, 关 键 词:动态翻译;动态优化;编译器;注解信息 中图分类号:CD00-! ! ! ! ! 文献标识码: <! ! ! ! ! ! 文 章 编 号: -###%-""# ("##/) #0%#EEF%#F
源, 如何利用动态信息, 如何在保证精确异常的情况下在更大 研究能降低动态翻译开销的翻 范围内进行代码调度, 等等# !) 译算法, 包括自适应翻译算法, 翻译重用算法, 翻译码存储管 从软硬件相接合的角度来提高动态二进制翻译器 理, 等等# )) 8*/>2- 处理器提供硬件来支持推测执行和对 的性能# 譬如说, 执行结果进行检验, 使翻译器可以快速生成翻译码并根据动 态信息对翻译码进行重优化# 其中最关键的硬件支持为对可 恢复写操作的存储缓冲, 它使翻译码在保证精确异常的情况 [)] 下可以充分地调度 # 本文的注解信息制导的动态二进制翻译及优化从另一个 角度来解决这个问题# 该方法将编译器与动态二进制翻译器 作为一个整体, 来考虑如何将两者相配合使得编译器产生的 代码在动态翻译时性能更好, 以及如何利用注解信息提高翻 然后 译效率# 它要求在生成二进制代码的同时生成注解信息, 利用注解信息来提高二进制动态翻译器及优化器的性能# 与本文最相近的工作为对 N5H5 字节码生成注解信息, 以 及针对静态二进制翻译器生成信息# 在文章 [ "O ] 中, N5H5 编译 器在生成字节码同时生成注解信息, 然后将注解信息连同字 由 N5H5 虚拟机读出注解信息来进行优 节码传给 N5H5 虚拟机, 由于 N5H5 字节码本身并没有丢失 化# 与二进制代码不一样, N5H5 高级语言信息, 它的注解信息的量比较少并且重点在如何 ["P] 中方法的目的是为了 降低 N5H5 虚拟机的翻译开销上# 专利 使得静态二进制翻译器能够正确地翻译二进制代码, 所以它 的注解信息主要局限在程序的结构信息方面#

块链优化技术在动态二进制翻译中的应用研究

块链优化技术在动态二进制翻译中的应用研究

基金项目:湖南省教育厅“静态二进制翻译中动态链接库函数的识别与恢复算法研究”(项目编号:13C623)。 作者简介:孙光辉 (1978—),男,湖北孝感人,硕士研究生,讲师。研究方向:嵌入式、单片机。
— 28 —
2019 年第 18 期
信息与电脑 China Computer & Communication
计算机工程应用技术
信息与电脑 China Computer & Communication
2019 年第 18 期
块链优化技术在动态二进制翻译中的应用研究
孙光辉 王丽娟 (湖南文理学院 计算机与电气工程学院,湖南 常德 415000)
摘 要:在动态二进制翻译系统中,指令的执行过程中通常会涉及频繁的上下文切换,很大程度上影响了 AB (Architecture Bridge)系统的执行效率。为此,笔者提出了一种块链优化技术,通过指令间的直接跳转,有效减少上 下文切换次数,对 AB 系统的翻译缓存进行优化,提高了动态二进制翻译系统中执行模块的时间占比。实验分析表明,块 链优化技术能提供 10% 左右的加速比。
1.1 块链结构
AB 系统基本块的结构如图 1 所示,包括 g_code_buffe(r 首 地址指针),code_num(基本块指令数)、real_add(r 物理地址)、 eip(虚地址)和 cs_base(基地址),最后保存源指令信息。 在查找基本块时,可以通过虚地址也可以通过物理地址实现, 若査找失败,可以将目标代码写入缓存,将首地址返回给首 地址指针,继续进行下一次查找,直至成功,则直接通过目 标代码首地址指针去执行。
Key words: dynamic binary translation; chain optimization; architecture bridge system; jump

二进制翻译技术综述

二进制翻译技术综述

二进制翻译技术综述
谢汶兵;田雪;漆锋滨;武成岗;王俊;罗巧玲
【期刊名称】《软件学报》
【年(卷),期】2024(35)6
【摘要】随着信息技术的快速发展,涌现出各种新型处理器体系结构.新的体系结构出现为处理器多样化发展带来机遇的同时也提出了巨大挑战,需要兼容运行已有软件,确保较为丰富的软件生态群.但要在短期内从源码编译构建大量生态软件并非易事,二进制翻译作为一种直接从二进制层面迁移可执行代码技术,支持跨平台软件兼容运行,既扩大了软件生态群,又有效降低了应用程序与硬件之间的耦合度.近年来,二进制翻译技术研究取得了较大进展.为总结现有成果并分析存在的不足,首先介绍二进制翻译技术的分类以及典型的二进制翻译系统,之后从指令翻译方法、关键问题研究、优化技术等方面分别进行分析总结,接着阐述二进制翻译技术的核心应用领域,最后对二进制翻译技术的潜在研究方向进行展望.
【总页数】37页(P2687-2723)
【作者】谢汶兵;田雪;漆锋滨;武成岗;王俊;罗巧玲
【作者单位】无锡先进技术研究院;国家并行计算机工程技术研究中心;中国科学院计算技术研究所
【正文语种】中文
【中图分类】TP314
【相关文献】
1.基于动态二进制翻译技术的数管软件虚拟测试环境设计
2.基于TCG技术的二进制翻译条件转移指令优化研究
3.块链优化技术在动态二进制翻译中的应用研究
4.基于译码制导技术的动态二进制翻译优化研究
5.基于译码制导技术的动态二进制翻译优化研究
因版权原因,仅展示原文概要,查看原文内容请购买。

动态二进制翻译中动态优化的成本与收益分析

动态二进制翻译中动态优化的成本与收益分析
关 键 词 :静 态编 译 器 ;动 态优 化 ;二 进 制 代码 ;遗 留代 码
Co t nd Be ftAna y i o s a ne i l ss f Dyna c mi Optm iato i Dyn m i Bi r Tr nsa i n i z in n a c na y a l to S UN u n -u ,WA G agh i NG iun L- a j ( u a nvrt fAt a d& ,C a g e u a 1 0 0 hn ) H n n U i sy o r n ei s e we h n d.H n n 4 5 0 ,C ia

4・
Co p tr Er .2 01 m u e a No 2 0
动态二进制翻译中动态优化的成本与收益分析
孙 光辉 ,王丽娟
( 南文理 学院 ,湖 南 常德 450) 湖 100
摘 要 :传统的静 态编译 器优化存在 着各种 限制 , 为此 , 出了一种运行期 动态优 化的对策 。在程序 的执行 过程 中, 提 持
i drcl f r rg a s iet o po rm bn r c d , n t o o a y iay o e o fr prg mmig a g a e r o i n h rs t a n t ny r g h ta s ae c o r n ln u g o c mpl T e eul e cn o o l bi te rn n u lo mp o e t e p r o ma c f t e o r e o e i l e so p i z t ,b t a s i r v e f r n e o s u c c d n o d v r in,n mey lg c o e r m p i ia in t c n q e . o h h a l e a y c d ,f o o t z to e h i u s m Ke r : s tc c mp l r d n mi p i z to y wo ds t i o i ; y a c o tmi ai n; b n r o e l g c c d a e iay c d ; e a y o e

动态二进制翻译优化研究的开题报告

动态二进制翻译优化研究的开题报告

动态二进制翻译优化研究的开题报告一、选题背景随着计算机技术的不断发展,二进制翻译技术在计算机系统中扮演着越来越重要的角色。

动态二进制翻译技术是一种基于虚拟化技术的二进制翻译技术,它能够在不修改原始二进制代码的情况下,将其翻译成目标平台的指令集,从而实现跨平台的应用程序运行。

然而,由于动态二进制翻译技术需要在运行时进行指令翻译,因此其性能往往受到较大的影响。

为了提高动态二进制翻译技术的性能,研究者们提出了各种优化方法。

其中,基于翻译缓存的优化方法是一种比较有效的方法,它通过缓存已经翻译过的指令,避免重复翻译,从而提高翻译效率。

然而,由于翻译缓存的大小和命中率对性能影响较大,因此如何优化翻译缓存成为了动态二进制翻译优化的一个重要研究方向。

二、研究目的和意义本文旨在探究动态二进制翻译优化中基于翻译缓存的优化方法,分析不同的翻译缓存替换策略对性能的影响,并提出一种优化策略,以提高动态二进制翻译技术的性能。

本研究的意义在于:1.对动态二进制翻译技术进行深入研究,提高对其原理和性能的理解。

2.分析不同的翻译缓存替换策略对性能的影响,为动态二进制翻译技术的优化提供参考。

3.提出一种优化策略,以提高动态二进制翻译技术的性能,为跨平台应用程序的运行提供更好的支持。

三、研究内容和方法本文将分为以下几个部分:1.介绍动态二进制翻译技术的原理和实现方法。

2.分析翻译缓存的基本原理和不同的替换策略,并比较它们的性能。

3.提出一种基于翻译缓存的优化策略,以提高动态二进制翻译技术的性能。

4.使用模拟器对不同的翻译缓存替换策略和优化策略进行实验,并分析实验结果。

本研究将采用实验和理论相结合的方法,通过模拟器进行实验,分析不同的翻译缓存替换策略和优化策略对性能的影响,并基于理论分析提出相应的优化策略。

四、论文结构本文将分为以下几个部分:第一章:选题背景和研究意义,介绍本研究的背景和研究目的。

第二章:相关技术介绍,介绍动态二进制翻译技术的原理和实现方法,以及翻译缓存的基本原理和不同的替换策略。

动态二进制翻译与优化技术研究

动态二进制翻译与优化技术研究

动态二进制翻译与优化技术研究
李剑慧;马湘宁;朱传琪
【期刊名称】《计算机研究与发展》
【年(卷),期】2007(44)1
【摘要】动态二进制翻译技术是一种即时编译技术,它将针对源体系结构编译生成的二进制代码(源机器码)动态翻译为可以在目的体系结构上运行的代码(翻译码).动态优化技术是指在运行时获取动态信息并进行代码优化的技术.动态二进制翻译及优化系统使得源软件无需重编译就可以直接在目标体系结构上高效地运行.目前几种比较有影响的动态二进制翻译及优化系统有Intel公司的IA-32 Execution Layer,IBM公司的DAISY,Transmeta的CMS及HP的Dynamo等.这些系统对动态二进制翻译系统关键技术有不同的实现.对动态二进制翻译和优化技术的研究是计算机领域的研究热点,具有深远的现实意义和应用前景.
【总页数】8页(P161-168)
【作者】李剑慧;马湘宁;朱传琪
【作者单位】复旦大学计算机科学与工程系,上海,200433;英特尔中国软件中心,上海,200241;英特尔中国软件中心,上海,200241;复旦大学计算机科学与工程系,上海,200433
【正文语种】中文
【中图分类】TP3
【相关文献】
1.系统级动态二进制翻译系统中访存异常的制导技术研究 [J], 张龙龙;董卫宇;王立新
2.TCG动态二进制翻译技术研究 [J], 张西超;郭向英;赵雷
3.动态二进制翻译器QEMU中冗余指令消除技术研究 [J], 宋强;陈香兰;陈华平
4.动态二进制翻译中的指令调度技术研究与实现 [J], 孙俊;文延华;漆锋滨
5.块链优化技术在动态二进制翻译中的应用研究 [J], 孙光辉; 王丽娟
因版权原因,仅展示原文概要,查看原文内容请购买。

动态二进制翻译中全寄存器直接映射方法

动态二进制翻译中全寄存器直接映射方法
Ab t a t sr c Bia y ta sai n i n i o t tme n fs f a e mir t n b t e i e e ta c i cu e .T e d f r n e n a c i cu e n r rn l t Sa mp r a so o t r g a i ewe n df r n r ht tr s h i ee c s i r ht tr s o n a w o e f e
n ad a e e v r n n s r o s e t b d p t r u h b n r t n l i y tm.I ep o e so a sa in, t wa su e l p e a d h r w r n io me t a e p s i l ema eu h o g ia a s t n s se b o y r ao n t r c s ft n lt h r o i a y s smu t l l i
补, 在翻译过程 中往往使 用多条本地指令模拟 一条 目标指令 , 译代码 规模 随之显著 增加 , 翻 从而 导致 被翻译 程序 的执行 效率下 降。 寄存 器作为处理器和 内存交换信 息的重要存储 部件 , 寄存器 的模 拟器 方式对 于程 序 的性 能有着至关 重要的影响。为 了提 高特 定平 台翻译 后代码 的执行效率 , 出了在动态二进制翻译机制 中使用全部寄存器 直接 映射方法 , 提 详细分析 了二进制翻译 中的上下文切换 原理 和寄存器访 问范围, 为异构平 台之 间寄存器直接 映射提供 方法指导。利 用 Q MU模拟器 , x6架构 的 8个通用寄存器全部 的 E 把 8
(colfC m ue Si c n eh o g U i ri c ne n eh o g C ia Hfi 3 0 7 A h iC i Sh o o o p tr c ne dTcnl y,nv syo i c d Tcnl yo hn , e 0 2 ,n u, hn e a o e t fS e a o f e2 a) 。 Istt o C m uigTcnlg , hns Aa e yo c ne,e n 0 10,hn ) (ntuef o p t ehooy C ie cdm i csB l g1 0 9 C ia i n e fS e i t

一种动态二进制翻译指令集模拟器计时方法[发明专利]

一种动态二进制翻译指令集模拟器计时方法[发明专利]

专利名称:一种动态二进制翻译指令集模拟器计时方法专利类型:发明专利
发明人:郭向英,张西超,赵雷,陈睿
申请号:CN201410178279.2
申请日:20140429
公开号:CN103955357A
公开日:
20140730
专利内容由知识产权出版社提供
摘要:一种动态二进制翻译指令集模拟器计时方法,本方法通过有效划分基本块,使得基本块每次执行时所占用的指令周期数可以在动态翻译阶段确定,从而实现模拟器的精确计时;计时过程包括下列步骤:(1)以跳转指令、分支指令和内存访问指令作为基本块的划分依据;(2)在动态翻译过程中,计算被翻译指令的周期数及所在内存区域的内存延迟大小,从而在动态翻译阶段确定基本块每执行一次所占用的指令周期数;(3)模拟器在执行翻译代码时,并以基本块为单位判断实时事件的响应时机。

本方法能够对实时事件及时响应,可以满足航天嵌入式软件的强实时性需求,同时由于不需要逐条指令判断实时事件的响应时机,计时开销较小。

申请人:北京控制工程研究所
地址:100080 北京市海淀区北京2729信箱
国籍:CN
代理机构:中国航天科技专利中心
代理人:安丽
更多信息请下载全文后查看。

二进制翻译研究综述

二进制翻译研究综述

二进制翻译研究综述目录1. 内容概括 (2)1.1 研究背景 (2)1.2 研究意义 (3)1.3 研究目标 (5)1.4 研究方法与结构 (5)2. 二进制翻译简介 (6)2.1 二进制的概念 (7)2.2 二进制翻译的挑战 (8)2.3 二进制翻译的研究现状 (9)3. 翻译技术发展 (10)3.1 传统的翻译技术 (12)3.2 机器翻译技术 (13)3.3 深度学习在翻译中的应用 (14)4. 二进制翻译的研究方法 (15)4.1 语料库建设 (17)4.2 机器学习方法 (18)4.3 神经网络模型 (19)4.4 研究展望 (20)5. 应用领域的探索 (22)5.1 计算机科学领域 (23)5.2 物理学领域 (24)5.3 信号处理领域 (25)6. 面临的挑战与问题 (26)6.1 数据处理问题 (28)6.2 系统优化问题 (29)6.3 翻译质量评估 (31)7. 案例分析 (31)7.1 领域特定案例 (32)7.2 跨语言翻译研究 (33)8. 未来趋势与展望 (34)8.1 技术发展预测 (35)8.2 应用领域拓展 (37)9. 结论与建议 (38)1. 内容概括二进制翻译研究综述主要介绍了二进制翻译领域的研究现状和发展趋势。

该文首先概述了二进制翻译的基本概念、应用领域及其重要性。

对现有的二进制翻译理论和方法进行了梳理和评价,包括源代码分析、中间代码生成、优化策略等方面。

文章还从语言学视角和计算机科学视角分析了二进制翻译的多元研究方法。

在此基础上,探讨了当前研究的热点问题和挑战,如自动翻译的准确性、效率问题,以及二进制翻译在跨文化交流中的特殊挑战等。

对二进制翻译的未来发展方向进行了展望,强调了在人工智能、自然语言处理等领域的应用前景以及对于全球软件开发和国际技术交流的重要影响。

整个综述旨在为读者提供一个关于二进制翻译研究的全面视角,以便更好地理解和推动该领域的发展。

一种基于翻译规则的全系统动态二进制翻译方法[发明专利]

一种基于翻译规则的全系统动态二进制翻译方法[发明专利]

专利名称:一种基于翻译规则的全系统动态二进制翻译方法专利类型:发明专利
发明人:张为华,鲁云萍,蒋金虎
申请号:CN202210176270.2
申请日:20220224
公开号:CN114610325A
公开日:
20220610
专利内容由知识产权出版社提供
摘要:本发明属于计算机体系结构中的动态二进制翻译技术领域,设计了一种基于翻译规则的系统级的动态二进制翻译方法,其提出了一种新的状态保存和恢复机制以应对系统级动态二进制翻译器中特殊场景下的冲突。

具体来说,其包含了以下三个步骤:第一步首先通过在客户指令解析阶段中标识出会影响系统级实现的指令,并将其单独分离出来进行识别监控;随后在翻译规则应用阶段,对系统级指令问题、内存管理问题以及异常/中断问题会涉及到的指令进行检查和处理;最后通过分析指令流信息提出了两种对条件码优化方案以提高翻译效率。

本方法在保证正确翻译的情况下,实现了高效的动态二进制翻译。

申请人:复旦大学
地址:200433 上海市杨浦区邯郸路220号
国籍:CN
代理机构:上海德昭知识产权代理有限公司
代理人:程宗德
更多信息请下载全文后查看。

TCG动态二进制翻译技术研究

TCG动态二进制翻译技术研究

TCG动态二进制翻译技术研究张西超;郭向英;赵雷【摘要】Dynamic binary translation is a just-in-time compilation technique .It can timely translate the running binary code of one in-struction set system into the code running in another instruction set system .Aiming at the TCG dynamic binary translation technique , we first study its rationale , analyse its hierarchical mechanism and translation process , and then study the strategy of translation block query and cache, the maintenance of TCG context , and the classification and attribute feature of intermediate representation .Besides, we provide the steps of generating the TCG target code and two common optimisingmethods .These two optimising means all work in translation stage , and have practical optimisation value .%动态二进制翻译是一种即时编译技术,能在运行时将一种指令集体系结构的二进制代码实时翻译成可在另一种指令集体系结构下运行的代码。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
h a v e p r a c t i c a l o p t i mi s a t i o n v a l u e. Ke ywor ds Ti n y c o d e g e n e r a t i o n Dy na mi c bi n a y r t r a n s l a t i on Tr a n s l a t i o n bl o c k I n t e r me di a t e r e p r e s e n t a t i o n Op t i mi s a t i o n
翻译过程 ; 然后 对翻译 块查询与缓存策略 、 T C G上下文 维护 , 以及 中间表 示的分 类和属 性特 点进 行研 究 , 并给 出 目标代 码 的生成 步 骤和及其常用 的两种优 化方式。这 两种优化方式均在翻译 阶段进行 , 具有实 际的优 化价值 。
关 键 词 中 图分 类 号 微 代 码 生 成 动 态 二进 制 翻 译 翻 译 块 中 间表 示 优 化 T P 3 1 4 文献标识码 A D O I : 1 0 . 3 9 6 9 / j . i s s n . 1 0 0 0 — 3 8 6 x . 2 0 1 3 . 1 1 . 0 1 0
张西超 郭向英 赵 雷
( 北京 控 制 工 程 研究 所 北京 1 0 0 1 9 0 )


动态二进制翻译是 一种 即时编译技 术 , 能在运行 时将 一种指令集体 系结构 的二进制代 码实 时翻译成可 在另 一种 指令集
体 系 结 构 下 运 行 的代 码 。 针 对 T C G( T i n y C o d e G e n e r a t o r ) 动 态 二进 制 翻 译 技 术 , 首先 对其基本 原理进 行研 究, 分 析 它 的 分 层 机 制 和
A b s t r a c t
D y n a m i c b i n a r y t r a n s l a t i o n i s a j u s t — i n — t i me c o m p i l a t i o n t e c h n i q u e .I t c a n t i me l y t r a n s l a t e t h e r u n n i n g b i n a r y c o d e o f o n e i n —
s t r u c t i o n s e t s y s t e m i n t o t h e c o d e r u n n i n g i n a n o t h e r i n s t uc r t i o n s e t s y s t e m.Ai mi n g a t t h e T CG d y n a mi c b i n a r y t r a n s l a t i o n t e c h n i q u e ,we i f r s t s t u d y i t s r a t i o n a l e,a n a l y s e i t s h i e r a r c h i c a l me c h a n i s m a n d t r a n s l a t i o n p r o c e s s ,a n d t h e n s t u d y t h e s t r a t e g y( } f t r a n s l a t i o n b l o c k q u e r y a n d c a c h e,t h e ma i n t e n a n c e o f T CG c o n t e x t ,a n d t h e c l a s s i i f c a t i o n a n d a t t r i b u t e f e a t u r e o f i n t e r me d i a t e r e p r e s e n t a t i o n .Be s i d e s ,w e p r o v i d e t h e s t e p s o f g e n e r a t i n g t h e T C G t a r g e t c o d e a n d t wo c o mmo n o p t i mi s i n g me t h o d s .T h e s e t w o o p t i mi s i n g me a n s a l l wo r k i n t r a n s l a t i o n s t a g e,a n d
S T U DY ON T C G D Y NAMI C B I N AR Y T R AN S L AT I ON T E C HNI QUE
Zh a ng Xi c ha o Guo Xi a n g y i ng Zh a o Le i
( 8 e i j i  ̄ b t s t i t u t e o f C o n t r o l E n g i n e e r i n g, B e i j i n g 1 0 0 1 9 0 , C h i n a )
第3 0卷 第 1 1 期
2 0 1 3年 1 1月
Ap p l i c a t i o ns a n d S o f t wa r e
V0 1 . 3 0 N0.1 1 NO V .2 01 3
T C G 动 态 二 进 制 翻 译 技 术 研 究
相关文档
最新文档