+ -
当前位置:首页 → 问答吧 → 跳转指令的问题

跳转指令的问题

时间:2011-10-22

来源:互联网

跳转指令很多种,我用jxx表示,当我用嵌套汇编编写的时候,如jxx _ZCBranchNotTaken;是编不过的。
我想问问,怎样构造自己的指令,才能达到入jz _ZCBranchNotTaken;的效果,jz只是jxx的一种
Assembly code

_asm
                    {
                        // set the current flags to EFLAGS
                        // simulate the branch jumping situation.
                        pushf ; // Push current EFLAGS.
                        push eax;

                        push dword ptr [eflags];
                        popf ; // the EFLAGS is set to eflags.

                        $jxx _ZCBranchNotTaken; // jxx denotes jz,jg,...
_ZCBranchTaken:    
                        mov byte ptr [bBranchTaken], 0;
_ZCBranchNotTaken: 
                        mov byte ptr [bBranchTaken], 1;

                        pop eax;
                        popf ; // Pop EFLAGS, restore the old register.
                    }

作者: into_the_wild   发布时间: 2011-10-22

这个的目的是模拟分支跳转指令,把传入的EFLAGS赋给当前寄存器,然后使用传入的指令模拟Jxx

作者: into_the_wild   发布时间: 2011-10-22