How can i pass parameters in assembler x86 function call

前端 未结 3 1407

Look at this assembler code. It is designed for 32 bits x86 and will be compiled by nasm

   ...
   my_function:
        pop %eax
        ...
        ret


           


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-06 06:00

    In Addition to David answers, this is another example

    push 0       ; fourth parameter
    push 4       ; third parameter
    push 4       ; second parameter
    push [eax]   ; first parameter
    call printf
    

    Same in C or C++ as

    somefunction(first,second,third,fourth);
    

提交回复
热议问题