diff options
Diffstat (limited to 'ports/sysdeps/arm/sysdep.h')
-rw-r--r-- | ports/sysdeps/arm/sysdep.h | 17 |
1 files changed, 17 insertions, 0 deletions
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. */ |