Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
* 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm: ARM: Permit any ARMv6K CPU to read the MVFR0 and MVFR1 VFP registers. target-arm: Minimalistic CPU QOM'ification target-arm: Drop cpu_arm_close()
This commit is contained in:
commit
e7c56016f9
@ -92,6 +92,7 @@ endif
|
|||||||
libobj-$(TARGET_SPARC64) += vis_helper.o
|
libobj-$(TARGET_SPARC64) += vis_helper.o
|
||||||
libobj-$(CONFIG_NEED_MMU) += mmu.o
|
libobj-$(CONFIG_NEED_MMU) += mmu.o
|
||||||
libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
|
libobj-$(TARGET_ARM) += neon_helper.o iwmmxt_helper.o
|
||||||
|
libobj-$(TARGET_ARM) += cpu.o
|
||||||
ifeq ($(TARGET_BASE_ARCH), sparc)
|
ifeq ($(TARGET_BASE_ARCH), sparc)
|
||||||
libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
|
libobj-y += fop_helper.o cc_helper.o win_helper.o mmu_helper.o ldst_helper.o
|
||||||
libobj-y += cpu_init.o
|
libobj-y += cpu_init.o
|
||||||
|
71
target-arm/cpu-qom.h
Normal file
71
target-arm/cpu-qom.h
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* QEMU ARM CPU
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 SUSE LINUX Products GmbH
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, see
|
||||||
|
* <http://www.gnu.org/licenses/gpl-2.0.html>
|
||||||
|
*/
|
||||||
|
#ifndef QEMU_ARM_CPU_QOM_H
|
||||||
|
#define QEMU_ARM_CPU_QOM_H
|
||||||
|
|
||||||
|
#include "qemu/cpu.h"
|
||||||
|
#include "cpu.h"
|
||||||
|
|
||||||
|
#define TYPE_ARM_CPU "arm-cpu"
|
||||||
|
|
||||||
|
#define ARM_CPU_CLASS(klass) \
|
||||||
|
OBJECT_CLASS_CHECK(ARMCPUClass, (klass), TYPE_ARM_CPU)
|
||||||
|
#define ARM_CPU(obj) \
|
||||||
|
OBJECT_CHECK(ARMCPU, (obj), TYPE_ARM_CPU)
|
||||||
|
#define ARM_CPU_GET_CLASS(obj) \
|
||||||
|
OBJECT_GET_CLASS(ARMCPUClass, (obj), TYPE_ARM_CPU)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ARMCPUClass:
|
||||||
|
* @parent_reset: The parent class' reset handler.
|
||||||
|
*
|
||||||
|
* An ARM CPU model.
|
||||||
|
*/
|
||||||
|
typedef struct ARMCPUClass {
|
||||||
|
/*< private >*/
|
||||||
|
CPUClass parent_class;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
void (*parent_reset)(CPUState *cpu);
|
||||||
|
} ARMCPUClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ARMCPU:
|
||||||
|
* @env: #CPUARMState
|
||||||
|
*
|
||||||
|
* An ARM CPU core.
|
||||||
|
*/
|
||||||
|
typedef struct ARMCPU {
|
||||||
|
/*< private >*/
|
||||||
|
CPUState parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
CPUARMState env;
|
||||||
|
} ARMCPU;
|
||||||
|
|
||||||
|
static inline ARMCPU *arm_env_get_cpu(CPUARMState *env)
|
||||||
|
{
|
||||||
|
return ARM_CPU(container_of(env, ARMCPU, env));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define ENV_GET_CPU(e) CPU(arm_env_get_cpu(e))
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
60
target-arm/cpu.c
Normal file
60
target-arm/cpu.c
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/*
|
||||||
|
* QEMU ARM CPU
|
||||||
|
*
|
||||||
|
* Copyright (c) 2012 SUSE LINUX Products GmbH
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, see
|
||||||
|
* <http://www.gnu.org/licenses/gpl-2.0.html>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "cpu-qom.h"
|
||||||
|
#include "qemu-common.h"
|
||||||
|
|
||||||
|
/* CPUClass::reset() */
|
||||||
|
static void arm_cpu_reset(CPUState *s)
|
||||||
|
{
|
||||||
|
ARMCPU *cpu = ARM_CPU(s);
|
||||||
|
ARMCPUClass *acc = ARM_CPU_GET_CLASS(cpu);
|
||||||
|
|
||||||
|
acc->parent_reset(s);
|
||||||
|
|
||||||
|
/* TODO Inline the current contents of cpu_state_reset(),
|
||||||
|
once cpu_reset_model_id() is eliminated. */
|
||||||
|
cpu_state_reset(&cpu->env);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void arm_cpu_class_init(ObjectClass *oc, void *data)
|
||||||
|
{
|
||||||
|
ARMCPUClass *acc = ARM_CPU_CLASS(oc);
|
||||||
|
CPUClass *cc = CPU_CLASS(acc);
|
||||||
|
|
||||||
|
acc->parent_reset = cc->reset;
|
||||||
|
cc->reset = arm_cpu_reset;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const TypeInfo arm_cpu_type_info = {
|
||||||
|
.name = TYPE_ARM_CPU,
|
||||||
|
.parent = TYPE_CPU,
|
||||||
|
.instance_size = sizeof(ARMCPU),
|
||||||
|
.abstract = false,
|
||||||
|
.class_size = sizeof(ARMCPUClass),
|
||||||
|
.class_init = arm_cpu_class_init,
|
||||||
|
};
|
||||||
|
|
||||||
|
static void arm_cpu_register_types(void)
|
||||||
|
{
|
||||||
|
type_register_static(&arm_cpu_type_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
type_init(arm_cpu_register_types)
|
@ -238,7 +238,6 @@ typedef struct CPUARMState {
|
|||||||
CPUARMState *cpu_arm_init(const char *cpu_model);
|
CPUARMState *cpu_arm_init(const char *cpu_model);
|
||||||
void arm_translate_init(void);
|
void arm_translate_init(void);
|
||||||
int cpu_arm_exec(CPUARMState *s);
|
int cpu_arm_exec(CPUARMState *s);
|
||||||
void cpu_arm_close(CPUARMState *s);
|
|
||||||
void do_interrupt(CPUARMState *);
|
void do_interrupt(CPUARMState *);
|
||||||
void switch_mode(CPUARMState *, int);
|
void switch_mode(CPUARMState *, int);
|
||||||
uint32_t do_arm_semihosting(CPUARMState *env);
|
uint32_t do_arm_semihosting(CPUARMState *env);
|
||||||
@ -383,6 +382,7 @@ enum arm_features {
|
|||||||
ARM_FEATURE_ARM_DIV, /* divide supported in ARM encoding */
|
ARM_FEATURE_ARM_DIV, /* divide supported in ARM encoding */
|
||||||
ARM_FEATURE_VFP4, /* VFPv4 (implies that NEON is v2) */
|
ARM_FEATURE_VFP4, /* VFPv4 (implies that NEON is v2) */
|
||||||
ARM_FEATURE_GENERIC_TIMER,
|
ARM_FEATURE_GENERIC_TIMER,
|
||||||
|
ARM_FEATURE_MVFR, /* Media and VFP Feature Registers 0 and 1 */
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline int arm_feature(CPUARMState *env, int feature)
|
static inline int arm_feature(CPUARMState *env, int feature)
|
||||||
@ -476,6 +476,7 @@ static inline void cpu_clone_regs(CPUARMState *env, target_ulong newsp)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "cpu-all.h"
|
#include "cpu-all.h"
|
||||||
|
#include "cpu-qom.h"
|
||||||
|
|
||||||
/* Bit usage in the TB flags field: */
|
/* Bit usage in the TB flags field: */
|
||||||
#define ARM_TBFLAG_THUMB_SHIFT 0
|
#define ARM_TBFLAG_THUMB_SHIFT 0
|
||||||
|
@ -254,6 +254,7 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
|
|||||||
}
|
}
|
||||||
if (arm_feature(env, ARM_FEATURE_V6K)) {
|
if (arm_feature(env, ARM_FEATURE_V6K)) {
|
||||||
set_feature(env, ARM_FEATURE_V6);
|
set_feature(env, ARM_FEATURE_V6);
|
||||||
|
set_feature(env, ARM_FEATURE_MVFR);
|
||||||
}
|
}
|
||||||
if (arm_feature(env, ARM_FEATURE_V6)) {
|
if (arm_feature(env, ARM_FEATURE_V6)) {
|
||||||
set_feature(env, ARM_FEATURE_V5);
|
set_feature(env, ARM_FEATURE_V5);
|
||||||
@ -278,6 +279,10 @@ static void cpu_reset_model_id(CPUARMState *env, uint32_t id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* TODO Move contents into arm_cpu_reset() in cpu.c,
|
||||||
|
* once cpu_reset_model_id() is eliminated,
|
||||||
|
* and then forward to cpu_reset() here.
|
||||||
|
*/
|
||||||
void cpu_state_reset(CPUARMState *env)
|
void cpu_state_reset(CPUARMState *env)
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
@ -400,6 +405,7 @@ static int vfp_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg)
|
|||||||
|
|
||||||
CPUARMState *cpu_arm_init(const char *cpu_model)
|
CPUARMState *cpu_arm_init(const char *cpu_model)
|
||||||
{
|
{
|
||||||
|
ARMCPU *cpu;
|
||||||
CPUARMState *env;
|
CPUARMState *env;
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
static int inited = 0;
|
static int inited = 0;
|
||||||
@ -407,7 +413,8 @@ CPUARMState *cpu_arm_init(const char *cpu_model)
|
|||||||
id = cpu_arm_find_by_name(cpu_model);
|
id = cpu_arm_find_by_name(cpu_model);
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
env = g_malloc0(sizeof(CPUARMState));
|
cpu = ARM_CPU(object_new(TYPE_ARM_CPU));
|
||||||
|
env = &cpu->env;
|
||||||
cpu_exec_init(env);
|
cpu_exec_init(env);
|
||||||
if (tcg_enabled() && !inited) {
|
if (tcg_enabled() && !inited) {
|
||||||
inited = 1;
|
inited = 1;
|
||||||
@ -493,11 +500,6 @@ static uint32_t cpu_arm_find_by_name(const char *name)
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cpu_arm_close(CPUARMState *env)
|
|
||||||
{
|
|
||||||
g_free(env);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int bad_mode_switch(CPUARMState *env, int mode)
|
static int bad_mode_switch(CPUARMState *env, int mode)
|
||||||
{
|
{
|
||||||
/* Return true if it is not valid for us to switch to
|
/* Return true if it is not valid for us to switch to
|
||||||
|
@ -2906,7 +2906,7 @@ static int disas_vfp_insn(CPUARMState * env, DisasContext *s, uint32_t insn)
|
|||||||
case ARM_VFP_MVFR0:
|
case ARM_VFP_MVFR0:
|
||||||
case ARM_VFP_MVFR1:
|
case ARM_VFP_MVFR1:
|
||||||
if (IS_USER(s)
|
if (IS_USER(s)
|
||||||
|| !arm_feature(env, ARM_FEATURE_VFP3))
|
|| !arm_feature(env, ARM_FEATURE_MVFR))
|
||||||
return 1;
|
return 1;
|
||||||
tmp = load_cpu_field(vfp.xregs[rn]);
|
tmp = load_cpu_field(vfp.xregs[rn]);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user