[go: up one dir, main page]

CN102193788B - Method for multiplexing cross-platform driver based on binary translation - Google Patents

Method for multiplexing cross-platform driver based on binary translation Download PDF

Info

Publication number
CN102193788B
CN102193788B CN201010125034.5A CN201010125034A CN102193788B CN 102193788 B CN102193788 B CN 102193788B CN 201010125034 A CN201010125034 A CN 201010125034A CN 102193788 B CN102193788 B CN 102193788B
Authority
CN
China
Prior art keywords
platform
driver
cross
binary
binary translation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201010125034.5A
Other languages
Chinese (zh)
Other versions
CN102193788A (en
Inventor
陈海波
陈榕
臧斌宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fudan University
Original Assignee
Fudan University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fudan University filed Critical Fudan University
Priority to CN201010125034.5A priority Critical patent/CN102193788B/en
Publication of CN102193788A publication Critical patent/CN102193788A/en
Application granted granted Critical
Publication of CN102193788B publication Critical patent/CN102193788B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

本发明属计算机系统软件及软件应用领域,涉及基于动态二进制翻译的跨平台驱动程序复用方法。其包括:以动态二进制翻译技术为基础,在目标操作系统中为驱动程序构建轻量级独立运行环境;采用二进制翻译模块实现跨平台指令集转换,异构文件格式装载模块实现不同文件格式复用,用系统服务模拟模块提供跨平台系统服务,以及通用硬件控制模块实现硬件设备的操作。本发明能有效的实现二进制驱动程序的跨平台复用,在无需源码和重编译情况下,实现在不同处理器和不同操作系统间复用现有的二进制驱动程序。本发明有利于各种处理器和操作系统,在只需较少开发成本的情况下实现对大量外部设备的有效支持。The invention belongs to the field of computer system software and software application, and relates to a cross-platform driver multiplexing method based on dynamic binary translation. It includes: based on dynamic binary translation technology, build a lightweight independent operating environment for the driver in the target operating system; use binary translation module to realize cross-platform instruction set conversion, and heterogeneous file format loading module to realize multiplexing of different file formats , using the system service simulation module to provide cross-platform system services, and the general hardware control module to realize the operation of hardware devices. The invention can effectively realize the cross-platform reuse of the binary driver program, and realize the reuse of the existing binary driver program among different processors and different operating systems without source code and recompilation. The invention is beneficial to various processors and operating systems, and realizes effective support for a large number of external devices with less development cost.

Description

基于动态二进制翻译的跨平台驱动程序复用方法Cross-platform Driver Reuse Method Based on Dynamic Binary Translation

技术领域 technical field

本发明属计算机系统软件及软件应用领域,涉及基于动态二进制翻译的跨平台驱动程序复用方法。具体涉及驱动程序在不同平台间复用和增强驱动程序可靠性等方面应用。The invention belongs to the field of computer system software and software application, and relates to a cross-platform driver multiplexing method based on dynamic binary translation. It specifically involves the application of multiplexing of drivers between different platforms and enhancing the reliability of drivers.

背景技术 Background technique

近年来,出于对国家安全、国民经济发展等多方面因素考虑,安全有效的处理器芯片和操作系统愈来愈显现出其有着至关重要的战略意义,国家有关部门对该领域技术给予关注与支持。近年来,国内研发的芯片和操作系统不断涌现,如由某研究机构研发的龙芯通用处理器,由某科技公司研发的银河麒麟操作系统等。但所述的处理器芯片和操作系统所构成的自主计算平台真正的实用和普及还面临来自同现有大量外部设备协同工作的挑战。驱动程序作为操作系统的延伸实现计算机主体与不同外部设备的交互工作,因此操作系统的成熟度取决于是否有足够的驱动程序来支持各类外部设备,例如微软视窗操作系统中超过70%的代码是设备驱动程序。对于新近研发的计算平台,完全重新开发所有的设备驱动程序并不现实,因此如何最大限度的重用现有驱动程序,实现驱动程序跨平台复用成为实用和普及新型计算平台的关键。In recent years, due to various factors such as national security and national economic development, safe and effective processor chips and operating systems have increasingly shown their vital strategic significance, and relevant state departments have paid attention to this field of technology with support. In recent years, domestically developed chips and operating systems have emerged, such as the Godson general-purpose processor developed by a research institution, and the Galaxy Kylin operating system developed by a technology company. However, the true practicality and popularization of the autonomous computing platform composed of the processor chip and the operating system still faces the challenge of cooperating with a large number of existing external devices. As an extension of the operating system, the driver realizes the interworking between the main body of the computer and different external devices, so the maturity of the operating system depends on whether there are enough drivers to support various external devices, such as more than 70% of the code in the Microsoft Windows operating system is a device driver. For newly developed computing platforms, it is not realistic to completely redevelop all device drivers, so how to maximize the reuse of existing drivers and realize cross-platform reuse of drivers has become the key to practical and popular new computing platforms.

然而驱动程序的实现依赖于操作系统所提供的驱动编程模型,两者紧密耦合在一起。当前操作系统所提供的驱动编程模型并不存在统一的标准,从编程接口到提供的系统服务、再到物理硬件操作方式等各个方面都存在巨大差异。因此对于同一个外部设备,不同操作系统上的驱动程序实现完全不同,无法复用。另一方面,不同处理器间如英特尔公司的x86处理器与中科院的龙芯处理器采用截然不同的指令集。而驱动程序往往以二进制形式发布,除了少数开源实现并不提供源代码,因此即使是同一操作系统在不同处理器平台上也无法直接二进制复用驱动程序。这直接导致驱动程序存在严重的扩展性问题,依赖于底层的处理器和操作系统环境,难以实现跨平台的二进制复用。However, the implementation of the driver depends on the driver programming model provided by the operating system, and the two are tightly coupled together. There is no unified standard for the driver programming model provided by the current operating system, and there are huge differences in various aspects from the programming interface to the provided system services to the physical hardware operation mode. Therefore, for the same external device, the driver implementations on different operating systems are completely different and cannot be reused. On the other hand, different processors such as Intel's x86 processor and the Loongson processor of the Chinese Academy of Sciences use completely different instruction sets. Drivers are often released in binary form, except for a few open source implementations that do not provide source code, so even the same operating system cannot directly reuse drivers on different processor platforms. This directly leads to serious scalability problems in the driver, which depends on the underlying processor and operating system environment, making it difficult to achieve cross-platform binary reuse.

现有的解决方案是硬件厂商或者操作系统开发人员为不同操作系统环境编写专门的驱动程序。但是出于开发成本的考虑,只有少数主流操作系统平台,如微软视窗操作系统,才能得到全面的驱动程序支持。并且这些驱动程序并不公开源代码,只提供部分处理器平台的二进制版本。对于大量非主流或新兴的操作系统,如国内自主研发的操作系统,往往得不到硬件厂商的支持,只能为最常用的一些外部设备编写驱动程序实现部分主要功能。即使是Linux这样的拥有大量用户的成熟操作系统平台上的驱动程序仍存在支持有限、升级缓慢、可靠性差和性能不佳等诸多问题。The existing solution is that hardware manufacturers or operating system developers write special drivers for different operating system environments. However, due to development cost considerations, only a few mainstream operating system platforms, such as Microsoft Windows operating system, can get comprehensive driver support. Moreover, these drivers do not disclose the source code, but only provide binary versions for some processor platforms. For a large number of non-mainstream or emerging operating systems, such as domestic self-developed operating systems, they often do not get the support of hardware manufacturers, and can only write drivers for some of the most commonly used external devices to realize some of the main functions. Even drivers on a mature operating system platform like Linux with a large number of users still suffer from limited support, slow upgrades, poor reliability, and poor performance.

发明内容 Contents of the invention

本发明的目的是克服现有技术的缺陷,主要解决的是如何在不同处理器和操作系统构成的计算平台间实现驱动程序的二进制复用,提供一种基于动态二进制翻译的跨平台驱动程序复用技术。The purpose of the present invention is to overcome the defects of the prior art, the main solution is how to realize the binary multiplexing of drivers between computing platforms composed of different processors and operating systems, and provide a cross-platform driver multiplexing based on dynamic binary translation. Use technology.

由于现有技术的二进制的驱动程序依赖于底层处理器和操作系统,因此要实现跨平台二进制复用就必须克服从指令集到文件格式、从系统服务调用到硬件设备操作等方面的差异造成的困难。Because the prior art binary driver depends on the underlying processor and operating system, to achieve cross-platform binary reuse, it is necessary to overcome the differences caused by the differences from the instruction set to the file format, from the system service call to the hardware device operation, etc. difficulty.

为解决上述问题,本发明提供一种基于动态二进制翻译的跨平台驱动程序复用技术,其包括:以动态二进制翻译技术为基础在目标操作系统中为驱动程序构建轻量级独立运行环境;分别采用二进制翻译模块实现跨平台指令集转换,异构文件格式装载模块实现不同文件格式复用,用系统服务模拟模块提供跨平台系统服务,以及通用硬件控制模块实现硬件设备的操作。In order to solve the above problems, the present invention provides a cross-platform driver reuse technology based on dynamic binary translation, which includes: building a lightweight independent operating environment for the driver in the target operating system based on the dynamic binary translation technology; The binary translation module is used to realize cross-platform instruction set conversion, the heterogeneous file format loading module is used to realize multiplexing of different file formats, the system service simulation module is used to provide cross-platform system services, and the general hardware control module realizes the operation of hardware devices.

本发明中,基于二进制翻译的复用技术的核心是二进制翻译模块,该模块采用在仿真器和模拟器中成熟的动态二进制翻译技术来实现跨平台指令集转换。动态二进制翻译技术能够实现从源指令序列到目标指令序列的动态翻译,并能够按需对特殊指令进行有针对性的处理,使得跨处理器指令集的二进制复用成为可能。动态二进制翻译技术只需一次性的实现从通用中间指令集到新的处理器指令集的翻译规则,具有很好的通用性,独立于具体的硬件设备和驱动程序。对于需要复用的驱动程序,翻译模块首先将使用源指令集的二进制驱动代码在运行时动态的按需翻译成中间指令集代码,再根据添加的翻译规则翻译成最终的可以在新处理器上执行的二进制代码。并且相对于普通应用程序,驱动代码本身还具有运行周期长、代码执行流相对稳定和序交互性不敏感的特点,有利于分摊并优化采用动态二进制翻译技术在性能方面的影响。In the present invention, the core of the multiplexing technology based on binary translation is a binary translation module, which uses the mature dynamic binary translation technology in emulators and simulators to realize cross-platform instruction set conversion. The dynamic binary translation technology can realize the dynamic translation from the source instruction sequence to the target instruction sequence, and can perform targeted processing on special instructions on demand, making the binary multiplexing of cross-processor instruction sets possible. The dynamic binary translation technology only needs to implement the translation rules from the general intermediate instruction set to the new processor instruction set at one time, which has good generality and is independent of specific hardware devices and drivers. For drivers that need to be reused, the translation module first dynamically translates the binary driver code using the source instruction set into the intermediate instruction set code at runtime, and then translates it into the final code that can be used on the new processor according to the added translation rules. Executed binary code. Moreover, compared with ordinary applications, the driver code itself has the characteristics of long running cycle, relatively stable code execution flow, and insensitive sequence interaction, which is conducive to apportioning and optimizing the performance impact of dynamic binary translation technology.

本发明中,不同操作系统平台采用多种不同的二进制文件格式,即使是同一操作系统也支持多种不同格式。异构文件格式装载模块以插件方式可扩展的支持不同平台下的二进制文件格式,完成将二进制文件从磁盘装载到内存进程空间的工作。系统服务模拟模块为驱动程序提供与驱动程序一致的系统服务。通过目标系统平台上的系统服务模拟轻量级的源系统服务,并由动态二进制翻译模块实现对服务调用的重定向,使得二进制驱动程序能够借助目标系统服务来完成必要的操作。最后通用硬件控制模块抽象硬件操作中具有共性的底层操作,分离驱动程序对于内核环境的依赖。使驱动程序运行与用户态,由通用硬件控制模块来代理完成必要的内核态操作,如创建目标平台上的应用程序接口,对硬件外设的寄存器进行读写操作等。In the present invention, different operating system platforms adopt multiple different binary file formats, and even the same operating system supports multiple different formats. The heterogeneous file format loading module supports binary file formats under different platforms in a plug-in manner, and completes the work of loading binary files from the disk to the memory process space. The system service simulation module provides the driver program with the same system service as the driver program. The light-weight source system service is simulated by the system service on the target system platform, and the redirection of the service call is realized by the dynamic binary translation module, so that the binary driver can complete the necessary operation with the help of the target system service. Finally, the common hardware control module abstracts the common bottom-level operations in hardware operations, and separates the driver's dependence on the kernel environment. Make the driver run in the user mode, and the general hardware control module will act as an agent to complete the necessary kernel mode operations, such as creating the application program interface on the target platform, reading and writing the registers of the hardware peripherals, etc.

本发明的有益效果是,有效的实现二进制驱动程序的跨平台复用,利用动态二进制翻译等技术在无需源码和重编译情况下,实现在不同处理器和不同操作系统间复用现有的二进制驱动程序。本发明有利于各种处理器和操作系统,尤其是自主研发的计算平台的实用化和普及,在只需较少开发成本的情况下实现对大量外部设备的有效支持。The beneficial effect of the present invention is that the cross-platform multiplexing of binary drivers can be effectively realized, and the existing binary drivers can be reused between different processors and different operating systems by using techniques such as dynamic binary translation without source code and recompilation. driver. The invention is beneficial to the practicability and popularization of various processors and operating systems, especially the self-developed computing platform, and realizes effective support for a large number of external devices with less development cost.

为了便于理解,以下将通过具体的附图和实施例对本发明的进行详细地描述。需要特别指出的是,具体实例和附图仅是为了说明,显然本领域的普通技术人员可以根据本文说明,在本发明的范围内对本发明做出各种各样的修正和改变,这些修正和改变也纳入本发明的范围内。For ease of understanding, the present invention will be described in detail below through specific drawings and embodiments. It should be pointed out that the specific examples and accompanying drawings are only for illustration. Obviously, those skilled in the art can make various amendments and changes within the scope of the present invention according to the description herein. These amendments and Modifications are also included within the scope of the present invention.

附图说明 Description of drawings

图1为本发明的二进制驱动跨平台复用技术架构示意图。FIG. 1 is a schematic diagram of the architecture of the binary driver cross-platform multiplexing technology of the present invention.

具体实施方式 detailed description

实施例1Example 1

图1描述了基于动态二进制翻译的跨平台驱动复用技术的整体系统架构。装载模块首先依据二进制驱动程序文件类型使用合适的格式插件将驱动程序装载到进程空间。当需要执行驱动程序中的指令时,动态二进制翻译模块首先将对应的源指令序列段翻译成目标处理器指令序列段然后执行,并且该结果被保存在翻译缓冲区中避免多次翻译。驱动程序中对于源操作系统上的系统服务请求,比如分配内存空间请求,被翻译模块截获并重定向到系统服务模拟模块。服务模拟模块使用目标操作系统上的系统服务来模拟完成请求。而驱动程序与普通应用程序以及物理硬件设备的交互、以及对内核态资源的访问都由位于内核态的通用硬件控制模块代理完成。Figure 1 describes the overall system architecture of the cross-platform driver multiplexing technology based on dynamic binary translation. The load module first loads the driver into the process space using the appropriate format plugin depending on the binary driver file type. When an instruction in the driver program needs to be executed, the dynamic binary translation module first translates the corresponding source instruction sequence segment into the target processor instruction sequence segment and then executes it, and the result is saved in the translation buffer to avoid multiple translations. The system service request on the source operating system in the driver, such as the request to allocate memory space, is intercepted by the translation module and redirected to the system service simulation module. The service simulation module uses system services on the target operating system to simulate fulfillment requests. The interaction between the driver program and common applications and physical hardware devices, as well as the access to kernel mode resources are all performed by the general hardware control module located in the kernel mode.

Claims (2)

1. method for multiplexing cross-platform driver based on binary translation, it is characterised in that comprising: build lightweight independent operating environment for driver in destination OS;Wherein, it is respectively adopted binary translation module and realizes the conversion of cross-platform instruction set, heterogeneous file form loading module realizes different file format multiplexing, provides cross platform system service with system service analog module, and common hardware control module realizes the operation of hardware device;
Described binary translation module uses binary translation technology in emulator and simulator to realize the conversion of cross-platform instruction set, and wherein binary translation technology realizes from sourse instruction sequence to the dynamic translation of target instruction target word sequence, and on-demand processes;
Described heterogeneous file form loading module with plug-in unit mode expansible support the binary file format under different platform, complete to be loaded into binary file from disk the work of the internal memory process space;
Described system service analog module provides the system service consistent with driver for driver.
2. the method as described in claim 1, it is characterised in that wherein said binary translation technology realizes from general intermediate command set to the translation rule of new processor instruction set, and independent of particular hardware Devices and Drivers.
CN201010125034.5A 2010-03-12 2010-03-12 Method for multiplexing cross-platform driver based on binary translation Expired - Fee Related CN102193788B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201010125034.5A CN102193788B (en) 2010-03-12 2010-03-12 Method for multiplexing cross-platform driver based on binary translation

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201010125034.5A CN102193788B (en) 2010-03-12 2010-03-12 Method for multiplexing cross-platform driver based on binary translation

Publications (2)

Publication Number Publication Date
CN102193788A CN102193788A (en) 2011-09-21
CN102193788B true CN102193788B (en) 2016-08-03

Family

ID=44601910

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201010125034.5A Expired - Fee Related CN102193788B (en) 2010-03-12 2010-03-12 Method for multiplexing cross-platform driver based on binary translation

Country Status (1)

Country Link
CN (1) CN102193788B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140059322A1 (en) * 2011-12-23 2014-02-27 Elmoustapha Ould-Ahmed-Vall Apparatus and method for broadcasting from a general purpose register to a vector register
CN103761203B (en) * 2013-11-29 2017-09-22 北京中启智源数字信息技术有限责任公司 A kind of general connection method for different hardware equipment
CN106325819B (en) 2015-06-17 2019-08-02 华为技术有限公司 Computer instruction processing method, coprocessor and system
CN106648544B (en) * 2015-11-02 2019-03-26 龙芯中科技术有限公司 The distribution method and device of register
CN109471668B (en) * 2018-11-20 2021-11-26 南方电网科学研究院有限责任公司 Cross-platform display card firmware translation execution method, device, equipment and readable medium
CN114398086B (en) * 2020-08-29 2022-11-25 华为技术有限公司 Drive configuration management method, device, medium, equipment and system
CN114173354A (en) * 2020-09-10 2022-03-11 华为技术有限公司 WLAN driving framework, assembly method of WLAN driving framework and related equipment
CN114691198B (en) * 2020-12-25 2025-01-07 奇安信网神信息技术(北京)股份有限公司 System access method, device, electronic device and storage medium
CN114004239A (en) * 2021-11-08 2022-02-01 麒麟软件有限公司 Qemu-based Linux cross-architecture printer solution
CN114721719B (en) * 2022-04-20 2023-08-01 上海道客网络科技有限公司 Method and system for containerized deployment of heterogeneous applications in cluster

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101387969B (en) * 2008-10-16 2011-04-13 上海交通大学 Dynamic binary translation method for cooperation design of software and hardware
CN101452396B (en) * 2008-12-25 2012-04-25 上海交通大学 Dynamic binary translation method combined with static optimization
CN101504613B (en) * 2009-03-12 2011-09-28 上海交通大学 Distributed dynamic binary translation method used for limited system

Also Published As

Publication number Publication date
CN102193788A (en) 2011-09-21

Similar Documents

Publication Publication Date Title
CN102193788B (en) Method for multiplexing cross-platform driver based on binary translation
CN101968746B (en) A kind of implementation method of kernel virtual machine Organizational Structure Mode
KR101673435B1 (en) Creating an isolated execution environment in a co-designed processor
CN103559087B (en) Implementation method, relevant apparatus and the system of a kind of interruption between virtual processor
US9697031B2 (en) Method for implementing inter-virtual processor interrupt by writing register data in a single write operation to a virtual register
JP6458959B2 (en) Co-designed dynamic language accelerator for processors
CN102591715A (en) Implementing method for optimizing network performance of virtual machine by using multiqueue technology
CN101183315A (en) A Parallel Multiprocessor Virtual Machine System
US20070174587A1 (en) Address space emulation
KR101640769B1 (en) Virtual system and instruction executing method thereof
CN117369993A (en) Method for compatibly running different service systems in Linux environment and credit creation server
EP2941696A1 (en) Software interface for a hardware device
CN101876954A (en) A virtual machine control system and its working method
CN101425046A (en) Method for implementing distributed I/O resource virtualizing technique
CN111796912A (en) Sunwei platform storage input and output device virtualization performance optimization method and system
Shen et al. Native simulation of MPSoC using hardware-assisted virtualization
CN105335203A (en) Binary translation execution method of shared libraries and device
Ding et al. HSAemu: a full system emulator for HSA platforms
Yeh et al. On the interfacing between QEMU and SystemC for virtual platform construction: Using DMA as a case
CN103902767B (en) Multinuclear emulator based on QEMU and SystemC
US20230342172A1 (en) Scalable asynchronous communication for encrypted virtual machines
CN106970825B (en) ARM7 simulation target machine implementation method based on GDB configurable framework
US12175271B2 (en) Reducing latency for nested virtual machines
Li et al. FEMU: A firmware-based emulation framework for SoC verification
US20220405111A1 (en) Improving memory access handling for nested virtual machines

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160803

Termination date: 20190312

CF01 Termination of patent right due to non-payment of annual fee