mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
target-unicore32: Move CPU-dependent init into initfn
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>
This commit is contained in:
parent
ae0f5e9ea8
commit
8df9082da6
2 changed files with 14 additions and 23 deletions
|
@ -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[] = {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue