Patchwork [17/22] memory: add big endian support to access_with_adjusted_size

login
register
mail settings
Submitter Paolo Bonzini
Date May 30, 2013, 9:03 p.m.
Message ID <1369947836-2638-18-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/247774/
State New
Headers show

Comments

Paolo Bonzini - May 30, 2013, 9:03 p.m.
This will be used to split 8-byte access down to two four-byte accesses.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 memory.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch

diff --git a/memory.c b/memory.c
index c72f56d..679bd8d 100644
--- a/memory.c
+++ b/memory.c
@@ -362,8 +362,12 @@  static void access_with_adjusted_size(hwaddr addr,
     access_size = MAX(MIN(size, access_size_max), access_size_min);
     access_mask = -1ULL >> (64 - access_size * 8);
     for (i = 0; i < size; i += access_size) {
-        /* FIXME: big-endian support */
+#ifdef TARGET_WORDS_BIGENDIAN
+        access(opaque, addr + i, value, access_size,
+               (size - access_size - i) * 8, access_mask);
+#else
         access(opaque, addr + i, value, access_size, i * 8, access_mask);
+#endif
     }
 }