ARM - Implementing stack with load/store multiple register values -


this pretty basic question related implementation of stacks in arm , other register-based machines. ldm , stm commands can used move multiple values between memory , group of general purpose registers stack operation or block copy. ldm or stm operations don't appear alter rules of how can implement stacks , reduce length of code required perform multiple transfers (e.g., common transfers of multiple register contents @ start , end of functions). however, it's unclear whether loaded registers behave stack after values loaded memory.

i'm bit confused whether stacks implemented in external memory, registers, or combination of two.

thanks in adv!

the stack memory. processors special internal memory memory, nothing more stack pointer register points system memory , programmers (operating system and/or application) make sure stack pointer doesnt point @ memory being used else.

the idea have limited set of registers, if have more enough registers there may times example want recursion or other such thing requires re-use registers being used else. stack provides simple/fast malloc , free temporary storage of things, registers or local variables or return addresses or whatever need store temporarily.

why use stack instead of ram or registers if have many, stack can mentioned example recursion, can enter same code several/hundreds of times , code example have local variables , keep track of of individual instances of each local variable, hundreds of copies if need be. because way use stack relative stack pointer, dont have hardcoded address have hardcoded reference stack pointer, if enter function 1 time , stack pointer happens @ 0x1000 first variable might @ 0x1000 , second @ 0x1004, example, function may "add" 16 bytes of information stack , call itself, time when enters stack pointer @ 0xff0, , first variable @ 0xff0 , second @ 0xff4, , on until stack pointer collides else or done.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -