summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2005-06-02 05:34:08 +0000
committermarcel <marcel@FreeBSD.org>2005-06-02 05:34:08 +0000
commit97c723a3888a929368ae97542a3cdc41399a4e3f (patch)
tree41b43691c8e12ec4b07e58d30f244c2be4f25bcd /libexec
parentf881572c38f379b576078f99b85171fdcb3ef5f0 (diff)
downloadFreeBSD-src-97c723a3888a929368ae97542a3cdc41399a4e3f.zip
FreeBSD-src-97c723a3888a929368ae97542a3cdc41399a4e3f.tar.gz
Fix the load64 and store64 macros, created to handle 8-byte unaligned
loads and stores (resp.) The ldq_u and stq_u instruction mask off the lower 3 bits of the final address before loading from or storing to the address, so as to avoid unaligned loads and stores. They do not themselves allow loads from or stores to unaligned addresses. Replace the macro definitions by a packed struct dereference. Submitted by: Richard Henderson (rth at twiddle dot net)
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/alpha/reloc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libexec/rtld-elf/alpha/reloc.c b/libexec/rtld-elf/alpha/reloc.c
index 1ec66ca..74aaf9c 100644
--- a/libexec/rtld-elf/alpha/reloc.c
+++ b/libexec/rtld-elf/alpha/reloc.c
@@ -58,13 +58,13 @@ extern Elf_Dyn _GOT_END_;
* We don't use these when relocating jump slots and GOT entries,
* since they are guaranteed to be aligned.
*/
-#define load64(p) ({ \
- Elf_Addr __res; \
- __asm__("ldq_u %0,%1" : "=r"(__res) : "m"(*(p))); \
- __res; })
-#define store64(p, v) \
- __asm__("stq_u %1,%0" : "=m"(*(p)) : "r"(v))
+struct ualong {
+ Elf_Addr x __attribute__((packed));
+};
+
+#define load64(p) (((struct ualong *)(p))->x)
+#define store64(p,v) (((struct ualong *)(p))->x = (v))
/* Relocate a non-PLT object with addend. */
static int
OpenPOWER on IntegriCloud