diff mbox

[3/5] Fix arm_semi_flen_cb for BE32 system mode.

Message ID 20161206151154.71c69b41@squid.athome
State New
Headers show

Commit Message

Julian Brown Dec. 6, 2016, 3:11 p.m. UTC
On Fri, 4 Nov 2016 10:00:19 +0100
Paolo Bonzini <pbonzini@redhat.com> wrote:

> On 03/11/2016 18:30, Julian Brown wrote:

> > +#ifdef CONFIG_USER_ONLY

> >      size = be32_to_cpu(size);

> > +#else

> > +    /* If we're running in BE32 system mode, we don't need to do

> > an explicit

> > +     * byte swap, because (I think) target memory is already

> > stored in

> > +     * byte-swapped format.  

> 

> Isn't this true also of user-mode (both BE8 and BE32)?


I'm not sure, I don't think the "load-time" byteswapping affects user
mode in the same way. Anyway, this can be refactored as attached, which
looks a bit more plausible perhaps.

Thanks,

Julian
diff mbox

Patch

From 0e5d7e43404250900bfea3f8dc21fefa59069190 Mon Sep 17 00:00:00 2001
From: Julian Brown <julian@codesourcery.com>
Date: Thu, 6 Oct 2016 04:02:08 -0700
Subject: [PATCH 4/4] Fix arm_semi_flen_cb for BE32 system mode.

This patch fixes the arm_semi_flen_cb callback so that it doesn't return
a byte-swapped size in BE32 system mode.
---
 target-arm/arm-semi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-arm/arm-semi.c b/target-arm/arm-semi.c
index a9cf5f2..1ad1e63 100644
--- a/target-arm/arm-semi.c
+++ b/target-arm/arm-semi.c
@@ -187,7 +187,7 @@  static void arm_semi_flen_cb(CPUState *cs, target_ulong ret, target_ulong err)
     /* The size is always stored in big-endian order, extract
        the value. We assume the size always fit in 32 bits.  */
     uint32_t size;
-    cpu_memory_rw_debug(cs, arm_flen_buf(cpu) + 32, (uint8_t *)&size, 4, 0);
+    armsemi_memory_rw_debug(cs, arm_flen_buf(cpu) + 32, (uint8_t *)&size, 4, 0);
     size = be32_to_cpu(size);
     if (is_a64(env)) {
         env->xregs[0] = size;
-- 
1.9.1