[Top][All Lists]

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

Re: [Qemu-devel] [PATCH v2 2/3] PPC: Allow little-endian user mode.

From: 關振德
Subject: Re: [Qemu-devel] [PATCH v2 2/3] PPC: Allow little-endian user mode.
Date: Tue, 13 May 2014 00:30:23 -0700

On Tue, May 13, 2014 at 12:05 AM, Alexander Graf <address@hidden> wrote:

On 10.05.14 11:16, Doug Kwan wrote:
This allow running PPC64 little-endian in user mode if target is configured
that way.  In PPC64 LE user mode we set MSR.LE during initialization.
Overhaul handling of byteswapping in code generation and mem helpers.

Signed-off-by: Doug Kwan <address@hidden>
  target-ppc/mem_helper.c     |  25 ++++++--
  target-ppc/translate.c      | 150 +++++++++++++++++---------------------------
  target-ppc/translate_init.c |   9 +++
  3 files changed, 89 insertions(+), 95 deletions(-)


diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
index 4d94015..84381ae 100644
--- a/target-ppc/translate_init.c
+++ b/target-ppc/translate_init.c
@@ -8418,6 +8418,9 @@ static void ppc_cpu_reset(CPUState *s)
      msr |= (target_ulong)1 << MSR_VR; /* Allow altivec usage */
      msr |= (target_ulong)1 << MSR_SPE; /* Allow SPE usage */
      msr |= (target_ulong)1 << MSR_PR;
+    msr |= (target_ulong)1 << MSR_LE; /* Little-endian user mode */
    #if defined(TARGET_PPC64)
@@ -8461,6 +8464,12 @@ static void ppc_cpu_reset(CPUState *s)
        /* Flush all TLBs */
      tlb_flush(s, 1);
+    if (!msr_le) {
+        cpu_abort(CPU(cpu), "Cannot set QEMU to little-endian user mode\n");

We don't have this check the other way around, so why do we need it here? How do you ever get to this?


I am just being paranoid as I am new to this code base.  The reason why this is asymmetric because the PPC targets are big-endian by default and I don't know if all CPUs support setting msr.le.  If someone specifies a CPU that does not support little-endian mode, I want to stop qemu early with an error.  The check can be removed if it is redundant.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]