Subject: *TODO* Document the pseudo-ops (adr, ops)

From: "Zach Welch" <[email-masked]>
Date: Tue, 25 Apr 2000 11:37:58 -0700

Howdy,

I'm working to port Linux to our SA-1100 platform and having been delving
into the arch/arm/kernel source pretty heavily. In my pursuit, I ran across
the 'adr' opcode several times. Being unfamiliar with the opcode, I looked
through the 'info' page only to discover the following message:

*TODO* Document the pseudo-ops (adr, ops)

Could someone please enlighten me?

Thanks,

Zach Welch
Firmware Architect
At Work Computers
www.atworkcom.com

unsubscribe: body of `unsubscribe linux-arm' to [email-masked]
++        Please use [email-masked] for           ++
++                        kernel-related discussions.                      ++

---

From: Philip Blundell <[email-masked]>
Date: Tue, 25 Apr 2000 20:35:32 +0100

>*TODO* Document the pseudo-ops (adr, ops)

"adr rN, label" loads the (run-time) address of `label' into rN.  It 
actually translates to "add rN, pc, #(label - . - 8)" or something similar.

p.

---

From: Nicolas Pitre <[email-masked]>
Date: Tue, 25 Apr 2000 15:42:23 -0400 (EDT)

> I'm working to port Linux to our SA-1100 platform and having been delving

I hope you didn't start from scratch.  Generic SA1100 support is already
available with extra patches.

> through the 'info' page only to discover the following message:

The adr opcode is in fact a macro that loads the address of a symbol by
adding a distance value to the program counter.

	ldr	r0, foo		@ loads the word labeled 'foo'
	adr	r0, foo		@ loads the address where 'foo' actually is

I think it expands into:

	add	r0, pc, #(foo - . - 8)

Nicolas

---

From: Russell King - ARM Linux Admin <[email-masked]>
Date: Tue, 25 Apr 2000 20:37:32 +0100 (BST)

> *TODO* Document the pseudo-ops (adr, ops)

"adr rd, sym" equates to either an "add rd, pc, #constant" or
"sub rd, pc, #constant" such that "rd" ends up being the address of "sym".
   _____
  |_____| ------------------------------------------------- ---+---+-
  |   |        Russell King       [email-masked]      --- ---
  | | | |            http://www.arm.linux.org.uk/            /  /  |
  | +-+-+                                                     --- -+-
  /   |               THE developer of ARM Linux              |+| /|\
 /  | | |                                                     ---  |
    +-+-+ -------------------------------------------------  /\\\  |