简体   繁体   English

PUSH eax和mov [esp],eax之间的区别?

[英]Differences between PUSH eax and mov [esp], eax?

What is the difference between the two lines 两条线之间有什么区别

push eax

mov [esp], eax

Doesn't push eax on to the stack (where esp is pointing to just as mov [esp], eax does?) 是不是将eax推入堆栈(esp指向的是mov [esp],eax呢?)

"push" will automatically bump the value of "esp" (your stack pointer). “push”会自动碰到“esp”(你的堆栈指针)的值。 The "mov" won't. “mov”不会。 So i if you wanted to put multiple items on the stack, with push , you just do: 所以如果你们希望把多个项目的堆栈中, push ,你只是做:

push eax
push ebx
...

With mov , to get the same results, you'd have: 使用mov ,为了获得相同的结果,您将拥有:

sub  esp,4
mov  [esp], eax
sub  esp,4
mov  [esp], ebx
...

And the nice thing about push is that there is the reverse operation, pop which allows you to pull things back off in reverse order. 关于push是有反向操作, pop允许你以相反的顺序拉回来。 Which is, of course, what a stack is all about. 当然,这就是堆栈的全部内容。 :) :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM