What is the growth direction of the program stack?

I read Professional Assembly Language by Richard Blum, and I am confused about the inconsistencies in the book, and I wonder what exactly is the direction of the growth of the program stack? This is an image from page 312 that says the program stack is growing.

enter image description here

But when I reached page 322, I see another version that suggests that the software package is growing. enter image description here

and this one

enter image description here

+2
source share
4 answers

The book is not inconsistent; each picture shows the top addresses at the top.

, . , . . , , .

+4

, , , .

, . , . MacOS OSX , , .

0

:

. TMS Piccolo , "PUSH" . , , . ARM- 4 , , .

x86:

x86- ALWAYS , "PUSH" ; .

, (s > ) . , ( -16 (% ebp)). , 312 .

- -

"PUSH", . , "PUSH" (, PowerPC ARM ARM-THUMB), .

0

( ) . (, PowerPC) HW-. , : Pre-incrementing, post-incrementing. - -.

PPC , , .

PPC 2 - " " . , - .

pre-increment: the stack pointer is incremented until the last stack item in the push stack pointer is stored. It can be seen in several stranger 8-bit architectures (some fourth processors, etc.).

post-incrementing: saving is performed before the stack pointer increment - the stack pointer points to the first element of the free stack.

before and after decrements: similarly higher, but the stack grows down (more often).

The most common is post-decrement.

0
source

Source: https://habr.com/ru/post/1524587/


All Articles