ICC inline assembler doesn`t like push/pop

北战南征 提交于 2019-12-11 05:16:48

问题


I try to excute assembler inline with icc in msasm:

int main (void)
{
  __asm{
    mov eax, 5h;  //works
    push eax;     // after shell command /opt/intel/bin/icc -use_msasm asm.c:
                  // asm.c(7): (col. 5) error: Unsupported instruction form in asm                          
                  // instruction push.

   //pop ebp;    // the same 
        };

printf("success!\n");
return 1;
}

Does anybody know why icc doesn`t accept push and pop?

Thanks in advance!


回答1:


You should use x64 version of registers instead. So the correct version should like this:

__asm{
    mov rax, 5h;
    push rax;
};

Also, pay attention to architecture differences when dealing with pointers, 0x8*******, etc. You should never use batch Find and Replace without reading your inline first.



来源:https://stackoverflow.com/questions/8834423/icc-inline-assembler-doesnt-like-push-pop

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!