From cd24e113c38e81c15a72536a99062373d5701389 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 13 Feb 2013 21:21:39 -0800 Subject: arm: Introduce and use LDST_PCREL Macro-ising the few instances where we need to distinguish between arm and thumb pc-relative memory operations. --- ports/sysdeps/arm/sysdep.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ports/sysdeps/arm') diff --git a/ports/sysdeps/arm/sysdep.h b/ports/sysdeps/arm/sysdep.h index 4af7429ac9..29a78f043d 100644 --- a/ports/sysdeps/arm/sysdep.h +++ b/ports/sysdeps/arm/sysdep.h @@ -117,6 +117,23 @@ the caller. */ .eabi_attribute 24, 1 +/* Load or store to/from a pc-relative EXPR into/from R, using T. */ +# ifdef __thumb2__ +# define LDST_PCREL(OP, R, T, EXPR) \ + ldr T, 98f; \ + .subsection 2; \ +98: .word EXPR - 99f - PC_OFS; \ + .previous; \ +99: add T, T, pc; \ + OP R, [T] +# else +# define LDST_PCREL(OP, R, T, EXPR) \ + ldr T, 98f; \ + .subsection 2; \ +98: .word EXPR - 99f - PC_OFS; \ + .previous; \ +99: OP R, [pc, T] +# endif #endif /* __ASSEMBLER__ */ /* This number is the offset from the pc at the current location. */ -- cgit 1.4.1