Full stack with empty stack __ embedded

Source: Internet
Author: User

When it comes to arm instruction, it is possible to distort the meaning of the full stack and the empty stack literally. Imagine, "full stack" is a full stack, can no longer store data, and "Empty stack" is an empty stack, no use of the stack, hehe, so understand that it is wrong.

In fact, "full stack" and "empty stack" should be "full stack" or "Empty stack", we are just accustomed to the stack called stack. The deep meaning of the two is "position" or "address", not "stack". It's easier to understand if you call it "full position" or "empty position." The following is an explanation given in the "ARM embedded system development-software design and optimization" book:

full Stack, "F", refers to the last used address or full position of the stack pointer to the stack (that is, the SP points to the last data item position on the stack).

an empty stack (empty stack, "E") refers to the first unused address or empty location that the SP points to the stack (that is, the SP points to the next location on the last data item in the stack).

the keyword on the full stack is the last used address, and the empty stack is the first unused address.

The ARM architecture uses multiple register instruction Load-store to complete the stack operation. Add the suffix FA, FD, EA, ED (f-full position, E-null position, increment, D-decrement) to indicate how the SP pointer is addressed, as the FA indicates an increment of full.

Here are two examples of the "ARM embedded system development-software design and optimization" book, but the first example seems to be faulty. Will sp=0x00080014 written in 0x00000004, here to correct over. 1 examples show full stack, 2 examples illustrate the empty stack.

Example 1

PRE

R1 = 0x00000002

R4 = 0x00000003

SP = 0x00080014

Stmfd sp!, {r1, R4}

POST

R1 = 0x00000002

R4 = 0x00000003

SP = 0x0008000c

Example 2

PRE

R1 = 0x00000002

R4 = 0x00000003

SP = 0x00080010

Stmfd sp!, {r1, R4}

POST

R1 = 0x00000002

R4 = 0x00000003

SP = 0x00080008

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.