qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/10] target-s390: Fix STIDP


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 07/10] target-s390: Fix STIDP
Date: Mon, 30 Sep 2013 20:13:11 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120306 Thunderbird/10.0.3

On 09/23/2013 04:04 PM, Richard Henderson wrote:
The implementation had been incomplete, as we did not store the
machine type.

Signed-off-by: Richard Henderson<address@hidden>
---
  target-s390x/cpu.c       |  2 ++
  target-s390x/cpu.h       | 14 +++++++++++++-
  target-s390x/translate.c |  2 +-
  3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 01ff49b..d003dcf 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -257,6 +257,8 @@ static void s390_cpu_initfn(Object *obj)
      env->facilities[0] |= FAC0_Z9_109;
  #endif

+    env->machine_type = 0x20940000;   /* ??? Also Z9-109.  */

This really wants to be selected by -cpu.

+
      if (tcg_enabled()&&  !inited) {
          inited = true;
          s390x_translate_init();
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index a0bafef..95f9cab 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -197,7 +197,19 @@ typedef struct CPUS390XState {
      /* reset does memset(0) up to here */
      uint64_t facilities[2];

-    int cpu_num;
+    union {
+        uint64_t cpuid;
+        struct {
+#ifdef HOST_WORDS_BIGENDIAN
+            uint32_t cpu_num;
+            uint32_t machine_type;
+#else
+            uint32_t machine_type;
+            uint32_t cpu_num;
+#endif

Are we guaranteed that we don't need to pack? Also anonymous unions/structs are a gcc extension IIRC. And why do you swap endianness here, but not above when defining the machine_type value?


Alex

+        };
+    };
+
      uint8_t *storage_keys;

      uint64_t tod_offset;
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index 192d54e..25a6537 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -3242,7 +3242,7 @@ static ExitStatus op_stctl(DisasContext *s, DisasOps *o)
  static ExitStatus op_stidp(DisasContext *s, DisasOps *o)
  {
      check_privileged(s);
-    tcg_gen_ld32u_i64(o->out, cpu_env, offsetof(CPUS390XState, cpu_num));
+    tcg_gen_ld_i64(o->out, cpu_env, offsetof(CPUS390XState, cpuid));
      return NO_EXIT;
  }





reply via email to

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