1

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!

snoere
  • 11
  • 3
  • 1
    In 64bit mode, `push <32bit-reg>` is undefined (`push` and `pop` always operate on an entire register, i.e. whether the operation is `PUSH AX`, `PUSH EAX` or `PUSH RAX` depends only on the current default operand size - to the CPU, the instruction/opcode is the same). – FrankH. Jun 25 '12 at 15:11
  • @FrankH. 16-bit push is always available (in all modes), but 64-bit mode can't use 32-bit push. i.e. the 66h operand-size prefix works, but REX.W=0 doesn't override the default from 64 down to 32. [How many bytes does the push instruction push onto the stack when I don't specify the operand size?](https://stackoverflow.com/q/45127993) – Peter Cordes Jul 19 '18 at 08:37

1 Answers1

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.