Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Confused about an ARM instruction

Tags:

arm

I can't figure out what this ARM instruction does:

strd.w          r0, r1, [r2]

I know that it is a store instruction which stores something at *r2 but I'm not entirely sure what. Why are there two source registers (r0 and r1) and what does the d.w suffix mean?

like image 803
Kristina Brooks Avatar asked Nov 22 '11 19:11

Kristina Brooks


People also ask

Do all ARM processors use the same instruction set?

Most ARM processors support two or even three different instruction sets, while some (for example, the Cortex-M3 processor) do not in fact execute the original ARM instruction set. There are at least two instruction sets that ARM processors can use. This is the original ARM instruction set.

What is the difference between ARM Thumb and Thumb instruction?

One Thumb instruction can be fetched on each cycle, whereas each 32-bit ARM instruction requires two clock cycles per fetch. When executing a Thumb instruction, the PC reads as the address of the current instruction plus 4. The only 16-bit Thumb instructions which can directly modify the PC are certain encodings of MOV and ADD.

What are the features of the ARM instruction set?

Main features of the ARM Instruction Set All instructions are 32 bits long. Most instructions execute in a single cycle. Most instructions can be conditionally executed. A load/store architecture Data processing instructions act only on registers Three operand format

How does arm increase the number of instructions in an instruction?

Most instruction sets only allow branches to be executed conditionally. However by reusing the condition evaluation hardware,  ARM effectively increases number of instructions. All instructions contain a condition field which determines whether the CPU will execute them.


1 Answers

This function stores the 64-bit contents of two 32-bit registers into memory. The 8-byte chunk is stored starting at the address held in r2. The first four bytes come from r0, the second four bytes from r1.

Roughly equivalent C would be:

int32 *ptr=(int32 *) r2;
*(ptr) = r0;
*(ptr+1) = r1; // 'ptr+1' adds four bytes to the memory position
like image 53
David Schwartz Avatar answered Sep 28 '22 07:09

David Schwartz