[go: up one dir, main page]

CN106970828A - It is a kind of to be used to carry out instruction adaptive method and apparatus - Google Patents

It is a kind of to be used to carry out instruction adaptive method and apparatus Download PDF

Info

Publication number
CN106970828A
CN106970828A CN201710194155.7A CN201710194155A CN106970828A CN 106970828 A CN106970828 A CN 106970828A CN 201710194155 A CN201710194155 A CN 201710194155A CN 106970828 A CN106970828 A CN 106970828A
Authority
CN
China
Prior art keywords
instruction
cross
initial order
carry out
run
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.)
Pending
Application number
CN201710194155.7A
Other languages
Chinese (zh)
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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
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 Beijing Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201710194155.7A priority Critical patent/CN106970828A/en
Publication of CN106970828A publication Critical patent/CN106970828A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45508Runtime interpretation or emulation, e g. emulator loops, bytecode interpretation
    • G06F9/45512Command shells

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

本发明公开了一种用于对指令进行自适应的方法,所述方法包括:响应于当前操作系统的运行环境中跨系统应用的启动,对所述跨系统应用所执行的初始指令进行监听并且确定所执行的初始指令是否需要进行动态解释,其中所述运行环境用于使被设计用于在原始操作系统中运行的所述跨系统应用能够在当前操作系统中运行;当确定所监听的初始指令需要进行动态解释时,根据预先设置的动态解释规则对所执行的指令进行动态解释,以生成经过动态解释的指令;利用预先设置的静态解释规则,对经过动态解释的指令进行静态解释,从而生成适于在当前操作系统中运行的执行指令;以及在当前操作系统中运行所述执行指令,从而保证所述跨系统应用的正常运行。

The invention discloses a method for self-adapting instructions, the method comprising: in response to the startup of the cross-system application in the running environment of the current operating system, monitoring the initial instruction executed by the cross-system application and determining whether the executed initial instruction needs to be dynamically interpreted, wherein the execution environment is used to enable the cross-system application designed to run in the original operating system to run in the current operating system; when determining that the monitored initial When the instruction needs to be dynamically interpreted, the executed instruction is dynamically interpreted according to the preset dynamic interpretation rules to generate dynamically interpreted instructions; generating an execution instruction suitable for running in the current operating system; and running the execution instruction in the current operating system, so as to ensure the normal operation of the cross-system application.

Description

一种用于对指令进行自适应的方法及设备A method and device for adapting instructions

技术领域technical field

本发明涉及计算机应用领域,更具体地,涉及一种用于对指令进行自适应的方法及设备。The present invention relates to the field of computer applications, and more specifically, to a method and device for self-adapting instructions.

背景技术Background technique

目前随着移动终端智能手机的普遍应用,用户的使用习惯已经从个人电脑时代,过度到智能手机时代。Android系统的智能手机应用越来越广泛,具备的应用也非常丰富,由于手机上的软件App或游戏做得特别精致有趣,甚至经常出现Windows电脑的用户开始关注手机上的软件App或游戏。但是由于智能手机设计为便于携带,相对小巧,手机的游戏用户经常会希望在大屏幕的个人计算机上也能运行手机上的软件App或游戏。At present, with the widespread application of mobile terminals and smart phones, users' usage habits have transitioned from the era of personal computers to the era of smart phones. Smartphones with Android system are more and more widely used, and the applications are also very rich. Because the software App or games on the mobile phone are particularly exquisite and interesting, even users of Windows computers often start to pay attention to the software App or games on the mobile phone. However, since smart phones are designed to be portable and relatively compact, game users on mobile phones often wish to run software Apps or games on mobile phones on personal computers with large screens.

现有技术普遍采用基于Virtualbox的虚拟机方案实现Android系统虚拟机,在其中运行手机Android系统应用程序,解决的方案是通过模拟完整的手机android运行环境,使Android系统应用运行在虚拟机中。Android系统的应用程序一般包含java代码和C++代码,其中C++代码编译为包(apk)中动态链接库(.so),动态链接库是目标架构的二进制机器码,相对于java的中间代码,二进制机器码可以直接运行,提高效率。但是需要动态链接库随Android系统的应用APK对不同的目标平台提供不同的版本,当前移动终端基本被ARM架构的soc系统一统天下,但也存在一定量的x86设备,为此intel提供了一个二进制解释组件houdini,使没有提供x86动态链接库的应用可以通过二进制解释其arm库为x86指令运行,从而使这些Android系统的应用也可以在Intel平台的移动设备上运行。The existing technology generally adopts a virtual machine solution based on Virtualbox to realize an Android system virtual machine, in which mobile phone Android system applications are run. The solution is to make the Android system applications run in the virtual machine by simulating a complete mobile phone android operating environment. Android system applications generally include java code and C++ code, wherein the C++ code is compiled into a dynamic link library (.so) in the package (apk). The dynamic link library is the binary machine code of the target architecture. Compared with the intermediate code of java, the binary Machine code can be run directly to improve efficiency. However, the dynamic link library needs to provide different versions for different target platforms along with the application APK of the Android system. Currently, mobile terminals are basically dominated by the ARM-based SoC system, but there are also a certain number of x86 devices. For this reason, Intel provides a binary Interpret the component Houdini, so that applications that do not provide x86 dynamic link libraries can interpret their arm libraries as x86 instructions through binary interpretation, so that these Android system applications can also run on Intel platform mobile devices.

现有技术建立一种沙箱架构,但沙箱架构并没有对应的Linux内核和基础库支持,而是用Windows的api实现了相同功能的软件平台。由于houdini是闭源软件,并没有像google一样提供整套的Android系统开源代码。并且,基于效率和兼容性考虑,houdini大量的使用了Linux内核系统调用和Linux操作系统的特性。但是由于houdini组件并不能直接运行到当前的系统中,特别是Linux系统调用和段寄存器的使用,即在异常处理中模拟的虚拟机也不能完全实现甚至基本无法实现。The existing technology establishes a sandbox architecture, but the sandbox architecture does not have the corresponding Linux kernel and basic library support, but uses Windows APIs to implement a software platform with the same function. Since Houdini is a closed source software, it does not provide a complete set of open source code for the Android system like Google. Moreover, based on efficiency and compatibility considerations, Houdini makes extensive use of Linux kernel system calls and features of the Linux operating system. However, because the Houdini component cannot be directly run into the current system, especially the use of Linux system calls and segment registers, the virtual machine simulated in exception handling cannot be fully realized or even basically impossible.

因此,需要一种技术,以解决跨系统指令调用出现动态异常时,能够对指令进行动态解释的问题。Therefore, a technology is needed to solve the problem of being able to dynamically interpret instructions when a dynamic exception occurs in a cross-system instruction call.

发明内容Contents of the invention

本发明提供了一种用于对指令进行自适应的方法及设备,以解决对运行异常的指令进行动态解释的问题。The invention provides a method and equipment for self-adapting instructions to solve the problem of dynamically interpreting abnormal instructions.

为解决上述问题,本发明提供了一种用于对指令进行自适应的方法,所述方法包括:In order to solve the above problems, the present invention provides a method for self-adapting instructions, the method comprising:

响应于当前操作系统的运行环境中跨系统应用的启动,对所述跨系统应用所执行的初始指令进行监听并且确定所执行的初始指令是否需要进行动态解释,其中所述运行环境用于使被设计用于在原始操作系统中运行的所述跨系统应用能够在当前操作系统中运行;In response to the startup of the cross-system application in the running environment of the current operating system, monitoring the initial instruction executed by the cross-system application and determining whether the executed initial instruction needs to be dynamically interpreted, wherein the running environment is used to make the executed said cross-system application designed to run on the original operating system is capable of running on the current operating system;

当确定所监听的初始指令需要进行动态解释时,根据预先设置的动态解释规则对所执行的指令进行动态解释,以生成经过动态解释的指令;When it is determined that the monitored initial command needs to be dynamically interpreted, the executed command is dynamically interpreted according to a preset dynamic interpretation rule to generate a dynamically interpreted command;

利用预先设置的静态解释规则,对经过动态解释的指令进行静态解释,从而生成适于在当前操作系统中运行的执行指令;以及Perform static interpretation on the dynamically interpreted instructions by using preset static interpretation rules, so as to generate execution instructions suitable for running in the current operating system; and

在当前操作系统中运行所述执行指令,从而保证所述跨系统应用的正常运行。The execution instruction is run in the current operating system, thereby ensuring the normal operation of the cross-system application.

优选地,在响应于当前操作系统的运行环境中跨系统应用的启动,对所述跨系统应用所执行的初始指令进行监听之前还包括:在当前操作系统中建立用于运行所述跨系统应用的运行环境,所述运行环境使得所述跨系统应用处于与其在原始操作系统运行时相同的环境中。Preferably, before the monitoring of the initial instruction executed by the cross-system application in response to the startup of the cross-system application in the running environment of the current operating system, it further includes: establishing in the current operating system for running the cross-system application The running environment of the system enables the cross-system application to be in the same environment as it runs in the original operating system.

优选地,所述确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令在当前操作系统中运行时导致异常,则确定所监听的初始指令需要进行动态解释。Preferably, the determining whether the executed initial instruction needs to be dynamically interpreted includes: when the executed initial instruction causes an exception when running in the current operating system, then determining that the monitored initial instruction needs to be dynamically interpreted.

优选地,所述确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令与当前操作系统中相应指令的格式不同时,则确定所监听的初始指令需要进行动态解释。Preferably, the determining whether the executed initial instruction needs to be dynamically interpreted includes: when the format of the executed initial instruction is different from that of the corresponding instruction in the current operating system, determining that the monitored initial instruction needs to be dynamically interpreted.

优选地,所述确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令所涉及的寄存器位数与当前操作系统中所涉及的寄存器位数的不同时,则确定所监听的初始指令需要进行动态解释。Preferably, the determining whether the executed initial instruction needs to be dynamically interpreted includes: when the number of register bits involved in the executed initial instruction is different from the number of register bits involved in the current operating system, then determine the monitored initial instruction Directives need to be interpreted dynamically.

优选地,所述初始指令是跨系统应用在原始操作系统中运行时所采用的指令。Preferably, the initial instruction is an instruction used when the cross-system application runs in the original operating system.

优选地,所述初始指令是基于所述原始操作系统运行所基于的原始处理器的指令架构的指令。Preferably, the initial instructions are instructions based on the instruction architecture of the original processor on which the original operating system runs.

优选地,所述执行指令是基于所述当前操作系统运行所基于的当前处理器的指令架构的指令。Preferably, the execution instruction is an instruction based on the instruction architecture of the current processor on which the current operating system runs.

优选地,当在所述当前操作系统中运行所述跨系统应用时,所述运行环境使得所述跨系统应用认为其运行在原始操作系统中。Preferably, when the cross-system application is running in the current operating system, the execution environment makes the cross-system application think that it is running in the original operating system.

优选地,所述原始操作系统为Android系统,以及所述当前操作系统为Windows系统。Preferably, the original operating system is an Android system, and the current operating system is a Windows system.

根据本发明的另一方面,本发明提供一种用于对指令进行自适应的设备,所述设备包括:According to another aspect of the present invention, the present invention provides a device for adapting instructions, the device comprising:

监听单元,响应于当前操作系统的运行环境中跨系统应用的启动,对所述跨系统应用所执行的初始指令进行监听并且确定所执行的初始指令是否需要进行动态解释,其中所述运行环境用于使被设计用于在原始操作系统中运行的所述跨系统应用能够在当前操作系统中运行;The monitoring unit, in response to the startup of the cross-system application in the running environment of the current operating system, monitors the initial instruction executed by the cross-system application and determines whether the executed initial instruction needs to be dynamically interpreted, wherein the running environment uses to enable said cross-system application designed to run on the original operating system to run on the current operating system;

动态解释单元,当确定所监听的初始指令需要进行动态解释时,根据预先设置的动态解释规则对所执行的指令进行动态解释,以生成经过动态解释的指令;The dynamic interpretation unit, when it is determined that the monitored initial instruction needs to be dynamically interpreted, dynamically interprets the executed instruction according to a preset dynamic interpretation rule, so as to generate a dynamically interpreted instruction;

静态解释单元,利用预先设置的静态解释规则,对经过动态解释的指令进行静态解释,从而生成适于在当前操作系统中运行的执行指令;以及The static interpretation unit statically interprets the dynamically interpreted instructions by using preset static interpretation rules, so as to generate execution instructions suitable for running in the current operating system; and

执行单元,在当前操作系统中运行所述执行指令,从而保证所述跨系统应用的正常运行。The execution unit executes the execution instruction in the current operating system, so as to ensure the normal operation of the cross-system application.

优选地,还包括初始化单元,用于在当前操作系统中建立用于运行所述跨系统应用的运行环境,所述运行环境使得所述跨系统应用处于与其在原始操作系统运行时相同的环境中。Preferably, an initialization unit is also included, configured to establish an operating environment for running the cross-system application in the current operating system, and the operating environment makes the cross-system application run in the same environment as it was running in the original operating system .

优选地,所述监听单元确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令在当前操作系统中运行时导致异常,则监听单元确定所监听的初始指令需要进行动态解释。Preferably, the monitoring unit determining whether the executed initial instruction needs to be dynamically interpreted comprises: when the executed initial instruction causes an exception when running in the current operating system, then the monitoring unit determines that the monitored initial instruction needs to be dynamically interpreted.

优选地,所述监听单元确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令与当前操作系统中相应指令的格式不同时,则监听单元确定所监听的初始指令需要进行动态解释。Preferably, the monitoring unit determining whether the executed initial instruction needs to be dynamically interpreted comprises: when the format of the executed initial instruction is different from that of the corresponding instruction in the current operating system, then the monitoring unit determines that the monitored initial instruction needs to be dynamically interpreted .

优选地,所述监听单元确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令所涉及的寄存器位数与当前操作系统中所涉及的寄存器位数的不同时,则监听单元确定所监听的初始指令需要进行动态解释。Preferably, the monitoring unit determining whether the executed initial instruction needs to be dynamically interpreted includes: when the number of register bits involved in the executed initial instruction is different from the number of register bits involved in the current operating system, the monitoring unit determines The initial command being listened to needs to be interpreted dynamically.

优选地,所述初始指令是跨系统应用在原始操作系统中运行时所采用的指令。Preferably, the initial instruction is an instruction used when the cross-system application runs in the original operating system.

优选地,所述初始指令是基于所述原始操作系统运行所基于的原始处理器的指令架构的指令。Preferably, the initial instructions are instructions based on the instruction architecture of the original processor on which the original operating system runs.

优选地,所述执行指令是基于所述当前操作系统运行所基于的当前处理器的指令架构的指令。Preferably, the execution instruction is an instruction based on the instruction architecture of the current processor on which the current operating system runs.

优选地,当在所述当前操作系统中运行所述跨系统应用时,所述运行环境使得所述跨系统应用认为其运行在原始操作系统中。Preferably, when the cross-system application is running in the current operating system, the execution environment makes the cross-system application think that it is running in the original operating system.

优选地,所述原始操作系统为Android系统,以及所述当前操作系统为Windows系统。Preferably, the original operating system is an Android system, and the current operating system is a Windows system.

根据本发明的再一方面,提供一种移动终端,包括或用于执行如上所述的设备。According to still another aspect of the present invention, a mobile terminal is provided, including or configured to implement the above-mentioned device.

本发明通过提供一种用于对指令进行自适应的方法及设备,对于运行在Windows系统的运行环境中的指令,能够使用动态二进制解释技术对运行异常的指令进行提前判断和动态解释,规避使指令不能正常运行的因素,从而使Android系统应用正常运行在Windows系统环境中。By providing a method and device for self-adapting instructions, the present invention can use dynamic binary interpretation technology to pre-judge and dynamically interpret instructions that run abnormally for instructions running in the operating environment of the Windows system, so as to avoid using Instructions can not run normally, so that the Android system application can run normally in the Windows system environment.

附图说明Description of drawings

通过参考下面的附图,可以更为完整地理解本发明的示例性实施方式:A more complete understanding of the exemplary embodiments of the present invention can be had by referring to the following drawings:

图1为根据本发明优选实施方式的用于对指令进行自适应的方法的流程图;FIG. 1 is a flowchart of a method for adapting instructions according to a preferred embodiment of the present invention;

图2为根据本发明优选实施方式的用于对指令进行自适应的设备的结构示意图;FIG. 2 is a schematic structural diagram of a device for adapting instructions according to a preferred embodiment of the present invention;

图3为现有技术的Android系统应用程序中动态链接库被调用的一般方法流程图;Fig. 3 is the general method flowchart that dynamic link library is called in the Android system application program of prior art;

图4为根据现有技术终端设备Android系统应用程序通过houdini进行二进制解释的运行的结构示意图;Fig. 4 is the structural representation that carries out the operation of binary interpretation by Houdini according to prior art terminal equipment Android system application program;

图5为根据本发明优选实施方式的动态二进制解释的流程图;以及Figure 5 is a flowchart of dynamic binary interpretation according to a preferred embodiment of the present invention; and

图6为根据本发明优选实施方式的对指令进行动态解释的流程图。Fig. 6 is a flow chart of dynamically interpreting instructions according to a preferred embodiment of the present invention.

具体实施方式detailed description

现在参考附图介绍本发明的示例性实施方式,然而,本发明可以用许多不同的形式来实施,并且不局限于此处描述的实施例,提供这些实施例是为了详尽地且完全地公开本发明,并且向所属技术领域的技术人员充分传达本发明的范围。对于表示在附图中的示例性实施方式中的术语并不是对本发明的限定。在附图中,相同的单元/元件使用相同的附图标记。Exemplary embodiments of the present invention will now be described with reference to the drawings; however, the present invention may be embodied in many different forms and are not limited to the embodiments described herein, which are provided for the purpose of exhaustively and completely disclosing the present invention. invention and fully convey the scope of the invention to those skilled in the art. The terms used in the exemplary embodiments shown in the drawings do not limit the present invention. In the figures, the same units/elements are given the same reference numerals.

除非另有说明,此处使用的术语(包括科技术语)对所属技术领域的技术人员具有通常的理解含义。另外,可以理解的是,以通常使用的词典限定的术语,应当被理解为与其相关领域的语境具有一致的含义,而不应该被理解为理想化的或过于正式的意义。Unless otherwise specified, the terms (including scientific and technical terms) used herein have the commonly understood meanings to those skilled in the art. In addition, it can be understood that terms defined by commonly used dictionaries should be understood to have consistent meanings in the context of their related fields, and should not be understood as idealized or overly formal meanings.

图1为根据本发明优选实施方式的用于对指令进行自适应的方法流程图。本发明的实施方式中原始操作系统包括移动终端的Android系统,移动终端包括但不限于:手机、平板电脑。当前操作系统包括计算设备的Windows系统,计算设备包括但不限于:台式计算机、笔记本电脑以及服务器,跨系统应用可以为360手机游戏App。本发明的实施方式,通过响应在Windows系统的运行环境中360手机游戏App的启动,对360手机游戏App执行的初始指令进行监听,并且对所执行的初始指令是否需要进行动态解释进行确认,本发明实施方式中Windows系统的运行环境用于使被设计用于在Android系统中运行的360手机游戏App能够在Windows系统中运行。本发明的实时方式,通过对360手机游戏App能够在Windows系统中运行出现的异常进行动态解释,以提高360手机游戏App指令在Windows系统中运行的适应性,规避360手机游戏App在Windows系统中运行环境中运行的异常。如图1所示,方法100从步骤101起步:Fig. 1 is a flowchart of a method for adapting instructions according to a preferred embodiment of the present invention. In the embodiment of the present invention, the original operating system includes the Android system of the mobile terminal, and the mobile terminal includes but is not limited to: a mobile phone and a tablet computer. The current operating system includes the Windows system of the computing device, and the computing device includes but is not limited to: a desktop computer, a notebook computer, and a server, and the cross-system application can be a 360 mobile game app. In the embodiment of the present invention, by responding to the startup of the 360 mobile game App in the operating environment of the Windows system, monitoring the initial instructions executed by the 360 mobile game App, and confirming whether the executed initial instructions need to be dynamically interpreted, the present invention The operating environment of the Windows system in the embodiment of the invention is used to enable the 360 mobile game App designed to run on the Android system to run on the Windows system. In the real-time mode of the present invention, by dynamically explaining the abnormalities that occur when the 360 mobile game App can run in the Windows system, the adaptability of the 360 mobile game App instructions to run in the Windows system is improved, and the 360 mobile game App is avoided in the Windows system. An exception running in the runtime environment. As shown in Figure 1, the method 100 starts from step 101:

优选地,在步骤101:响应于当前操作系统的运行环境中跨系统应用的启动,对跨系统应用所执行的初始指令进行监听并且确定所执行的初始指令是否需要进行动态解释,其中运行环境用于使被设计用于在原始操作系统中运行的跨系统应用能够在当前操作系统中运行。通过响应在Windows系统的运行环境中360手机游戏App的启动,对360手机游戏App执行的初始指令进行监听,并且对所执行的初始指令是否需要进行动态解释进行确认,本发明实施方式中Windows系统的运行环境用于使被设计用于在Android系统中运行的360手机游戏App能够在Windows系统中运行。Preferably, in step 101: in response to the startup of the cross-system application in the running environment of the current operating system, monitor the initial instruction executed by the cross-system application and determine whether the executed initial instruction needs to be dynamically interpreted, wherein the running environment uses To enable cross-system applications designed to run on the original operating system to run on the current operating system. By responding to the startup of the 360 mobile game App in the operating environment of the Windows system, monitoring the initial instructions executed by the 360 mobile game App, and confirming whether the executed initial instructions need to be dynamically interpreted, the Windows system in the embodiment of the present invention The operating environment of the 360 mobile game app designed to run on the Android system can run on the Windows system.

优选地,在响应于当前操作系统的运行环境中跨系统应用的启动,对跨系统应用所执行的初始指令进行监听之前还包括:在当前操作系统中建立用于运行跨系统应用的运行环境,运行环境使得跨系统应用处于与其在原始操作系统运行时相同的环境中。在通过响应在Windows系统的运行环境中360手机游戏App的启动,对360手机游戏App执行的初始指令进行监听之前还包括:在Windows系统中建立用于运行跨系统应用的运行环境,其中运行环境是一个在Windows系统中的框架,这个框架能够模拟Android系统的环境,例如可以为沙箱环境。Preferably, before monitoring the initial instruction executed by the cross-system application in response to the startup of the cross-system application in the running environment of the current operating system, the method further includes: establishing a running environment for running the cross-system application in the current operating system, The runtime environment enables the cross-system application to be in the same environment as it was running on the original operating system. Before monitoring the initial instructions executed by the 360 mobile game App by responding to the startup of the 360 mobile game App in the operating environment of the Windows system, it also includes: establishing an operating environment for running cross-system applications in the Windows system, wherein the operating environment It is a framework in the Windows system. This framework can simulate the environment of the Android system, for example, it can be a sandbox environment.

优选地,初始指令是跨系统应用在原始操作系统中运行时所采用的指令。优选地,初始指令是基于原始操作系统运行所基于的原始处理器的指令架构的指令。本发明的实施方式中,初始指令是指跨系统应用,即360手机游戏App在Android系统中所采用的指令,并且该指令是基于终端设备,即手机的原始处理器的指令架构的指令。Preferably, the initial instruction is an instruction used when the cross-system application runs in the original operating system. Preferably, the original instructions are instructions based on the instruction architecture of the original processor on which the original operating system runs. In the embodiment of the present invention, the initial instruction refers to the instruction adopted by the cross-system application, that is, the 360 mobile game App in the Android system, and the instruction is based on the instruction architecture of the original processor of the terminal device, that is, the mobile phone.

优选地,确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令在当前操作系统中运行时导致异常,则确定所监听的初始指令需要进行动态解释。当所执行的360手机游戏App初始指令在Windows系统运行异常,如导致Windows系统死机,则确定360手机游戏App初始指令需要进行动态解释,以提前对360手机游戏App在Windows系统中死机进行规避,使360手机游戏App在Windows系统中正常运行。Preferably, determining whether the executed initial instruction needs to be dynamically interpreted includes: when the executed initial instruction causes an exception when running in the current operating system, then determining that the monitored initial instruction needs to be dynamically interpreted. When the executed initial command of the 360 mobile game App runs abnormally in the Windows system, such as causing the Windows system to crash, it is determined that the initial command of the 360 mobile game App needs to be dynamically interpreted to avoid the crash of the 360 mobile game App in the Windows system in advance, so that The 360 mobile game App runs normally on the Windows system.

优选地,确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令与当前操作系统中相应指令的格式不同时,则确定所监听的初始指令需要进行动态解释。当所执行的360手机游戏App初始指令与Windows系统中相应指令格式不同时,如初始指令在Android系统中为32位,但在Windows系统中相应指令为16位,即提前对Android系统中为32位运行动态解释,转换为Windows系统中16位的相应指令,以规避360手机游戏App在Windows系统中不能正常运行。Preferably, determining whether the executed initial instruction needs to be dynamically interpreted includes: when the format of the executed initial instruction is different from that of the corresponding instruction in the current operating system, determining that the monitored initial instruction needs to be dynamically interpreted. When the format of the executed 360 mobile game app’s initial command is different from that of the corresponding command in the Windows system, for example, the initial command is 32-bit in the Android system, but the corresponding command in the Windows system is 16-bit, that is, it is 32-bit in the Android system in advance. Run the dynamic interpretation and convert it to the corresponding 16-bit instructions in the Windows system, so as to avoid the 360 mobile game App not running normally in the Windows system.

优选地,确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令所涉及的寄存器位数与当前操作系统中所涉及的寄存器位数的不同时,则确定所监听的初始指令需要进行动态解释。当所执行的360手机游戏App初始指令所涉及的寄存器位数与在Windows系统所涉及的寄存器位数不同时,即提前对Android系统中的指令进行动态解释,以使360手机游戏App初始指令适应Windows系统的运行环境,以规避360手机游戏App在Windows系统中不能正常运行。Preferably, determining whether the executed initial instruction needs to be dynamically interpreted includes: when the number of register bits involved in the executed initial instruction is different from the number of register bits involved in the current operating system, then determining that the monitored initial instruction requires Do dynamic interpretation. When the number of registers involved in the executed 360 mobile game App initial instructions is different from the number of registers involved in the Windows system, the instructions in the Android system will be dynamically interpreted in advance to make the 360 mobile game App initial instructions adapt to Windows. The operating environment of the system, in order to avoid that the 360 mobile game app cannot run normally in the Windows system.

优选地,在步骤102:当确定所监听的初始指令需要进行动态解释时,根据预先设置的动态解释规则对所执行的指令进行动态解释,以生成经过动态解释的指令。当确定所监听的初始指令需要进行动态解释时,对360手机游戏App初始指令进行动态二进制解释,生成动态解释后的指令。Preferably, at step 102: when it is determined that the monitored initial instruction needs to be dynamically interpreted, the executed instruction is dynamically interpreted according to a preset dynamic interpretation rule, so as to generate a dynamically interpreted instruction. When it is determined that the monitored initial command needs to be dynamically interpreted, a dynamic binary interpretation is performed on the initial command of the 360 mobile game App to generate a dynamically interpreted command.

优选地,在步骤103:利用预先设置的静态解释规则,对经过动态解释的指令进行静态解释,从而生成适于在当前操作系统中运行的执行指令。本发明的实施方式,利用预先设置的静态解释规则,对360手机游戏App初始指令进行静态解释,从而生成适于Windows系统中运行的执行指令。Preferably, in step 103: statically interpret the dynamically interpreted instructions by using preset static interpretation rules, so as to generate execution instructions suitable for running in the current operating system. In the embodiment of the present invention, the preset static interpretation rules are used to statically interpret the initial instructions of the 360 mobile game App, so as to generate execution instructions suitable for running in the Windows system.

本发明的实施方式,通过对360手机游戏App进行动态解释以及静态解释,使360手机游戏App都能够正常运行于Windows系统中。In the embodiment of the present invention, through dynamic interpretation and static interpretation of the 360 mobile game App, the 360 mobile game App can run normally in the Windows system.

优选地,在步骤104:在当前操作系统中运行执行指令,从而保证跨系统应用的正常运行。在Windows系统中运行360手机游戏App的执行指令,实现了跨系统360手机游戏App的正常运行。Preferably, in step 104: execute the instruction in the current operating system, so as to ensure the normal operation of the cross-system application. Running the execution instructions of the 360 mobile game App in the Windows system realizes the normal operation of the cross-system 360 mobile game App.

优选地,执行指令是基于当前操作系统运行所基于的当前处理器的指令架构的指令。本发明实施方式中,执行指令是基于Windows系统中运行所基于当前处理器的360手机游戏App指令架构的指令。Preferably, the execution instruction is an instruction based on the instruction architecture of the current processor on which the current operating system runs. In the embodiment of the present invention, the execution instruction is based on the instruction architecture of the current processor-based 360 mobile game App running in the Windows system.

优选地,当在当前操作系统中运行跨系统应用时,运行环境使得跨系统应用认为其运行在原始操作系统中。当在当前Windows系统中运行跨系统应用360手机游戏App时,运行环境使得360手机游戏App认为其运行在Android系统中。Preferably, when the cross-system application is running in the current operating system, the execution environment makes the cross-system application think that it is running in the original operating system. When running the cross-system application 360 mobile game App in the current Windows system, the operating environment makes the 360 mobile game App think that it is running in the Android system.

通过本发明实施方式的一种用于对指令进行自适应的方法,通过将360手机游戏App运行在Windows系统中,并启动指令,以及对360手机游戏App的初始指令进行监听,并且判断360手机游戏App在Windows系统中运行是否会运行异常以需要对指令进行动态解释,以实现对影响360手机游戏App在Windows系统中运行的异常进行提前规避。本发明实施方式,通过对360手机游戏App进行动态解释以及静态解释,使360手机游戏App可以在Windows系统中正常运行。Through a method for self-adapting instructions in the embodiment of the present invention, by running the 360 mobile game App in the Windows system, starting the instruction, and monitoring the initial instructions of the 360 mobile game App, and judging whether the 360 mobile phone Whether the game App will run abnormally in the Windows system requires dynamic interpretation of the instructions, so as to avoid the abnormalities that affect the 360 mobile game App running in the Windows system in advance. In the embodiment of the present invention, the 360 mobile game App can run normally in the Windows system by performing dynamic interpretation and static interpretation on the 360 mobile game App.

图2为根据本发明优选实施方式的用于对指令进行自适应的设备结构图。本发明的实施方式中原始操作系统包括移动终端的Android系统,移动终端包括但不限于:手机、平板电脑。当前操作系统包括计算设备的Windows系统,计算设备包括但不限于:台式计算机、笔记本电脑以及服务器,跨系统应用可以为360手机游戏App。本发明的实施方式,通过监听单元201响应在Windows系统的运行环境中360手机游戏App的启动,对360手机游戏App执行的初始指令进行监听,并且对所执行的初始指令是否需要进行动态解释进行确认,本发明实施方式中Windows系统的运行环境用于使被设计用于在Android系统中运行的360手机游戏App能够在Windows系统中运行。本发明的实时方式,通过动态解释单元202对360手机游戏App能够在Windows系统中运行出现的异常进行动态解释,以及通过静态解释单元203对360手机游戏App在Windows系统中运行出现的异常进行解释,通过执行单元204Windows系统中运行360手机游戏App。本发明的实施方式提高了360手机游戏App指令在Windows系统中运行的适应性,提前规避了360手机游戏App在Windows系统中运行环境中运行的异常。如图2所示,设备200包括:Fig. 2 is a structural diagram of a device for adapting instructions according to a preferred embodiment of the present invention. In the embodiment of the present invention, the original operating system includes the Android system of the mobile terminal, and the mobile terminal includes but is not limited to: a mobile phone and a tablet computer. The current operating system includes the Windows system of the computing device, and the computing device includes but is not limited to: a desktop computer, a notebook computer, and a server, and the cross-system application can be a 360 mobile game app. In the embodiment of the present invention, the monitoring unit 201 responds to the startup of the 360 mobile game App in the operating environment of the Windows system, monitors the initial instructions executed by the 360 mobile game App, and checks whether the executed initial instructions need to be dynamically interpreted. It is confirmed that the operating environment of the Windows system in the embodiment of the present invention is used to enable the 360 mobile game App designed to run on the Android system to run on the Windows system. In the real-time mode of the present invention, the dynamic interpretation unit 202 is used to dynamically explain the abnormality that occurs when the 360 mobile game App is running in the Windows system, and the static interpretation unit 203 is used to explain the abnormality that occurs when the 360 mobile game App is running in the Windows system , through the execution unit 204 to run the 360 mobile game App in the Windows system. The embodiment of the present invention improves the adaptability of the 360 mobile game App commands running in the Windows system, and avoids the abnormality of the 360 mobile game App running in the operating environment of the Windows system in advance. As shown in Figure 2, the device 200 includes:

监听单元201,响应于当前操作系统的运行环境中跨系统应用的启动,对跨系统应用所执行的初始指令进行监听并且确定所执行的初始指令是否需要进行动态解释,其中运行环境用于使被设计用于在原始操作系统中运行的跨系统应用能够在当前操作系统中运行。监听单元201通过响应在Windows系统的运行环境中360手机游戏App的启动,对360手机游戏App执行的初始指令进行监听,并且对所执行的初始指令是否需要进行动态解释进行确认,本发明实施方式中Windows系统的运行环境用于使被设计用于在Android系统中运行的360手机游戏App能够在Windows系统中运行。The monitoring unit 201, in response to the startup of the cross-system application in the running environment of the current operating system, monitors the initial instruction executed by the cross-system application and determines whether the executed initial instruction needs to be dynamically interpreted, wherein the running environment is used to enable the Cross-system applications designed to run on the original operating system can run on the current operating system. The monitoring unit 201 monitors the initial instructions executed by the 360 mobile game App by responding to the startup of the 360 mobile game App in the operating environment of the Windows system, and confirms whether the executed initial instructions need to be dynamically interpreted. The operating environment of the Windows system is used to enable the 360 mobile game App designed to run on the Android system to run on the Windows system.

优选地,设备200还包括初始化单元,用于在当前操作系统中建立用于运行跨系统应用的运行环境,运行环境使得跨系统应用处于与其在原始操作系统运行时相同的环境中。在通过响应在Windows系统的运行环境中360手机游戏App的启动,对360手机游戏App执行的初始指令进行监听之前还包括:在Windows系统中建立用于运行跨系统应用的运行环境,其中运行环境是一个在Windows系统中的框架,这个框架能够模拟Android系统的环境,例如可以为沙箱环境。Preferably, the device 200 further includes an initialization unit, configured to establish a running environment for running the cross-system application in the current operating system, and the running environment makes the cross-system application run in the same environment as it was running in the original operating system. Before monitoring the initial instructions executed by the 360 mobile game App by responding to the startup of the 360 mobile game App in the operating environment of the Windows system, it also includes: establishing an operating environment for running cross-system applications in the Windows system, wherein the operating environment It is a framework in the Windows system. This framework can simulate the environment of the Android system, for example, it can be a sandbox environment.

优选地,当在当前操作系统中运行跨系统应用时,运行环境使得跨系统应用认为其运行在原始操作系统中。Preferably, when the cross-system application is running in the current operating system, the execution environment makes the cross-system application think that it is running in the original operating system.

优选地,初始指令是跨系统应用在原始操作系统中运行时所采用的指令。优选地,初始指令是基于原始操作系统运行所基于的原始处理器的指令架构的指令。本发明的实施方式中,初始指令是指跨系统应用,即360手机游戏App在Android系统中所采用的指令,并且该指令是基于终端设备,即手机的原始处理器的指令架构的指令。Preferably, the initial instruction is an instruction used when the cross-system application runs in the original operating system. Preferably, the original instructions are instructions based on the instruction architecture of the original processor on which the original operating system runs. In the embodiment of the present invention, the initial instruction refers to the instruction adopted by the cross-system application, that is, the 360 mobile game App in the Android system, and the instruction is based on the instruction architecture of the original processor of the terminal device, that is, the mobile phone.

优选地,监听单元201确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令在当前操作系统中运行时导致异常,则监听单元确定所监听的初始指令需要进行动态解释。当监听单元201监听到所执行的360手机游戏App初始指令在Windows系统运行异常,如导致Windows系统死机,则确定360手机游戏App初始指令需要进行动态解释,以提前对360手机游戏App在Windows系统中死机进行规避,使360手机游戏App在Windows系统中正常运行。Preferably, the monitoring unit 201 determining whether the executed initial instruction needs to be dynamically interpreted includes: when the executed initial instruction causes an exception when running in the current operating system, then the monitoring unit determines that the monitored initial instruction needs to be dynamically interpreted. When the monitoring unit 201 detects that the executed 360 mobile game App initial command is running abnormally in the Windows system, such as causing the Windows system to crash, then it is determined that the 360 mobile game App initial command needs to be dynamically interpreted, so as to advance the 360 mobile game App in the Windows system. Avoid crashes in the middle of the game, so that the 360 mobile game App can run normally in the Windows system.

优选地,监听单元201确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令与当前操作系统中相应指令的格式不同时,则监听单元确定所监听的初始指令需要进行动态解释。当监听单元201监听到所执行的360手机游戏App初始指令与Windows系统中相应指令格式不同时,如初始指令在Android系统中为32位,但在Windows系统中相应指令为16位,即提前对Android系统中为32位运行动态解释,转换为Windows系统中16位的相应指令,以规避360手机游戏App在Windows系统中不能正常运行。Preferably, the monitoring unit 201 determining whether the executed initial instruction needs to be dynamically interpreted includes: when the format of the executed initial instruction is different from that of the corresponding instruction in the current operating system, the monitoring unit determines that the monitored initial instruction needs to be dynamically interpreted. When the monitoring unit 201 detects that the format of the executed 360 mobile game App initial command is different from that of the corresponding command in the Windows system, such as the initial command is 32 bits in the Android system, but the corresponding command in the Windows system is 16 bits, that is, the corresponding command in the Windows system is 16 bits. In the Android system, the 32-bit running dynamic interpretation is converted to the 16-bit corresponding instructions in the Windows system, so as to avoid the 360 mobile game App not running normally in the Windows system.

优选地,监听单元201确定所执行的初始指令是否需要进行动态解释包括:当所执行的初始指令所涉及的寄存器位数与当前操作系统中所涉及的寄存器位数的不同时,则监听单元确定所监听的初始指令需要进行动态解释。当监听单元201监听到所执行的360手机游戏App初始指令所涉及的寄存器位数与在Windows系统所涉及的寄存器位数不同时,即提前对Android系统中的指令进行动态解释,以使360手机游戏App初始指令适应Windows系统的运行环境,以规避360手机游戏App在Windows系统中不能正常运行。Preferably, the monitoring unit 201 determining whether the executed initial instruction needs to be dynamically interpreted includes: when the number of register bits involved in the executed initial instruction is different from the number of register bits involved in the current operating system, then the monitoring unit determines the The initial command to listen to needs to be interpreted dynamically. When the monitoring unit 201 detects that the executed 360 mobile phone game App initial instruction involves a different number of registers than that of the Windows system, it will dynamically interpret the instructions in the Android system in advance, so that the 360 mobile phone The initial instructions of the game App are adapted to the operating environment of the Windows system, so as to prevent the 360 mobile game App from running normally on the Windows system.

动态解释单元202,当确定所监听的初始指令需要进行动态解释时,根据预先设置的动态解释规则对所执行的指令进行动态解释,以生成经过动态解释的指令。当确定所监听的初始指令需要进行动态解释时,动态解释单元202对360手机游戏App初始指令进行动态二进制解释,生成动态解释后的指令。The dynamic interpretation unit 202, when it is determined that the monitored initial instruction needs to be dynamically interpreted, dynamically interprets the executed instruction according to a preset dynamic interpretation rule, so as to generate a dynamically interpreted instruction. When it is determined that the monitored initial command needs to be dynamically interpreted, the dynamic interpretation unit 202 performs dynamic binary interpretation on the initial command of the 360 mobile game App to generate a dynamically interpreted command.

静态解释单元203,利用预先设置的静态解释规则,对经过动态解释的指令进行静态解释,从而生成适于在当前操作系统中运行的执行指令本发明的实施方式,静态解释单元203利用预先设置的静态解释规则,对360手机游戏App初始指令进行静态解释,从而生成适于Windows系统中运行的执行指令。The static interpretation unit 203 uses the preset static interpretation rules to statically interpret the dynamically interpreted instructions, thereby generating execution instructions suitable for running in the current operating system. In the embodiment of the present invention, the static interpretation unit 203 uses the preset Static interpretation rules, which statically interpret the initial instructions of the 360 mobile game App, so as to generate execution instructions suitable for running on the Windows system.

本发明的实施方式,通过对360手机游戏App进行动态解释以及静态解释,使360手机游戏App都能够正常运行于Windows系统中。In the embodiment of the present invention, through dynamic interpretation and static interpretation of the 360 mobile game App, the 360 mobile game App can run normally in the Windows system.

执行单元204,在当前操作系统中运行执行指令,从而保证跨系统应用的正常运行。通过执行单元204在Windows系统中运行360手机游戏App的执行指令,实现了跨系统360手机游戏App的正常运行。The execution unit 204 executes and executes instructions in the current operating system, so as to ensure the normal operation of cross-system applications. Through the execution unit 204 running the execution instructions of the 360 mobile game App in the Windows system, the normal operation of the cross-system 360 mobile game App is realized.

优选地,执行指令是基于当前操作系统运行所基于的当前处理器的指令架构的指令。本发明实施方式中,执行指令是基于Windows系统中运行所基于当前处理器的360手机游戏App指令架构的指令。Preferably, the execution instruction is an instruction based on the instruction architecture of the current processor on which the current operating system runs. In the embodiment of the present invention, the execution instruction is based on the instruction architecture of the current processor-based 360 mobile game App running in the Windows system.

优选地,原始操作系统为Android系统,以及当前操作系统为Windows系统。当在当前Windows系统中运行跨系统应用360手机游戏App时,运行环境使得360手机游戏App认为其运行在Android系统中。Preferably, the original operating system is an Android system, and the current operating system is a Windows system. When running the cross-system application 360 mobile game App in the current Windows system, the operating environment makes the 360 mobile game App think that it is running in the Android system.

通过本发明实施方式的一种用于对指令进行自适应的设备200,通过将360手机游戏App运行在Windows系统中,并启动指令,以及通过监听单元201对360手机游戏App的初始指令进行监听,并且判断360手机游戏App在Windows系统中运行是否会运行异常以需要对指令进行动态解释,通过对360手机游戏App指令的动态解释以实现对影响360手机游戏App在Windows系统中运行的异常进行提前规避。本发明实施方式,通过对360手机游戏App进行动态解释以及静态解释,使360手机游戏App可以在Windows系统中正常运行。According to a device 200 for self-adapting instructions in the embodiment of the present invention, the 360 mobile game App is run in the Windows system, and the instruction is started, and the initial instruction of the 360 mobile game App is monitored by the monitoring unit 201 , and to judge whether the 360 mobile game App will run abnormally in the Windows system, it is necessary to dynamically interpret the instructions. Through the dynamic interpretation of the 360 mobile game App instructions, it is possible to realize the abnormality that affects the 360 mobile game App running in the Windows system. Avoid in advance. In the embodiment of the present invention, the 360 mobile game App can run normally in the Windows system by performing dynamic interpretation and static interpretation on the 360 mobile game App.

图3为根据现有技术Android系统应用程序中动态链接库被调用的一般方法流程图。如图3所示,现有技术中,通过Android虚拟机302为Android系统应用301提供运行环境。Android应用库303和基本库304为Android虚拟机302提供支撑。通常,Linux内核305提供Android系统的基本功能。FIG. 3 is a flow chart of a general method for calling a dynamic link library in an Android system application program according to the prior art. As shown in FIG. 3 , in the prior art, an Android system application 301 is provided with an operating environment through an Android virtual machine 302 . The Android application library 303 and the basic library 304 provide support for the Android virtual machine 302 . Generally, the Linux kernel 305 provides basic functions of the Android system.

图4为根据现有技术终端设备Android系统应用通过Houdini进行二进制解释的运行的结构示意图。如图4所示,现有技术中,通过Android虚拟机402为Android系统应用401提供运行环境。运行指令通过Houdini403进行静态解释。Houdini 403是提供的一个二进制解释组件,使没有提供x86动态链接库的应用可以通过二进制解释其arm库为x86指令运行,从而使这些Android系统的应用也可以在intel平台的移动设备上运行。Houdini 403可以利用Android应用库404的支持对基于arm的指令进行静态解释,从而生成经过解释的应用库代码405。通常,在将基于arm的指令解释为基于x86的指令后,Linux内核407能够识别并且执行基于x86的指令。FIG. 4 is a schematic structural diagram of binary interpretation of an Android system application on a terminal device through Houdini according to the prior art. As shown in FIG. 4 , in the prior art, an Android system application 401 is provided with an operating environment through an Android virtual machine 402 . Run instructions are statically interpreted by Houdini403. Houdini 403 is a binary interpretation component provided, so that applications that do not provide x86 dynamic link libraries can interpret their arm libraries as x86 instructions through binary interpretation, so that these Android system applications can also run on Intel platform mobile devices. Houdini 403 can use the support of the Android application library 404 to statically interpret the arm-based instructions, thereby generating interpreted application library code 405 . Generally, the Linux kernel 407 is able to recognize and execute the x86-based instructions after interpreting the arm-based instructions as x86-based instructions.

图5为根据沙箱结构运行代码中应用程序X86库调用结构流程示意图。如图5所示,本发明增加了新功能动态二进制解释508,以实现与Houdini的结合使用,从而完成指令的动态解释和静态解释。由于houdini是闭源软件,并没有像google一样提供整套的Android系统开源代码。并且,基于效率和兼容性考虑,houdini大量的使用了Linux内核系统调用和Linux操作系统的特性。但是由于houdini组件并不能直接运行到当前的系统中,特别是Linux系统调用和段寄存器的使用,即在异常处理中模拟的虚拟机也不能完全实现甚至基本无法实现。Fig. 5 is a schematic flow chart of the X86 library call structure of the application program in the code running according to the sandbox structure. As shown in FIG. 5 , the present invention adds a new function dynamic binary interpretation 508 to realize the combined use with Houdini, thereby completing dynamic interpretation and static interpretation of instructions. Since Houdini is a closed source software, it does not provide a complete set of open source code for the Android system like Google. Moreover, based on efficiency and compatibility considerations, Houdini makes extensive use of Linux kernel system calls and features of the Linux operating system. However, because the Houdini component cannot be directly run into the current system, especially the use of Linux system calls and segment registers, the virtual machine simulated in exception handling cannot be fully realized or even basically impossible.

为此,为了能够对指令进行动态解释,本发明提供了动态二进制解释508。通过Android虚拟机502为Android系统应用501提供运行环境。当确定所监听的初始指令需要进行动态解释时,动态二进制解释508根据预先设置的动态解释规则对所执行的指令进行动态解释,以生成经过动态解释的指令。然后,将经过动态解释的指令通过Houdini 503进行静态解释。Houdini 503是提供的一个二进制解释组件,使没有提供x86动态链接库的应用可以通过二进制解释其arm库为x86指令运行,从而使这些Android系统的应用也可以在intel平台的移动设备上运行。Houdini 503可以利用Android应用库504的支持对基于arm的指令进行静态解释,从而生成经过解释的应用库代码505。通常,在将基于arm的指令解释为基于x86的指令后,Windows 507能够识别并且执行基于x86的指令。Therefore, in order to be able to dynamically interpret instructions, the present invention provides dynamic binary interpretation 508 . An operating environment is provided for the Android system application 501 through the Android virtual machine 502 . When it is determined that the monitored initial instruction needs to be dynamically interpreted, the dynamic binary interpreter 508 dynamically interprets the executed instruction according to a preset dynamic interpretation rule, so as to generate a dynamically interpreted instruction. The dynamically interpreted instructions are then statically interpreted by Houdini 503. Houdini 503 is a binary interpretation component provided, so that applications that do not provide x86 dynamic link libraries can interpret their arm libraries as x86 instructions through binary interpretation, so that these Android system applications can also run on Intel platform mobile devices. Houdini 503 can use the support of Android application library 504 to perform static interpretation on arm-based instructions, thereby generating interpreted application library code 505 . Normally, Windows 507 can recognize and execute x86-based instructions after interpreting arm-based instructions as x86-based instructions.

图6为根据本发明优选实施方式的对指令进行动态解释600的流程图。动态解释600从步骤601处开始。在步骤601,启动动态二进制解释。在步骤602,为了能够进行动态二进制解释,本发明构建参数环境。在步骤603,对指令进行解释。然后,在步骤604,判断指令解释是否结束。如果结束,则进行步骤605,构建返回结果,即经过解释的指令。如果在步骤604处没有结束,那么确定是否有具体指令,如果有具体指令,则进行步骤607。在步骤607,生成模拟代码。如果没有具体指令,则进一步判断是否存在分支指令。在步骤608,如果确定有分支指令,则判断是否调用沙箱功能。如果在步骤610确定调用沙箱功能,则进行步骤609。在步骤609,生成直接调用代码。如果在步骤610确定不调用沙箱功能,则进行步骤611。在步骤611,指定下一代码块地址。在步骤612,将下一代码块加入到代码缓存中。在步骤613,运行代码块。FIG. 6 is a flow chart of dynamically interpreting instructions 600 according to a preferred embodiment of the present invention. Dynamic interpretation 600 begins at step 601 . In step 601, dynamic binary interpretation is started. In step 602, in order to enable dynamic binary interpretation, the present invention constructs a parameter environment. In step 603, the instruction is interpreted. Then, in step 604, it is judged whether the instruction interpretation ends. If it is finished, go to step 605 to construct the return result, that is, the interpreted instruction. If it is not finished at step 604, then determine whether there is a specific instruction, and if there is a specific instruction, go to step 607. In step 607, simulation code is generated. If there is no specific instruction, it is further judged whether there is a branch instruction. In step 608, if it is determined that there is a branch instruction, it is judged whether to invoke the sandbox function. If it is determined in step 610 that the sandbox function is called, go to step 609 . In step 609, a direct call code is generated. If it is determined in step 610 that the sandbox function is not invoked, then go to step 611 . In step 611, the next code block address is specified. At step 612, the next code block is added to the code cache. At step 613, the code block is run.

已经通过参考少量实施方式描述了本发明。然而,本领域技术人员所公知的,正如附带的专利权利要求所限定的,除了本发明以上公开的其他的实施例等同地落在本发明的范围内。The invention has been described with reference to a small number of embodiments. However, it is clear to a person skilled in the art that other embodiments than the invention disclosed above are equally within the scope of the invention, as defined by the appended patent claims.

通常地,在权利要求中使用的所有术语都根据他们在技术领域的通常含义被转换,除非在其中被另外明确地定义。所有的参考“一个/所述/该[装置、组件等]”都被开放地转换为所述装置、组件等中的至少一个实例,除非另外明确地说明。这里公开的任何方法的步骤都没必要以公开的准确的顺序运行,除非明确地说明。Generally, all terms used in the claims are translated according to their ordinary meaning in the technical field, unless explicitly defined otherwise therein. All references to "a/the/the [means, component, etc.]" openly translate to at least one instance of said means, component, etc., unless expressly stated otherwise. The steps of any method disclosed herein do not have to be performed in the exact order disclosed, unless explicitly stated.

Claims (10)

1. a kind of be used to carry out instruction adaptive method, methods described includes:
The startup applied in response to cross-system in the running environment of current operation system, to the cross-system using it is performed just Begin to instruct and monitored and determined whether performed initial order needs to carry out dynamic explanation, wherein the running environment is used Run in the cross-system application for enabling to be designed to run in native operating system in current operation system;
When it is determined that the initial order monitored needs to carry out dynamic explanation, according to the dynamic interpretative rule pre-set to being held Capable instruction carries out dynamic explanation, to generate the instruction explained by dynamic;
Using the static interpreter rule pre-set, static interpreter is carried out to the instruction explained by dynamic, is suitable to so as to generate The execute instruction run in current operation system;And
The execute instruction is run in current operation system, so as to ensure the normal operation of the cross-system application.
2. according to the method described in claim 1, in the running environment in response to current operation system cross-system apply open It is dynamic, also include before being monitored using performed initial order the cross-system:Set up and use in current operation system In the running environment for running the cross-system application, the running environment causes the cross-system is applied to be in it in original behaviour Make during system operation in identical environment.
3. according to the method described in claim 1, whether the initial order performed by the determination needs to carry out dynamic explanation bag Include:Cause exception when performed initial order is run in current operation system, it is determined that the initial order monitored is needed Carry out dynamic explanation.
4. according to the method described in claim 1, whether the initial order performed by the determination needs to carry out dynamic explanation bag Include:When performed initial order is different from the form of command adapted thereto in current operation system, it is determined that is monitored is initial Instruction needs to carry out dynamic explanation.
5. according to the method described in claim 1, whether the initial order performed by the determination needs to carry out dynamic explanation bag Include:When register digit involved in the register digit involved by performed initial order and current operation system not Simultaneously, it is determined that the initial order monitored needs to carry out dynamic explanation.
6. a kind of be used to carry out instruction adaptive equipment, the equipment includes:
Monitoring unit, the startup applied in response to cross-system in the running environment of current operation system, to the cross-system application Performed initial order is monitored and determines whether performed initial order needs to carry out dynamic explanation, wherein described Running environment is used to enable to be designed to the cross-system application run in native operating system in current operation system Run in system;
Dynamic Interpretation unit, when it is determined that the initial order monitored needs to carry out dynamic explanation, according to the dynamic pre-set Interpretative rule carries out dynamic explanation to performed instruction, to generate the instruction explained by dynamic;
Static interpreter unit, using the static interpreter rule pre-set, static interpreter is carried out to the instruction explained by dynamic, So as to generate the execute instruction suitable for being run in current operation system;And
Execution unit, runs the execute instruction in current operation system, so as to ensure the normal fortune of the cross-system application OK.
7. equipment according to claim 6, in addition to initialization unit, are used to transport for setting up in current operation system The running environment of the row cross-system application, the running environment causes the cross-system is applied to be in it in primitive operation system During system operation in identical environment.
8. equipment according to claim 6, the monitoring unit determines whether performed initial order is needed into action State, which is explained, to be included:Cause exception when performed initial order is run in current operation system, then monitoring unit determines institute The initial order of monitoring needs to carry out dynamic explanation.
9. equipment according to claim 6, the monitoring unit determines whether performed initial order is needed into action State, which is explained, to be included:When performed initial order is different from the form of command adapted thereto in current operation system, then monitoring unit Determine that monitored initial order needs to carry out dynamic explanation.
10. equipment according to claim 6, the monitoring unit determines whether performed initial order is needed into action State, which is explained, to be included:When register involved in the register digit involved by performed initial order and current operation system During the difference of digit, then monitoring unit determines that monitored initial order needs to carry out dynamic explanation.
CN201710194155.7A 2017-03-28 2017-03-28 It is a kind of to be used to carry out instruction adaptive method and apparatus Pending CN106970828A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710194155.7A CN106970828A (en) 2017-03-28 2017-03-28 It is a kind of to be used to carry out instruction adaptive method and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710194155.7A CN106970828A (en) 2017-03-28 2017-03-28 It is a kind of to be used to carry out instruction adaptive method and apparatus

Publications (1)

Publication Number Publication Date
CN106970828A true CN106970828A (en) 2017-07-21

Family

ID=59336081

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710194155.7A Pending CN106970828A (en) 2017-03-28 2017-03-28 It is a kind of to be used to carry out instruction adaptive method and apparatus

Country Status (1)

Country Link
CN (1) CN106970828A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170503A (en) * 2018-01-24 2018-06-15 腾讯科技(深圳)有限公司 A kind of method, terminal and the storage medium of cross-system operation Android application

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110154328A1 (en) * 2009-12-21 2011-06-23 Samsung Electronics Co., Ltd. Virtualization Apparatus and Method
CN104740872A (en) * 2015-04-13 2015-07-01 北京奇虎科技有限公司 Method and device for operating and controlling game program in simulated Android environment
CN106293880A (en) * 2016-08-10 2017-01-04 北京奇虎科技有限公司 Windows system is run the method and device of Android application program
CN106445630A (en) * 2016-08-10 2017-02-22 北京奇虎科技有限公司 Android emulator and method for implementing Android emulator

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110154328A1 (en) * 2009-12-21 2011-06-23 Samsung Electronics Co., Ltd. Virtualization Apparatus and Method
CN104740872A (en) * 2015-04-13 2015-07-01 北京奇虎科技有限公司 Method and device for operating and controlling game program in simulated Android environment
CN106293880A (en) * 2016-08-10 2017-01-04 北京奇虎科技有限公司 Windows system is run the method and device of Android application program
CN106445630A (en) * 2016-08-10 2017-02-22 北京奇虎科技有限公司 Android emulator and method for implementing Android emulator

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170503A (en) * 2018-01-24 2018-06-15 腾讯科技(深圳)有限公司 A kind of method, terminal and the storage medium of cross-system operation Android application
CN108170503B (en) * 2018-01-24 2022-04-12 腾讯科技(深圳)有限公司 Method, terminal and storage medium for cross-system android application running

Similar Documents

Publication Publication Date Title
CN103443763B (en) ISA bridge that includes support for calls to overridden virtual functions
CN111427782B (en) Running method, device, device and storage medium of Android dynamic link library
EP2754043A1 (en) Methods and systems for producing, evaluating and simulating executable applications
CN104615933B (en) The method and apparatus that the method for anti-software decompilation, counnter attack composing software start
CN111026439B (en) Application program compatibility method, device, equipment and computer storage medium
CN113419712A (en) Cross-platform application generation method, cross-platform application calling method and development device
CN111008132B (en) Application debugging method and device for Android system, computer equipment and storage medium
US20220405385A1 (en) Secure container construction device and method executable by android application, and computer-readable recording medium on which program thereof is recorded
CN103488466A (en) Method and device for executing application program
TWI873490B (en) System, method, device and medium for introducing mini-programs into third-party mobile applications
CN104025046B (en) Method, device and the computing device for associating are connect with the ISA Bridge recalled to is utilized
CN107861875A (en) A kind of analogy method and system for mixing Mobile solution
CN108647032A (en) Using loading method and device, computer installation and computer readable storage medium
CN112612550A (en) File configuration method and device
CN106557411B (en) Method and system for testing Hybrid application in Android system
CN111381816A (en) Application program acquisition method, device, equipment and storage medium
CN113127329A (en) Script debugging method and device and computer storage medium
CN106970828A (en) It is a kind of to be used to carry out instruction adaptive method and apparatus
CN112685095B (en) Virtual device loading method, device, equipment and storage medium
CN110502439B (en) Debugging method, device, electronic equipment and storage medium
WO2022179101A1 (en) Software storage method under storage architecture
CN106775608B (en) Method and device for realizing independent system process
CN109145598A (en) Method for detecting virus, device, terminal and the storage medium of script file
CN105117243B (en) A kind of method and apparatus for the startup time obtaining application program
CN110262841A (en) A method and device for enhancing bytecode

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20170721

RJ01 Rejection of invention patent application after publication