Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #21700

Re: Question about ARM instruction: STMIA / STMEA

From Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP>
Newsgroups comp.arch.embedded
Subject Re: Question about ARM instruction: STMIA / STMEA
Date 2015-08-07 11:52 +0000
Organization A noiseless patient Spider
Message-ID <mq265k$g57$1@dont-email.me> (permalink)
References <5f1e3e48-3b23-4d32-a5f9-a38731a91c9b@googlegroups.com>

Show all headers | View raw


On 2015-08-06, Robert Willy <rxjwg98@gmail.com> wrote:
> Hi,
>
> When I read ARM Thumb2 instruction manual, I find a problem on 
> STMIA / STMEA.
>
> It said: "Store Multiple Increment After (Store Multiple Empty Ascending)
>  stores multiple registers to consecutive memory locations using an address
>  from a base register."
>
> Does that mean STMIA is equivalent to STMEA?
>

I don't use ascending stacks, or the *EA instruction variants, so you
need to check this yourself with objdump (or the equivalent tool in
your toolchain) but I suspect you will find they generate the same opcode.

> Then, when I try to find the answer online, I have more questions on this
> topic. Below the dot line is from Keil website. Although it gives more
> explanation, I don't understand it, especially Table 4.5 and 4.6.
>
> For example, on Table 4.5, there is one row has content:
>
> FD (Full Descending stack)	DB (Decrement Before)	IA (Increment After)
>
> I don't see the relationship between 'DB' and 'IA'. Could you explain it
> to me a little more?
>

You use the first one (STMDB) to push onto the stack and you use the
second one (LDMIA) to pop from the stack.

Read the section you quoted again, but thinking about how the address
of the next available slot on the stack varies depending depending on
the stack model in use and then you will realise they complement each
other.

If it helps, draw out on paper how the stack contents (and stack pointer)
change after each instruction variant and think about how this allows
you to store data to, and recover data from, the stack.

Simon.

-- 
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Microsoft: Bringing you 1980s technology to a 21st century world

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Question about ARM instruction: STMIA / STMEA Robert Willy <rxjwg98@gmail.com> - 2015-08-06 15:42 -0700
  Re: Question about ARM instruction: STMIA / STMEA Simon Clubley <clubley@remove_me.eisner.decus.org-Earth.UFP> - 2015-08-07 11:52 +0000
    Re: Question about ARM instruction: STMIA / STMEA Theo Markettos <theom+news@chiark.greenend.org.uk> - 2015-08-07 19:12 +0100
  Re: Question about ARM instruction: STMIA / STMEA Nobody <nobody@nowhere.invalid> - 2015-08-08 02:46 +0100
  Re: Question about ARM instruction: STMIA / STMEA Robert Willy <rxjwg98@gmail.com> - 2015-08-08 15:39 -0700
    Re: Question about ARM instruction: STMIA / STMEA Richard Damon <Richard@Damon-Family.org> - 2015-08-08 19:56 -0400

csiph-web