Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/lib/libunwind SH3 uses unaligned data in the .eh_frame s...



details:   https://anonhg.NetBSD.org/src/rev/69bb6e5d592c
branches:  trunk
changeset: 328415:69bb6e5d592c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Wed Apr 02 22:22:37 2014 +0000

description:
SH3 uses unaligned data in the .eh_frame section, so use memcpy.

diffstat:

 sys/lib/libunwind/AddressSpace.hpp |  24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diffs (37 lines):

diff -r fa4c3efc9c74 -r 69bb6e5d592c sys/lib/libunwind/AddressSpace.hpp
--- a/sys/lib/libunwind/AddressSpace.hpp        Wed Apr 02 20:27:28 2014 +0000
+++ b/sys/lib/libunwind/AddressSpace.hpp        Wed Apr 02 22:22:37 2014 +0000
@@ -69,13 +69,29 @@
     pthread_rwlock_init(&fdeTreeLock, NULL);
   }
 
-  uint8_t get8(pint_t addr) { return *((uint8_t *)addr); }
+  uint8_t get8(pint_t addr) {
+    uint8_t val;
+    memcpy(&val, (void *)addr, sizeof(val));
+    return val;
+  }
 
-  uint16_t get16(pint_t addr) { return *((uint16_t *)addr); }
+  uint16_t get16(pint_t addr) {
+    uint16_t val;
+    memcpy(&val, (void *)addr, sizeof(val));
+    return val;
+  }
 
-  uint32_t get32(pint_t addr) { return *((uint32_t *)addr); }
+  uint32_t get32(pint_t addr) {
+    uint32_t val;
+    memcpy(&val, (void *)addr, sizeof(val));
+    return val;
+  }
 
-  uint64_t get64(pint_t addr) { return *((uint64_t *)addr); }
+  uint64_t get64(pint_t addr) {
+    uint64_t val;
+    memcpy(&val, (void *)addr, sizeof(val));
+    return val;
+  }
 
   uintptr_t getP(pint_t addr) {
     if (sizeof(uintptr_t) == sizeof(uint32_t))



Home | Main Index | Thread Index | Old Index