WO2015010479A1 - Application program transplantation method based on virtual instructions - Google Patents

Application program transplantation method based on virtual instructions Download PDF

Info

Publication number
WO2015010479A1
WO2015010479A1 PCT/CN2014/073905 CN2014073905W WO2015010479A1 WO 2015010479 A1 WO2015010479 A1 WO 2015010479A1 CN 2014073905 W CN2014073905 W CN 2014073905W WO 2015010479 A1 WO2015010479 A1 WO 2015010479A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
virtual
assembly
instruction set
add
Prior art date
Application number
PCT/CN2014/073905
Other languages
French (fr)
Chinese (zh)
Inventor
徐滢
Original Assignee
成都品果科技有限公司
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 成都品果科技有限公司 filed Critical 成都品果科技有限公司
Publication of WO2015010479A1 publication Critical patent/WO2015010479A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/45516Runtime code conversion or optimisation
    • G06F9/4552Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation

Definitions

  • the present invention relates to program porting techniques, and more particularly to a convenient virtual instruction based application porting method.
  • BACKGROUND OF THE INVENTION With the popularity and performance of smartphones, consumers are hoping to run more applications on mobile platforms. Free applications that run on Windows systems can also run on mobile platforms.
  • the current mainstream platforms for mobile phones include the lOS system and the AndroKi system. If you directly develop application software, writing code suitable for the mobile platform is time-consuming and energy-intensive. It is likely that such an application for mobile platforms has not yet been developed, and consumers are paying attention to another application. In the case of this, then obviously this does not have market benefits.
  • Step 101 Convert the application to assembly code on a Windows system
  • Step 102 In the Windows system, the assembly code is converted into corresponding virtual instructions one by one according to the syntax of a set of virtual instruction sets, thereby obtaining the virtualized assembly code;
  • Step 103 Copy the virtualized assembly code to another application platform, and compile and run;
  • At least one instruction in the virtual instruction set corresponds to one instruction in the assembly instruction set;
  • Each instruction in the virtual instruction set is a macro or function written in C language, and includes at least one C language instruction.
  • the other application platform is an iOS system or an Android system.
  • the assembly instruction set is an Intel x86 assembly instruction set.
  • the beneficial effects of the present invention are: Due to the use of a fixed virtual instruction set and its grammar, bulk virtualization of the assembly code corresponding to the application can be realized, and work efficiency is improved.
  • the virtual instruction set and its grammar can be defined by those skilled in the art.
  • At least one instruction in the virtual instruction set corresponds to one of the existing standard assembly instructions, for example, the addition instruction in the virtual instruction set "add_dO(reg,immy' corresponds to the " a dd reg ,mim" instruction in the Intel x86 instruction set)
  • the conversion of assembly instructions to virtual instructions can be quickly implemented.
  • Each instruction in the virtual instruction set is actually a macro or function written in C language, so that the converted virtual assembly code can run on all C-compatible platforms, such as iOS platform and Andr d platform.
  • C-compatible platforms such as iOS platform and Andr d platform.
  • the platform compatible with C language is very wide. Basically, all platforms can run C language code. It can be seen that this method can be used to transplant applications on Windows platform to any other application platform.
  • Figure 1 is a flow chart of code processing of the present invention.
  • FIG. 2 is a schematic diagram of correspondence between a part of the instructions of the Intel x86 assembly instruction set and a virtual instruction set instruction proposed by the present invention.
  • the application migration method disclosed by the present invention includes:
  • Step 101 Convert the application to assembly code on a Windows system
  • Step 102 In the Windows system, each assembly instruction in the assembly code is converted into a corresponding virtual instruction one by one according to a grammar of a set of virtual instruction sets, thereby obtaining virtualized assembly code;
  • Step 103 assembling the virtualized assembly code Copy to other application platforms and compile and run.
  • the virtual instruction set may be defined by a person skilled in the art according to its programming habit, but needs to satisfy the following basic conditions: at least one instruction in the virtual instruction set corresponds to one instruction in the assembly instruction set; and the virtual Each instruction in the instruction set is a macro or function written in C, containing at least one C language instruction.
  • the virtual instruction set and the grammar embodiment disclosed by the present invention are now described by taking the Intel x86 assembly instruction set and the grammar as an example. However, those skilled in the art should not understand the present embodiment as a limitation of the present invention.
  • a virtual instruction set aims to teach a person skilled in the art how to define a set of equivalent virtual instruction sets.
  • the general format of the instruction implemented by the Intel x86 assembly syntax is: mstl opl or inst2 opl, op2 or inst.3 ol , op2, op3 , where inst is an Intel x86 assembly instruction mnemonic, such as mov, add, and .... Op is the opcode, the opcode can be a register, it can be either memory or immediate. Virtuallnstname & flag? & ( & oprd? &:) namename
  • any tel x86 instruction can be rewritten as a virtual instruction.
  • the above conversion principles are now explained by three different types of addition instructions; Among them, the generic force command add has the following form: add reg, imm; add reg, reg; add reg, mem? add mem? imm; add mem, reg, the flag register of its influence is c, ⁇ ' , z ? S o reg: 3 ⁇ 4r, imm: _iL is the number, mem;
  • add__dO(reg,imm) add__dO(reg,reg) , add— d2(reg,mem), add— dl (mem, imm) , add dl(mem,reg).
  • the virtual instruction that affects the z flag is s
  • Intel x86 floating-point addition instruction fadd has the following form: fadd reg, reg ; fadd mem32; fadd inem64, where mem32 is a 32-bit memory variable and mem64 is a 64-bit memory variable.
  • the virtual instructions fadd d0(reg,reg), fadd d] (mem32) , fadd q 1 (mem64) can be defined accordingly.
  • Each of the above virtual instructions is essentially a C-implemented macro or function.
  • Add d0 (reg, imm) C language 'speech 33 ⁇ 4 is: #define add d0(reg,imm) reg imm.
  • the invention is not limited to the specific embodiments described above.
  • the invention extends to any new feature or any new combination disclosed in this specification, as well as any novel method or process steps or any new combination disclosed.

Abstract

Disclosed is an application program transplantation method based on virtual instructions, which relates to the technology of program transplantation and aims to provide a method capable of quickly and conveniently transplanting an application program of a Windows platform onto other application platforms such as an ios platform or an Android platform. The adopted technical solution comprises the steps as follows: step 101: in a Windows system, converting application programs into assembly codes; step 102: in the Windows system, converting the assembly codes into corresponding virtual instructions one by one according to the syntax of a set of virtual instruction sets, thereby obtaining virtualized assembly codes; and step 103: copying the virtualized assembly codes onto other application platforms and then operating the virtualized assembly codes after compilation, wherein at least one instruction in the virtual instruction set corresponds to an instruction in an assembly instruction set, and each instruction in the virtual instruction set is a macro or a function written in C language, and comprises at least one C language instruction.

Description

一种基于虚拟指令的应用程序移植方法  An application migration method based on virtual instruction
技术领域 本发明涉及程序移植技术, 尤其是一种便捷的基于虚拟指令的应用程 序移植方法。 背景技术 随着智能手机的普及及性能的不断提高,消费者希望能在手机平台上运 行更多的应用程序。 如希望能在 Windows系统中运行的免费应用程序也能 在手机平台上运行。 目前手机的主流平台包括 lOS系统及 AndroKi系统。如 果直接进行应用程序软件开发, 编写适合手机平台的代码, 是很费时间和 精力的, 很可能出现适用于手机平台的这种应用程序还未开发出来, 消费 者又开始关注另一种应用程序的情况, 那么这样做显然不具备市场效益。 因此, 亟需一种能快速便捷的将 Windows平台的应用程序移植到 lOS平台 或 Android平台等其他应用平台的方法。 发明内容 本发明所要解决的技术问题是: 针对上述存在的问题, 提供一种基于 虚拟指令的应用程序移植方法。 本发明采用的技术方案如下: 包括: TECHNICAL FIELD The present invention relates to program porting techniques, and more particularly to a convenient virtual instruction based application porting method. BACKGROUND OF THE INVENTION With the popularity and performance of smartphones, consumers are hoping to run more applications on mobile platforms. Free applications that run on Windows systems can also run on mobile platforms. The current mainstream platforms for mobile phones include the lOS system and the AndroKi system. If you directly develop application software, writing code suitable for the mobile platform is time-consuming and energy-intensive. It is likely that such an application for mobile platforms has not yet been developed, and consumers are paying attention to another application. In the case of this, then obviously this does not have market benefits. Therefore, there is a need for a method for quickly and easily porting applications of the Windows platform to other application platforms such as the lOS platform or the Android platform. SUMMARY OF THE INVENTION The technical problem to be solved by the present invention is: To solve the above problems, an application migration method based on a virtual instruction is provided. The technical solution adopted by the present invention is as follows:
步骤 101 : 在 Windows系统中将应用程序转换为汇编代码;  Step 101: Convert the application to assembly code on a Windows system;
步骤 102:在 Windows系统中将汇编代码按照一套虚拟指令集的语法逐 一转换为对应的虚拟指令, 从而得到虚拟化的汇编代码;  Step 102: In the Windows system, the assembly code is converted into corresponding virtual instructions one by one according to the syntax of a set of virtual instruction sets, thereby obtaining the virtualized assembly code;
步骤 103 : 将所述虚拟化的汇编代码拷贝到其他应用平台上, 经过编译 后运行;  Step 103: Copy the virtualized assembly code to another application platform, and compile and run;
所述虚拟指令集中至少有一条指令与汇编指令集中的一条指令对应; 且 所述虚拟指令集中的每一条指令为一个 C语言编写的宏或函数, 包含至少 一条 C语言指令。 At least one instruction in the virtual instruction set corresponds to one instruction in the assembly instruction set; Each instruction in the virtual instruction set is a macro or function written in C language, and includes at least one C language instruction.
优选地, 所述其他应用平台为 iOS系统或 Android系统。  Preferably, the other application platform is an iOS system or an Android system.
优选地, 所述汇编指令集为 Intel x86汇编指令集。  Preferably, the assembly instruction set is an Intel x86 assembly instruction set.
综上所述, 由于采用了上述技术方案, 本发明的有益效果是: 由于使用一固定的虚拟指令集及其文法, 可以实现应用程序对应的汇 编代码的批量虚拟化, 提高工作效率。 所述虚拟指令集及其文法可由本领 域技术人员自行定义。  In summary, due to the adoption of the above technical solution, the beneficial effects of the present invention are: Due to the use of a fixed virtual instruction set and its grammar, bulk virtualization of the assembly code corresponding to the application can be realized, and work efficiency is improved. The virtual instruction set and its grammar can be defined by those skilled in the art.
虚拟指令集中至少一条指令与已有的标准汇编指令及中的一条指令对 应, 例如虚拟指令集中的加法指令" add— dO(reg,immy'对应 Intel x86指令集 中的" add reg,mim"指令, 从而可以快速实现汇编指令向虚拟指令的转换。 At least one instruction in the virtual instruction set corresponds to one of the existing standard assembly instructions, for example, the addition instruction in the virtual instruction set "add_dO(reg,immy' corresponds to the " a dd reg ,mim" instruction in the Intel x86 instruction set) Thus, the conversion of assembly instructions to virtual instructions can be quickly implemented.
虚拟指令集中的每一条指令实际为一 C语言编写的宏或函数, 从而使 得转换后的虚拟化汇编代码能够在一切兼容 C语言的平台上运行,例如 iOS 平台及 Andr d平台。 当然, 能兼容 C语言的平台很广, 基本目前所有的 平台都能运行 C语言代码, 可见, 采用本方法可以实现 Windows平台上应 用程序往其他任何应用平台移植。  Each instruction in the virtual instruction set is actually a macro or function written in C language, so that the converted virtual assembly code can run on all C-compatible platforms, such as iOS platform and Andr d platform. Of course, the platform compatible with C language is very wide. Basically, all platforms can run C language code. It can be seen that this method can be used to transplant applications on Windows platform to any other application platform.
附图说明 DRAWINGS
本发明将通过例子并参照附图的方式说明, 其中:  The invention will be illustrated by way of example and with reference to the accompanying drawings in which:
图 1为本发明代码处理流程图。  Figure 1 is a flow chart of code processing of the present invention.
图 2为 Intel x86汇编指令集其中部分指令与本发明提出的一种虚拟指 令集指令的对应示意图。  2 is a schematic diagram of correspondence between a part of the instructions of the Intel x86 assembly instruction set and a virtual instruction set instruction proposed by the present invention.
具体实施方式 本说明书中公开的所有特征, 或公开的所有方法或过程中的步骤, 除了 互相排斥的特征和 /或步骤以外, 均可以以任何方式组合。 本说明书中公开的任一特征, 除非特别叙述, 均可被其他等效或具有类 似目的的替代特征加以替换。 即, 除非特别叙述, 每个特征只是一系列等 效或类似特征中的一个例子而已。 如图 1, 本发明公开的应用程序移植方法包括: detailed description All features disclosed in this specification, or steps in all methods or processes disclosed, can be combined in any manner other than mutually exclusive features and/or steps. Any feature disclosed in this specification, unless specifically stated otherwise, may be replaced by other equivalents or alternative features having similar purposes. That is, unless specifically stated otherwise, each feature is only one example of a series of equivalent or similar features. As shown in FIG. 1, the application migration method disclosed by the present invention includes:
步骤 101: 在 Windows系统中将应用程序转换为汇编代码;  Step 101: Convert the application to assembly code on a Windows system;
步骤 102:在 Windows系统中将汇编代码中的各个汇编指令按照一套虚 拟指令集的文法逐一转换为对应的虚拟指令, 从而得到虚拟化的汇编代码; 步骤 103 : 将所述虚拟化的汇编代码拷贝到其他应用平台上经过编译后 运行。  Step 102: In the Windows system, each assembly instruction in the assembly code is converted into a corresponding virtual instruction one by one according to a grammar of a set of virtual instruction sets, thereby obtaining virtualized assembly code; Step 103: assembling the virtualized assembly code Copy to other application platforms and compile and run.
其中, 所述的虚拟指令集可以是本领域技术人员根据其编程习惯自行定 义, 但是需要满足以下基本条件: 所述虚拟指令集中至少有一条指令与汇 编指令集中的一条指令对应; 且所述虚拟指令集中的每一条指令为一个 C 语言编写的宏或函数, 包含至少一条 C语言指令。 现以 Intel x86汇编指令集及文法为例, 阐述本发明公开的一个虚拟指令 集及文法实施例, 但是本领域技术人员不应当将本实施例理解为对本发明 的限制, 申请人在此公开这一虚拟指令集目的在于教导本领域技术人员如 何去自行定义一套等同的虚拟指令集。  The virtual instruction set may be defined by a person skilled in the art according to its programming habit, but needs to satisfy the following basic conditions: at least one instruction in the virtual instruction set corresponds to one instruction in the assembly instruction set; and the virtual Each instruction in the instruction set is a macro or function written in C, containing at least one C language instruction. The virtual instruction set and the grammar embodiment disclosed by the present invention are now described by taking the Intel x86 assembly instruction set and the grammar as an example. However, those skilled in the art should not understand the present embodiment as a limitation of the present invention. A virtual instruction set aims to teach a person skilled in the art how to define a set of equivalent virtual instruction sets.
本领域技术人员知晓 Intel x86汇编语法实现的指令通用格式为: mstl opl或 inst2 opl,op2或 inst.3 o l ,op2,op3 , 其中 inst为 Intel x86汇编指令助 记符, 如 mov, add, and...。 op为操作码, 操作码可以是寄存器, 可以是 内存, 也可以是立即数。 virtuallnstname & flag? & ( & oprd? &:) namename Those skilled in the art are aware that the general format of the instruction implemented by the Intel x86 assembly syntax is: mstl opl or inst2 opl, op2 or inst.3 ol , op2, op3 , where inst is an Intel x86 assembly instruction mnemonic, such as mov, add, and .... Op is the opcode, the opcode can be a register, it can be either memory or immediate. Virtuallnstname & flag? & ( & oprd? &:) namename
flageflagsj? & type oprdreg |Flageflagsj? & type oprdreg |
Figure imgf000006_0001
Figure imgf000006_0001
eflagsn? & f Eflagsn? & f
typemem & num memb { w j d | q 11 { numO ! 112Typemem & num memb { w j d | q 11 { numO ! 112
aib|e|gjljo|p|c 对上述符号的解释如下; virti!ailnst:虚拟汇编指
Figure imgf000006_0002
Aib|e|gjljo|p|c The above symbols are explained as follows ; virti!ailnst: virtual assembly
Figure imgf000006_0002
reg:寄存器 Reg: register
ptr:内存指针 Ptr: memory pointer
imm:立即Imm: immediately
Figure imgf000006_0003
type:操作数类型
Figure imgf000006_0003
Type: operand type
mem:内存操作数类型 Mem: memory operand type
num:内存操作数在指令操作数第几位 (从零开始) Num: the number of memory operands in the instruction operand (from zero)
kbyte,字节 Kbyte, byte
w:word ?w:word ? word
d:dword, 双字 d:dword, double word
q:qword» 四字 q:qword» four words
t!tbyte, Αψ t!tbyte, Αψ
X:多媒体指令后缀 X: multimedia instruction suffix
a: above,无符号数大于 a: above, the unsigned number is greater than
b: below,无符号数小于 b: below, the unsigned number is less than
e:equa.l,等于 e:equa.l, equal
g:greater,有 号数:大于 g:greater, with number: greater than
l:less,有符号数小于 l:less, the number of symbols is less than
0: overflow, 操作溢出 0: overflow, operation overflow
p:panty5 最低有效字节比特位为 1的个数为偶数 p:panty 5 The least significant byte has an even number of bits
c: carry, 无符号数计算进位 c: carry, unsigned number calculation carry
? 为占位符, 例如下文 add— _d0 ( ) 中的 d或 0; &为连接符, 例如下文 add.. d0 C ) 中 add .与 (10连接为 add jiO形成一条完整的虛拟指令助记符。  ? As a placeholder, for example, d or 0 in add_ _d0 ( ); & is a connector, for example add_. d0 C ) add . and (10 is connected to add jiO to form a complete virtual instruction mnemonic .
有了以上虚拟指令集的定义,任意 tel x86指令均可以改写为虚拟指令。 现分别用三条不同类型加法指令说明上述转换原理; 其中, 通用力口法指令 add有如下形式: add reg, imm; add reg, reg; add reg, mem? add mem? imm; add mem, reg, 其影响的标志寄存器有 c, ά ' , z? S o reg: ¾r仔器, imm:_iL即数, mem; 円仔雙直。 With the definition of the above virtual instruction set, any tel x86 instruction can be rewritten as a virtual instruction. The above conversion principles are now explained by three different types of addition instructions; Among them, the generic force command add has the following form: add reg, imm; add reg, reg; add reg, mem? add mem? imm; add mem, reg, the flag register of its influence is c, ά ' , z ? S o reg: 3⁄4r, imm: _iL is the number, mem;
针对上述 Intd x86指令可定义如下不影响标志位的虚拟指令:  For the above Intd x86 instructions, the following virtual instructions can be defined that do not affect the flag bits:
add__dO(reg,imm) , add__dO(reg,reg) , add— d2(reg,mem), add— dl (mem, imm) , add dl(mem,reg)。 影响 z标志的虚拟指令为 s add__dO(reg,imm) , add__dO(reg,reg) , add— d2(reg,mem), add— dl (mem, imm) , add dl(mem,reg). The virtual instruction that affects the z flag is s
add— z— dO(reg,imiii), add__ z__dO(reg,reg) ? add— z— d2(reg,nieiii), add— z___dl(mem,imm) , add __z___d 1 (mem, reg) , add nz d0(reg,imm), add Add_ z— dO(reg,imiii), add__ z__dO(reg,reg) ? Add_ z— d2(reg,nieiii), add— z___dl(mem,imm) , add __z___d 1 (mem, reg) , add nz d0(reg,imm), add
nz___dO(reg,reg) , add__ nz__d2(reg,iiiem) , add__ nz___dl(meiii,imm) add— nz dl(mem,reg)。 Nz___dO(reg,reg) , add__ nz__d2(reg,iiiem) , add__ nz___dl(meiii,imm) add— nz dl(mem,reg).
影响其他标志位的虛拟指令依次类推。  Virtual instructions that affect other flag bits are analogous.
又如: Intel x86的浮点加法指令 fadd有如下形式: fadd reg, reg ; fadd mem32; fadd inem64, 其中 mem32为 32位存储器变量, mem64为 64位存 储器变量。 可对应定义出虚拟指令 fadd d0(reg,reg), fadd d】 (mem32) , fadd q 1 (mem64)。 上述各个虚拟指令实质是一个 C语言实现的宏或函数。 例如 Another example: Intel x86 floating-point addition instruction fadd has the following form: fadd reg, reg ; fadd mem32; fadd inem64, where mem32 is a 32-bit memory variable and mem64 is a 64-bit memory variable. The virtual instructions fadd d0(reg,reg), fadd d] (mem32) , fadd q 1 (mem64) can be defined accordingly. Each of the above virtual instructions is essentially a C-implemented macro or function. E.g
add d0(reg,imm)的 C语'言实 3¾为: #define add d0(reg,imm) reg imm。 Add d0 (reg, imm) C language 'speech 33⁄4 is: #define add d0(reg,imm) reg imm.
cc95 :  Cc95 :
mov edx,offset; Mov edx,offset;
Objplaiieparamsi  Objplaiieparamsi
lea edx,[edx+4*edi+0xl0]; Lea edx,[edx+4*edi+0xl0];
mov eax,dword ptr; Mov eax,dword ptr;
ds: [edx]; Ds: [edx];
mov eax.dword ptr ds: [eax]; movss; Mov eax.dword ptr ds: [eax]; movss;
xmm0,dword ptr ds: [ea:x*4+fp1anestartparams]; Xmm0,dword ptr ds: [ea:x*4+fp1anestartparams];
add dword ptr? Add dword ptr?
ds: [edx], 0x4; Ds: [edx], 0x4;
mov eax,dword ptr ds:[ebx+0xlc] ; Mov eax,dword ptr ds:[ebx+0xlc] ;
mov ecx, dword ptr; Mov ecx, dword ptr;
ds: [eax+OxOc] ι Ds: [eax+OxOc] ι
mov edx,dword ptr ds: [eax+OxlO]; Mov edx,dword ptr ds: [eax+OxlO];
sub edx, ecx; Sub edx, ecx;
sar; Sar
edx,0x3; Edx, 0x3;
cmp edi,edx; jnb cdd5 Cmp edi, edx; Jnb cdd5
mov edx.dwor l ptr? Mov edx.dwor l ptr?
ds: [edi*8+ecx] ; Ds: [edi*8+ecx] ;
mov eax.dword ptr ds:[edx+0xl4]; Mov eax.dword ptr ds:[edx+0xl4];
mov ecx,dword ptr? Mov ecx, dword ptr?
ds: [edx+0x4]; Ds: [edx+0x4];
neg eax; Neg eax;
inc edi; Inc edi;
add eax,dword ptr ss:[ebp-0x2c] ; Add eax,dword ptr ss:[ebp-0x2c] ;
imul Imul
eax,dword ptr ds: [edx+0x40] Eax,dword ptr ds: [edx+0x40]
sub eax,dword ptr ds:[edx+( O】; Sub eax,dword ptr ds:[edx+( O ];
cmp edi,dword? Cmp edi, dword?
ptr ds:[ebx+Ox】0] ;Ptr ds:[ebx+Ox]0] ;
Figure imgf000010_0001
Figure imgf000010_0001
movss dword ptr; Movss dword ptr;
ds: [eax*4+edx],xmm0? Ds: [eax*4+edx], xmm0?
jl short cc95 Jl short cc95
通过转换我们可以得到如下虚拟化汇编代码 5 cc95 : By conversion we can get the following virtualization assembly code 5 cc95 :
inov dO(edx, offs( addr(objplanepararns))); Inov dO(edx, offs( addr(objplanepararns)));
lea___d0(edx,edx+4* edi+Ox 10); mov__d2(eax,jiiem(edx)); Lea___d0(edx, edx+4* edi+Ox 10); Mov__d2(eax,jiiem(edx));
mov__d2(eax,___meni(eax)); Mov__d2(eax,___meni(eax));
and„d0(eax,0x000000 f); And„d0(eax,0x000000 f);
m_ovss— d2(xmm0,— m :eax*4+— uvai(fplanestartpararns))); add— d 1 (__mem(edx),0x4); M_ovss— d2(xmm0,— m :eax*4+— uvai(fplanestartpararns))); add— d 1 (__mem(edx), 0x4);
mov__d2(eax,___meri (ebx+0xl c)); Mov__d2(eax,___meri (ebx+0xl c));
mov___d2(ecx,_mem(eaxH- x0c)); Mov___d2(ecx,_mem(eaxH- x0c));
mov cl2 (eclx, mem(eax+Oxl 0)); Mov cl2 (eclx, mem(eax+Oxl 0));
sub__dO(edx,ecx); sub__dO(edx,ecx);
sar d0(edx,0x3); Sar d0(edx,0x3);
c.mp— nb— dO(edi ,edx) \ C.mp— nb— dO(edi , edx) \
jnb d0( cdd5 ); Jnb d0( cdd5 );
mov__d2 (edx,__mem(edi * 8 +ecx)) % Mov__d2 (edx, __mem(edi * 8 +ecx)) %
m o v d2 (eax , m em (edx+Ox】 4·)); m o v d2 (eax , m em (edx+Ox) 4·));
mov_il2(ecx,__mem(edx+0x4)); Mov_il2(ecx,__mem(edx+0x4));
neg dO(eax); Neg dO(eax);
inc___dO(edi); Inc___dO(edi);
add d2(eax, loc(ebp-0x2c))i Add d2(eax, loc(ebp-0x2c))i
ΐΐΊΊΐι12 d2(ea?¾:, rnem(edx+0x40)); ΐΐΊΊΐι12 d2(ea?3⁄4:, rnem(edx+0x40));
sub__d2(eax,__mem(edx+0 l 0)) ; Sub__d2(eax, __mem(edx+0 l 0));
cmp—— 1— d2(edi,——— mem(ebx+Oxl 0)·); Cmp—— 1—d2(edi, ——— mem(ebx+Oxl 0)·);
lea___d0(edx,esi*4-fecx); movss__dl(__mem(eax*4+edx),xmm0); jl d0( cc95 )? Lea___d0(edx, esi*4-fecx); Movss__dl(__mem(eax*4+edx),xmm0); jl d0( cc95 )?
当我们定义一套虚拟指令后, 便可实现汇编代码的虚拟化, 由于每条虚 拟化指令由 ANSI标准 C语言实现, 实现了应用程序的无源代码级移植。  When we define a set of virtual instructions, we can virtualize the assembly code. Since each virtualized instruction is implemented by the ANSI standard C language, the passive code level migration of the application is realized.
本发明并不局限于前述的具体实施方式。本发明扩展到任何在本说明书 中披露的新特征或任何新的组合, 以及披露的任一新的方法或过程的步骤 或任何新的组合。  The invention is not limited to the specific embodiments described above. The invention extends to any new feature or any new combination disclosed in this specification, as well as any novel method or process steps or any new combination disclosed.

Claims

权 利 要 求 书 Claim
1. 一种基于虚拟指令的应用程序移植方法, 其特征在于, 包括: A virtual instruction-based application porting method, comprising:
步骤 101 : 在 Windows系统中将应用程序转换为汇编代码; Step 101: Convert the application to assembly code on a Windows system;
步骤 102: 在 Windows系统中将汇编代码按照一套虚拟指令集的语法逐一转换为 对应的虚拟指令, 从而得到虚拟化的汇编代码; Step 102: In the Windows system, the assembly code is converted into corresponding virtual instructions one by one according to a set of virtual instruction set syntax, thereby obtaining virtualized assembly code;
步骤 103: 将所述虚拟化的汇编代码拷贝到其他应用平台上, 经过编译后运行; 所述虚拟指令集中至少有一条指令与汇编指令集中的一条指令对应;且所述虚拟 指令集中的每一条指令为一个 C语言编写的宏或函数,包含至少一条 C语言指令。 Step 103: Copy the virtualized assembly code to another application platform, and run it after compiling; at least one instruction in the virtual instruction set corresponds to one instruction in the assembly instruction set; and each piece in the virtual instruction set A directive is a macro or function written in C that contains at least one C language instruction.
2. 根据权利要求 1所述的一种基于虚拟指令的应用程序移植方法,其特征在于, 所述其他应用平台为 iOS系统或 Android系统。  2. The virtual instruction based application porting method according to claim 1, wherein the other application platform is an iOS system or an Android system.
3. 根据权利要求 1所述的一种基于虚拟指令的应用程序移植方法,其特征在于, 所述汇编指令集为 Intel x86汇编指令集。  3. The virtual instruction based application porting method according to claim 1, wherein the assembly instruction set is an Intel x86 assembly instruction set.
PCT/CN2014/073905 2013-07-25 2014-03-21 Application program transplantation method based on virtual instructions WO2015010479A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310316264.3 2013-07-25
CN2013103162643A CN103365665A (en) 2013-07-25 2013-07-25 Application program transplantation method based on virtual instruction

Publications (1)

Publication Number Publication Date
WO2015010479A1 true WO2015010479A1 (en) 2015-01-29

Family

ID=49367100

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/073905 WO2015010479A1 (en) 2013-07-25 2014-03-21 Application program transplantation method based on virtual instructions

Country Status (2)

Country Link
CN (1) CN103365665A (en)
WO (1) WO2015010479A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103365665A (en) * 2013-07-25 2013-10-23 成都品果科技有限公司 Application program transplantation method based on virtual instruction
CN104503819A (en) * 2015-01-05 2015-04-08 中国科学院计算技术研究所 Assembler for different operating systems (OSes) and assembly transplantation method
WO2017095257A1 (en) * 2015-12-04 2017-06-08 Huawei Technologies Co., Ltd. Automatic code virtualization for a compiler
CN108304188B (en) * 2016-08-25 2021-11-26 平安科技(深圳)有限公司 Data type conversion method and terminal
CN106371809B (en) * 2016-08-31 2019-03-01 北京奇虎科技有限公司 Thread processor and thread processing method
CN109189470A (en) * 2018-08-21 2019-01-11 北京奇虎科技有限公司 Code reinforcement means and device
CN112130859A (en) * 2019-06-25 2020-12-25 深信服科技股份有限公司 Application operation method, device, equipment and storage medium
CN115688708A (en) * 2023-01-03 2023-02-03 江西曼荼罗软件有限公司 Medical record editor control method and system suitable for various operating systems

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5946487A (en) * 1996-06-10 1999-08-31 Lsi Logic Corporation Object-oriented multi-media architecture
CN1265488A (en) * 2000-03-06 2000-09-06 周大凯 Program executing method
CN101000557A (en) * 2006-01-13 2007-07-18 北京金远见电脑技术有限公司 Virtual machine
CN101593127A (en) * 2008-05-27 2009-12-02 商埃曲网络软件(上海)有限公司 A kind of cross-platform Jave virtual machine of Digital Television middleware system
CN101641690A (en) * 2007-01-22 2010-02-03 E3网络股份有限公司 Be used to generate the method and the middleware platform engine thereof of cross platform program
CN103365665A (en) * 2013-07-25 2013-10-23 成都品果科技有限公司 Application program transplantation method based on virtual instruction

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070006178A1 (en) * 2005-05-12 2007-01-04 Microsoft Corporation Function-level just-in-time translation engine with multiple pass optimization
CN100462922C (en) * 2007-11-01 2009-02-18 上海交通大学 Binary translation method using intermediate command set

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5946487A (en) * 1996-06-10 1999-08-31 Lsi Logic Corporation Object-oriented multi-media architecture
CN1265488A (en) * 2000-03-06 2000-09-06 周大凯 Program executing method
CN101000557A (en) * 2006-01-13 2007-07-18 北京金远见电脑技术有限公司 Virtual machine
CN101641690A (en) * 2007-01-22 2010-02-03 E3网络股份有限公司 Be used to generate the method and the middleware platform engine thereof of cross platform program
CN101593127A (en) * 2008-05-27 2009-12-02 商埃曲网络软件(上海)有限公司 A kind of cross-platform Jave virtual machine of Digital Television middleware system
CN103365665A (en) * 2013-07-25 2013-10-23 成都品果科技有限公司 Application program transplantation method based on virtual instruction

Also Published As

Publication number Publication date
CN103365665A (en) 2013-10-23

Similar Documents

Publication Publication Date Title
WO2015010479A1 (en) Application program transplantation method based on virtual instructions
JP6569969B2 (en) Processor, method, program, and machine-readable recording medium
JP6227621B2 (en) Method and apparatus for fusing instructions to provide OR test and AND test functions for multiple test sources
JP6207575B2 (en) Processor, method and processing system
CN107092465B (en) Instruction and logic for providing vector blending and permutation functions
KR101748535B1 (en) Methods, apparatus, instructions and logic to provide vector population count functionality
KR101411064B1 (en) Method and apparatus for performing a shift and exclusive or operation in a single instruction
JP5736028B2 (en) Add instruction to add 3 source operands
KR101775294B1 (en) Methods, apparatus, instructions and logic to provide population count functionality for genome sequencing and alignment
CN113032012B (en) Apparatus for low energy accelerator processor architecture
JP6498226B2 (en) Processor and method
US20220027154A1 (en) Addition instructions with independent carry chains
JP2014130580A (en) Instructions and logic to vectorize conditional loops
TW201339962A (en) Floating point rounding processors, methods, systems, and instructions
EP3651019A3 (en) Systems and methods for performing instructions to convert to 16-bit floating-point format
JP2014530426A (en) Instructions and logic to provide vector load and vector store with stride and mask functions
US20220206805A1 (en) Instructions to convert from fp16 to bf8
US20220206743A1 (en) Instructions to convert from fp16 to bf8
US9811338B2 (en) Flag non-modification extension for ISA instructions using prefixes
Lee Assembly
TWI773654B (en) Processor, computing system and method for performing vector-based bit manipulation
EP4109247A1 (en) Apparatuses, methods, and systems for instructions for matrix multiplication instructions
JP6231155B2 (en) Instructions and logic for providing vector scattering calculation function and vector collection calculation function

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14830360

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 02.08.2016)

122 Ep: pct application non-entry in european phase

Ref document number: 14830360

Country of ref document: EP

Kind code of ref document: A1