关于push指令实现的细节
Closed this issue · 1 comments
ybC007 commented
有个疑问是关于PA-4-1中的 push %esp
指令,如果要运行成功,那么压入栈中的需要是旧的 esp
,可是按照手册的说法,压入栈中的是已经改变过的的 esp
手册上关于 push
指令的描述为
PUSH decrements the stack pointer by 2 if the operand-size attribute of the instruction is 16 bits; otherwise, it decrements the stack pointer by 4. PUSH then places the operand on the new top of stack, which is pointed to by the stack pointer.
意思应该是先改变esp
的值,再把源操作数的值放入新的esp指向的地方。
ics-nju-wl commented
手册上讲的是push对应的esp的操作,但是被压入栈中的操作数应该是esp的旧值