qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH v3 5/5] target-unicore32: Move CPU-dependent init into initfn
Date: Fri, 30 Mar 2012 12:26:10 +0200	[thread overview]
Message-ID: <1333103170-13529-6-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1333103170-13529-1-git-send-email-afaerber@suse.de>

Instead of setting values in a CPUID switch, do so in initfn functions.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
---
 target-unicore32/cpu.c    |   14 ++++++++++++++
 target-unicore32/helper.c |   23 -----------------------
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/target-unicore32/cpu.c b/target-unicore32/cpu.c
index 189b6f6..de63f58 100644
--- a/target-unicore32/cpu.c
+++ b/target-unicore32/cpu.c
@@ -15,6 +15,11 @@
 #include "cpu-qom.h"
 #include "qemu-common.h"
 
+static inline void set_feature(CPUUniCore32State *env, int feature)
+{
+    env->features |= feature;
+}
+
 /* CPU models */
 
 typedef struct UniCore32CPUInfo {
@@ -28,6 +33,12 @@ static void unicore_ii_cpu_initfn(Object *obj)
     CPUUniCore32State *env = &cpu->env;
 
     env->cp0.c0_cpuid = 0x40010863;
+
+    set_feature(env, UC32_HWCAP_CMOV);
+    set_feature(env, UC32_HWCAP_UCF64);
+    env->ucf64.xregs[UC32_UCF64_FPSCR] = 0;
+    env->cp0.c0_cachetype = 0x1dd20d2;
+    env->cp0.c1_sys = 0x00090078;
 }
 
 static void uc32_any_cpu_initfn(Object *obj)
@@ -36,6 +47,9 @@ static void uc32_any_cpu_initfn(Object *obj)
     CPUUniCore32State *env = &cpu->env;
 
     env->cp0.c0_cpuid = 0xffffffff;
+
+    set_feature(env, UC32_HWCAP_CMOV);
+    set_feature(env, UC32_HWCAP_UCF64);
 }
 
 static const UniCore32CPUInfo uc32_cpus[] = {
diff --git a/target-unicore32/helper.c b/target-unicore32/helper.c
index 0f23a40..9fe4a37 100644
--- a/target-unicore32/helper.c
+++ b/target-unicore32/helper.c
@@ -14,16 +14,10 @@
 #include "helper.h"
 #include "host-utils.h"
 
-static inline void set_feature(CPUUniCore32State *env, int feature)
-{
-    env->features |= feature;
-}
-
 CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
 {
     UniCore32CPU *cpu;
     CPUUniCore32State *env;
-    uint32_t id;
     static int inited = 1;
 
     if (object_class_by_name(cpu_model) == NULL) {
@@ -32,23 +26,6 @@ CPUUniCore32State *uc32_cpu_init(const char *cpu_model)
     cpu = UNICORE32_CPU(object_new(cpu_model));
     env = &cpu->env;
 
-    id = env->cp0.c0_cpuid;
-    switch (id) {
-    case UC32_CPUID_UCV2:
-        set_feature(env, UC32_HWCAP_CMOV);
-        set_feature(env, UC32_HWCAP_UCF64);
-        env->ucf64.xregs[UC32_UCF64_FPSCR] = 0;
-        env->cp0.c0_cachetype = 0x1dd20d2;
-        env->cp0.c1_sys = 0x00090078;
-        break;
-    case UC32_CPUID_ANY: /* For userspace emulation.  */
-        set_feature(env, UC32_HWCAP_CMOV);
-        set_feature(env, UC32_HWCAP_UCF64);
-        break;
-    default:
-        cpu_abort(env, "Bad CPU ID: %x\n", id);
-    }
-
     if (inited) {
         inited = 0;
         uc32_translate_init();
-- 
1.7.7

  parent reply	other threads:[~2012-03-30 10:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-30 10:26 [Qemu-devel] [PULL] QOM CPUState for unicore32 Andreas Färber
2012-03-30 10:26 ` [Qemu-devel] [PATCH v3 1/5] MAINTAINERS: Add entry for UniCore32 Andreas Färber
2012-03-30 10:26 ` [Qemu-devel] [PATCH v3 2/5] target-unicore32: Relicense to GPLv2+ Andreas Färber
2012-03-30 10:26 ` [Qemu-devel] [PATCH v3 3/5] target-unicore32: License future contributions under GPLv2+ Andreas Färber
2012-03-30 10:26 ` [Qemu-devel] [PATCH v3 4/5] target-unicore32: QOM'ify CPU Andreas Färber
2012-03-30 16:15   ` Michael Roth
2012-03-30 21:38     ` Andreas Färber
2012-03-30 23:04       ` Michael Roth
2012-03-30 10:26 ` Andreas Färber [this message]
2012-03-31 13:03 ` [Qemu-devel] [PULL] QOM CPUState for unicore32 Blue Swirl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1333103170-13529-6-git-send-email-afaerber@suse.de \
    --to=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).