Stack Types and Instructions
2015-05-28 07:20
288 查看
The ARM supports four different stack implementations. These are categorised by two axes, namely Ascending versus Descending and Empty versus Full.
An Ascending stack grows upwards. It starts from a low memory address and, as items are pushed onto it, progresses to higher memory addresses.
A Descending stack grows downwards. It starts from a high memory address, and as items are pushed onto it, progresses to lower memory addresses. The previous examples have been of a Descending stack.
In an Empty stack, the stack pointers points to the next free (empty) location on the stack, i.e. the place where the next item to be pushed onto the stack will be stored.
In a Full stack, the stack pointer points to the topmost item in the stack, i.e. the location of the last item to be pushed onto the stack.
As matching these four distinct stack implementations to multiple-register loads and stores has the potential for confusion, the ARM assembly language has specific stack manipulation instructions that indicate through their mnemonic the type of stack involved.
These stack manipulation instructions should be used in preference to the standard multiple-register load and store instructions. However, all of the stack manipulation instructions can be mapped to standard forms:
References:
http://www-mdp.eng.cam.ac.uk/web/library/enginfo/mdp_micro/lecture5/lecture5-4-2.html
An Ascending stack grows upwards. It starts from a low memory address and, as items are pushed onto it, progresses to higher memory addresses.
A Descending stack grows downwards. It starts from a high memory address, and as items are pushed onto it, progresses to lower memory addresses. The previous examples have been of a Descending stack.
In an Empty stack, the stack pointers points to the next free (empty) location on the stack, i.e. the place where the next item to be pushed onto the stack will be stored.
In a Full stack, the stack pointer points to the topmost item in the stack, i.e. the location of the last item to be pushed onto the stack.
As matching these four distinct stack implementations to multiple-register loads and stores has the potential for confusion, the ARM assembly language has specific stack manipulation instructions that indicate through their mnemonic the type of stack involved.
STMEA | r13!, {r0-r2} | ; Push data onto an Empty Ascending Stack |
LDMEA | r13!, {r0-r2} | ; Pop data off an Empty Ascending Stack |
STMED | r13!, {r0-r2} | ; Push data onto an Empty Descending Stack |
LDMED | r13!, {r0-r2} | ; Pop data off an Empty Descending Stack |
STMFA | r13!, {r0-r2} | ; Push data onto a Full Ascending Stack |
LDMFA | r13!, {r0-r2} | ; Pop data off a Full Ascending Stack |
STMFD | r13!, {r0-r2} | ; Push data onto a Full Descending Stack |
LDMFD | r13!, {r0-r2} | ; Pop data off a Full Descending Stack |
Stack | Standard | Type |
STMFA | STMIB | Pre-increment store |
STMEA | STMIA | Post-increment store |
STMFD | STMDB | Pre-decrement store |
STMED | STMDA | Post-decrement store |
LDMED | LDMIB | Pre-increment load |
LDMFD | LDMIA | Post-increment load |
LDMEA | LDMDB | Pre-increment load |
LDMFA | LDMDA | Pre-increment load |
http://www-mdp.eng.cam.ac.uk/web/library/enginfo/mdp_micro/lecture5/lecture5-4-2.html
相关文章推荐
- 6 important .NET concepts: - Stack, heap, Value types, reference types, boxing and Unboxing.
- .net中6个重要的基础概念:Stack, heap, Value types, reference types, boxing and Unboxing.
- 6 important .NET concepts: - Stack, heap, Value types, reference types, boxing and Unboxing.
- [转载 收藏]6 important .NET concepts: - Stack, heap, Value types, reference types, boxing and Unboxing.
- .Net的六个重要概念:Stack, heap, value types, reference types, boxing, and unboxing
- 6 important .NET concepts: - Stack, heap, Value types, reference types, boxing and Unboxing.
- 6 important .NET concepts: - Stack, heap, Value types, reference types, boxing and Unboxing
- difference between stack and heap
- Effective C# Item 6: Distinguish Between Value Types and Reference Types
- 《程序员面试题精选》02.Stack and minimum element in O(1)
- ZStack Monitor and Test(MT)功能简介与Z-tool使用介绍
- [TypeScript] Union Types and Type Aliases in TypeScript
- Foundations of Object-Oriented Languages: Types and Semantics
- TaskStackBuilder and extras for the back stack
- DNS Record Format and Types
- Professional SQL Server 2005 CLR Programming: with Stored Procedures, Functions, Triggers, Aggregates and Types
- [TypeScript] Query Properties with keyof and Lookup Types in TypeScript
- 检查类修饰符和类型(Examining Class Modifiers and Types)
- Java 的stack and heap
- c++primer学习笔记(1)-primitive buit-in types and type conversions