Why is it not possible to push a byte onto a stack on Pentium IA-32?

前端 未结 4 1829
不知归路
不知归路 2020-12-03 14:43

I\'ve come to learn that you cannot push a byte directly onto the Intel Pentium\'s stack, can anyone explain this to me please?

The reason that I\'ve been given is b

4条回答
  •  甜味超标
    2020-12-03 15:03

    Its based on how the stack was created:

    The address-size attribute of the stack segment determines the stack pointer size (16, 32 or 64 bits). The operand-size attribute of the current code segment determines the amount the stack pointer is decremented (2, 4 or 8 bytes).

    In non-64-bit modes: if the address-size and operand-size attributes are 32, the 32-bit ESP register (stack pointer) is decremented by 4. If both attributes are 16, the 16-bit SP register (stack pointer) is decremented by 2.

    Source: http://www.intel.com/Assets/PDF/manual/253667.pdf

    pg. 4-320 Vol. 2B

    Edit

    Just wanted to point out also that an interesting read is the section on stacks in the manual, it will explain creating a stack segment further.

    http://www.intel.com/Assets/PDF/manual/253665.pdf

    Chapter 6.2

提交回复
热议问题