我有一个基础的问题 [英] i have a based question
本文介绍了我有一个基础的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这本书描述了推送:
The book described the Push:
因此,将双字值压入堆栈需要先减小
堆栈指针减4,然后将值写入新的堆栈地址顶部.因此,说明
pushl%ebp与以下指令对具有相同的行为:
subl $ 4 ,%esp
movl%ebp,(%esp)
Pushing a double-word value onto the stack therefore involves first decrementing the
stack pointer by 4 and then writing the value at the new top of stack address. Therefore, the instruction
pushl %ebp has equivalent behavior to the following pair of instructions:
subl $4,%esp
movl %ebp,(%esp)
我只想知道为什么4而不是2 8?
请给我一些建议.
谢谢
I just want to know why 4 , not 2, 8?
Please give me some advices.
Thank you
推荐答案
4 ,%esp
movl%ebp,(%esp)
4,%esp
movl %ebp,(%esp)
我只想知道为什么4而不是2、8?
请给我一些建议.
谢谢
I just want to know why 4 , not 2, 8?
Please give me some advices.
Thank you
这是4,因为本书所引用的处理器使用的是标准"尺寸.
字是两个字节,因此双字是4个字节.
因此,为了在堆栈上留出空间,必须将指针减少4个字节-双字的大小.
It is 4 because the processor that the book was referencing used ''standard'' sizes.
A word is two bytes and a double-word is therefore 4 bytes.
Therefore to allow room on the stack the pointer has to be decreased by 4 bytes - the size of a double-word.
因为long
(至少在32
位上)机器)的长度为4
个字节...
:)
Because along
(at least on a32
bit machine) is4
bytes long...
:)
这篇关于我有一个基础的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文