krb
krb

Reputation: 16315

Confused about an ARM instruction

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?

Upvotes: 5

Views: 3183

Answers (1)

David Schwartz
David Schwartz

Reputation: 182761

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

Upvotes: 11

Related Questions