1

I am attempting to disassemble some ARM machine code. The ARM Instruction Set defines the Block Data Transfer instructions (LDM and STM) as below, used for loading and storing to multiple registers at once.

There are two types of addressing modes: for stacks or for other purposes. Maybe I'm not understanding something correctly, but I dont see a way to determine which type an instruction is using from looking at the machine code.

Does it even matter on the CPU level, and is just a feature to make the assembly programmer's life easier? Since for example LDMFD and LDMIA are equivalent operations (I think?).

enter image description here

enter image description here

enter image description here

1
  • 1
    ldmfd stands for "load multiple full decreasing" (this is the stack-viewpoint: the register Rn contains a pointer to a stack, "decreasing" means that stack is growing to lower addresses, and "full" means that the element Rn points to is on the stack (the "top" of the stack)), and ldmfd takes a set of values off the stack. ldmia stands for "load multiple increase afterwards" and loads several registers from the address in Rn increasing Rn after (each) load. Both are the same, just different points of view.
    – j.p.
    Jun 24, 2015 at 8:42

1 Answer 1

2

From the ARM manual:

LDM and LDMFD are synonyms for LDMIA. LDMFD refers to its use for popping data from Full Descending stacks.

LDMEA is a synonym for LDMDB, and refers to its use for popping data from Empty Ascending stacks.

STM and STMEA are synonyms for STMIA. STMEA refers to its use for pushing data onto Empty Ascending stacks.

STMFD is s synonym for STMDB, and refers to its use for pushing data onto Full Descending stacks.

So yes, these are synonyms, confirmed by the manufacturer.

1
  • I didn't realize j.p. had already submitted his comment, which says essentially the same, when i posted my answer. Jun 24, 2015 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.